Open Graph Images on Demand in a Next.js Pages App

Hi everyone, I'm trying to find a reliable way to generate Open Graph images on demand in my Pages application, which is based on Next.js througj OpenNext. I attempted to use @cloudflare/pages-plugin-vercel-og, but I couldn't get my project to build. I also tried using the native next/og package; however, I'm encountering occasional errors like:
TypeError: Cannot perform Construct on a detached ArrayBuffer
TypeError: Cannot perform Construct on a detached ArrayBuffer
From what I can tell, the error seems to originate from vercel/satori. Has anyone successfully set up on-demand Open Graph image generation in a similar environment (Cloudflare Pages + OpenNext)? Any guidance, working examples, or alternative approaches would be greatly appreciated! Thank you, Christian Account ID: c6928ad860313552cfc09a07a236bf71.
4 Replies
James
James2d ago
OpenNext is for Cloudflare Workers, not Pages. Please report any issues you run into on the GitHub repo.
duxum
duxumOP2d ago
I am using the package @cloudflare/next-on-pages . Which repo to report to may be I am using the packages where they are not intended to suport.
James
James2d ago
I see. There is the next-on-pages repo, but we dont actively maintain that library anymore - I would recommend trying OpenNext
duxum
duxumOP2d ago
Thanks for the information. I started the project like some months ago and I was not aware of those changes. I will try to migrate with Diverce to opennext.js.org/cloudflare and see if there is any error with Open Graph images generation.

Did you find this page helpful?