Next.js opengraph-image generates 500 when sharing a link
The page opens normally, but endpoint /opengraph-image returns 500 and the thumbnail in the communicator does not work. The generation of OG graphics has separate environmental and font limitations and can follow instructions other than the main page.
How to identify the source of the problem
Track the error log of the graphics route itself and check that the request does not involve a different runtime. Verify image size, supported formats and whether the font used is available in the implementation package.
Compare the message from the console with the result of the production compilation and the condition after the page has been refreshed.
Repair steps
Simplify the renderer and transfer the correct fonts or resources supported by ImageResponse, without appeals to the unavailable filesystem. Test the image directly under its URL, regardless of page rendering and Open Graph metadata.
How to Test Solution
The image returns 200 with the correct media type, and the link preview shows the current graphics.
Security and restrictions
Do not assume that the correct og:image in HTML means the working endpoint of the thumbnail itself.