Next.js Discord

Discord Forum

OG image generation webview issue

Unanswered
Mickey posted this in #help-forum
Open in Discord
Hey, I have a problem with Open Graph Image generation. https://vercel.com/docs/functions/og-image-generation I followed this and basically I have next.js /api/og page where I generate everything for image. On one of my pages I have all <meta> tags:
        <meta property="og:image" content={ogImageUrl} />
        <meta property="og:image:type" content="image/png" />
        <meta property="og:image:width" content="1200" />
        <meta property="og:image:height" content="630" />
        <meta property="og:type" content="website" />

ogImageUrl is just an url for api/og page where I generate image depending on user profile dynamically. Everything works fine when I share it on discord or twitter or telegram etc. for profiles that have been shared previously. The problem is with profiles that hasn't been shared yet. When I paste the link in the discord for example it does not show anything. I need to paste it few times when it finally fetches image correctly. What can be a problem? I think this sometimes also happen with profiles that have been shared already... I get all the profile data inside api/og page, I do not pass it in server side props.

0 Replies