kvnang / workers-og

An `og:image` (social card) generator that is fast, browser-less (no Puppeteer), and capable of running on the edge. This package is designed to be used with Cloudflare Workers (but may be used elsewhere), with the simple API inspired by `@vercel/og`.
MIT License
194 stars 18 forks source link

Exception "Promise will never complete." in Pages Function #5

Closed NeuronButter closed 9 months ago

NeuronButter commented 9 months ago

Hi there! I'm trying to use workers-og in a Pages Function, but my Worker keeps throwing Error: Promise will never complete. This only occurs when deployed to CF, running this locally in wrangler works fine. I've managed to figure out that the exception occurs when either you try and read the contents (such as let out = new ImageResponse(...); await out.arrayBuffer()) or return the new ImageResponse straight back. Is there any way to fix this? Thanks!

kvnang commented 9 months ago

Hey do you have a minimal reproducible code for this issue? I have it running on a Worker and I was able to simply return it return new ImageResponse( ... ), so perhaps there are different issues here.

NeuronButter commented 9 months ago

Hey there, I've finally worked out why my worker was throwing it. Unrelated, but the same error came up here and made me realise that an image that I was using was unnecessarily large (6000x4000) so it must have gone over a Workers limit once Satori kicked in (don't think it's duration because I thought they did away with that, but maybe memory or CPU time?).

I think it's a bit of an odd error, but not the fault of the library. Pretty sure this is some vague error from the Workers runtime.