-
Notifications
You must be signed in to change notification settings - Fork 465
Closed
Description
Repro: https://github.com/vicb/als-snapshot
When an AsyncLocalStorage.snapshot() is used in a different request as the one it was created in, the following error is generated:
[wrangler:inf] GET / 302 Found (6ms)
using snapshot
[wrangler:err] Error: Cannot perform I/O on behalf of a different request. I/O objects (such as streams, request/response bodies, and others) created in the context of one request handler cannot be accessed from a different request's handler. This is a limitation of Cloudflare Workers which allows us to improve overall performance. (I/O type: SpanParent)
at Object.apply ([...]/strip-cf-connecting-ip-header.js:9:18)
at null.<anonymous> ([...]/src/index.ts:31:39)
at Object.fetch ([...]/src/index.ts:31:12)
at fetchDispatcher ([...]/middleware-loader.entry.ts:54:17)
The issue happens when using composable cache in Next with the cloudflare adapter, see opennextjs/opennextjs-cloudflare#666 - Thanks @conico974 for figuring the issue out and submitting a patch.
I discussed this offline with @jasnell and he asked me to create the issue.
Not sure if this is something that we can fix or working as intended.
Metadata
Metadata
Assignees
Labels
No labels