Question about opengraph-image.tsx
Unanswered
Blue swimming crab posted this in #help-forum
Blue swimming crabOP
Hi, I've a question about generating opengraph image programatically. I was looking at the example given on the docs, https://nextjs.org/docs/app/api-reference/file-conventions/metadata/opengraph-image#generate-images-using-code-js-ts-tsx
Doing something like that works,.. but if I do something like this
as in the path is passed in as a variable, I got a fetch failed error. Something like this
I wanted "opengraph-image.tsx" to fetch something programatically based on the params sent. Am I missing something?
const interSemiBold = fetch(
new URL('./Inter-SemiBold.ttf', import.meta.url)
).then((res) => res.arrayBuffer())Doing something like that works,.. but if I do something like this
const urlpath = "./Inter-SemiBold.ttf";
const interSemiBold = fetch(
new URL(urlpath, import.meta.url)
).then((res) => res.arrayBuffer())as in the path is passed in as a variable, I got a fetch failed error. Something like this
⨯ node_modules/next/dist/compiled/react/cjs/react.shared-subset.development.js (210:15) @ originalFetch
⨯ fetch failedI wanted "opengraph-image.tsx" to fetch something programatically based on the params sent. Am I missing something?