You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a standard Next.js self hosted app the global scopes of the edge and nodejs runtimes are isolated, meaning that for example if your code mutates the global scope inside a runtime (e.g. edge), such mutation won't be reflected in the global scope of the other runtime (e.g. nodejs)
However that is not the case in open-next Cloudflare apps, where there is only a single shared global scope
Steps to reproduce
Save some value in the global scope of a runtime and try to retrieve it from another runtime1
I don't know how serious this issue is, my gut feeling is that it's pretty unimportant, but anyways I think that anything that makes our apps diverge from standard Next.js apps is bad and should ideally be solved/looked into, or at least documented in some way (even having this issue open is better than nothing?).
Also I think that solving this issue might not be trivial since we'd have to create some sort of artificial global scope wrappers for the different runtimes... it might not be worth the extra complexity to be honest...
Describe the bug
In a standard Next.js self hosted app the global scopes of the edge and nodejs runtimes are isolated, meaning that for example if your code mutates the global scope inside a runtime (e.g.
edge
), such mutation won't be reflected in the global scope of the other runtime (e.g.nodejs
)However that is not the case in open-next Cloudflare apps, where there is only a single shared global scope
Steps to reproduce
Save some value in the global scope of a runtime and try to retrieve it from another runtime1
Minimal Reproduction: https://github.com/dario-piotrowicz/open-next-cloudflare-shared-global-issue-repro
Expected behavior
Open-next Cloudflare apps should behave as closely as possible to standard Next.js self hosted apps
@opennextjs/cloudflare version
0.5.3
Wrangler version
3.109.3
next info output
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 Available memory (MB): 32768 Available CPU cores: 10 Binaries: Node: 20.11.0 npm: 10.2.4 Yarn: 1.22.19 pnpm: 9.12.1 Relevant Packages: next: 15.1.7 // Latest available version is detected (15.1.7). eslint-config-next: 15.0.4 react: 19.0.0 react-dom: 19.0.0 typescript: 5.7.3 Next.js Config: output: N/A
Additional context
No response
Footnotes
currently the only way to run edge runtime code in the adapter is via a middleware ↩
The text was updated successfully, but these errors were encountered: