Global context & data is lost between custom server and Next.js router/renderer #54782
Closed
1 task done
Labels
bug
Issue was opened via the bug report template.
locked
Output (export/standalone)
Related to the the output option in `next.config.js`.
Pages Router
Related to Pages Router.
Runtime
Related to Node.js or Edge Runtime with Next.js.
Verify canary release
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP PREEMPT_DYNAMIC Sun Aug 6 20:05:33 UTC 2023 Binaries: Node: 16.17.0 npm: 8.15.0 Yarn: 1.22.19 pnpm: 7.1.0 Relevant Packages: next: 13.4.20-canary.12 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.3 Next.js Config: output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
App Router, Data fetching (gS(S)P, getInitialProps), Middleware / Edge (API routes, runtime), Standalone mode (output: "standalone")
Link to the code that reproduces this issue or a replay of the bug
https://codesandbox.io/p/sandbox/relaxed-phoebe-jncmvg
To Reproduce
next
version13.4.13
or highernconf
(a singleton module)nconf
store in custom server.nconf
object in Next.js context. (ie: pages/, app/, gSSP, API route, etc.)Describe the Bug
All global context and data is lost between the custom server context and the Next.js context.
As you can see below, the global (singleton) module was cached and worked across the custom server and Next.js gSSP in 13.4.12, but doesn't work in versions 13.4.13 or higher.
Custom server code
Next.js 13.4.12
Next.js 13.4.19
Link to related issue:
Expected Behavior
Global data stays intact between both contexts.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: