//als-snapshotbyvicb

als-snapshot

0
0
0
TypeScript

Reproduction:

  • run “pnpm i” && “pnpm wrangler dev”
  • visit “http://localhost:8787
  • it will capture an ALS snapshot (snapshot = AsyncLocalStorage.snapshot();)
  • then redirect to “/step2”
  • this subsequent request will fetch() in the snapshot context.

The following error is logged:

[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)
[beta]v0.13.0