opengraph-image.tsx image import with Node APIs
Unanswered
Cape lion posted this in #help-forum
Cape lionOP
I'm trying to render a custom image from my
I'm trying to read it like this:
This also seems to be how it's done it the docs: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/opengraph-image#using-nodejs-runtime-with-local-assets
Any idea why this might be happening?
/public folder in an opengraph-image.tsx route, using Node File APIs (readFile, path, etc.). Everything works completely fine locally, but when deploying to Vercel, I get this error: Error generating OG image: Error: ENOENT: no such file or directory, open '/var/task/app-root-directory/public/my-image.png'
I'm trying to read it like this:
const image = await readFile(path.join(process.cwd(), '/public/my-image.png')),This also seems to be how it's done it the docs: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/opengraph-image#using-nodejs-runtime-with-local-assets
Any idea why this might be happening?
1 Reply
Cape lionOP
Any idea why this might be happening?