KenykaK
Convex Community16mo ago
16 replies
Kenyka

Getting Url for a file in convex

When I try to send a request, it writes an error 404 Not found, I tried to find the answer in the documentation and the problem is that the file id that we have does not work to receive the link

function getFileUrl(fileId: Id<"_storage">): string{
    return `${process.env.NEXT_PUBLIC_CONVEX_URL}/getImage?storageId=${fileId}`
}


here is the code in which I call the function:

{
  file.type === "image" && <Image alt={file.name} width="200" height="100" src={getFileUrl(file.fileId)}/>
}


id that I use and I have this fileId in the database
image.png
image.png
Was this page helpful?