cloudflare / cloudflare/workerd
Error when creating response on global scope (outside fetch)
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
I came across the following tweet:
https://x.com/saltyAom/status/1966605125172027460
Words from SaltyAom:
```
Basically you are not allow to define a Response outside of the “fetch” handler in Cloudflare Worker
Which means you can’t create Response beforehand then clone when you actually need it
Elysia relies on this behavior for many plugin and the inline API as well
What’s annoying is that this niche error has caused at least multiple issues in various libraries
Nextjs, Astro Cloudflare Adapter, even Hono
Try “cloudflare worker disallowed operation called within global scope”
There’s literally 0 documentation even direct link from the error
```
It's possible to fix this since it could lead to add support to Elysia?
/cc @anonrig
Contributor guide
Assessment
This issue has not been assessed yet.