satori icon indicating copy to clipboard operation
satori copied to clipboard

[Vercel OG] Failed to response when requesting multiple image at once

Open tomy0000000 opened this issue 2 years ago • 4 comments

Bug report

Description / Observed Behavior

When requesting multiple images at once, say, an HTML page with multiple images, an error will be raised:

This invocation reused an I/O object (streams, request/response bodies, and others) created by a previous invocation, which is not permitted.

What makes this worse is that the empty response will be cached, so the same image can not be reproduced correctly in the next 24 hours.

Expected Behavior

Handling the generation right, even if the response time is longer.

Reproduction

See the example available at https://github.com/orgs/vercel/discussions/1437.

Additional Context

Tested with the latest @vercel/og 0.5.4 and can confirm the bug still exists. This is a duplicate of https://github.com/orgs/vercel/discussions/1437. Since there is less attention there, I am forwarding the issue here.

tomy0000000 avatar May 01 '23 03:05 tomy0000000

This is strange as Satori doesn't have external I/O unless you have <img src="...">. Not sure if it's related to the font or WASM file. Need to investigate it a bit.

shuding avatar May 01 '23 21:05 shuding

This is strange as Satori doesn't have external I/O unless you have <img src="...">. Not sure if it's related to the font or WASM file. Need to investigate it a bit.

I wanted to point out that according to @utkarshkukreti's workaround, the issue seems to be related to something that happened on edge, which can be avoided by switching to using satori in serverless function.

tomy0000000 avatar May 02 '23 07:05 tomy0000000

Hi @shuding! We actively use it in production to modify user images. Our team was wondering if there is any progress on the issue. We can also help to accelerate the fix and make it a bounty if you're open to it :)

noskovvkirill avatar Jun 06 '23 17:06 noskovvkirill

hey @noskovvkirill !looks like @shuding is busy recently,but feel free to make a PR to make satori better!

Jackie1210 avatar Jun 08 '23 12:06 Jackie1210