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
I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000
Binaries:
Node: 18.12.1
npm: 8.19.2
Yarn: 1.22.19
pnpm: 7.1.7
Relevant packages:
next: 13.0.3-canary.4
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
warn - Latest canary version not detected, detected: "13.0.3-canary.4", newest: "13.0.3".
Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue
What browser are you using? (if relevant)
N/A
How are you deploying your application? (if relevant)
N/A
Describe the Bug
When using the Next.js JS API to programmatically create a Node.js HTTP server for one of several Next.js project directories (that have already been built via npx next build), after the first server for the first project has been started and a page has been served, if you stop that server and use the same Next.js installation to serve the second project and fetch the same route (e.g. the home page), the content of the first Next.js project that is no longer being served is incorrectly served in place of the content of the route in the second project.
This used to work correctly in Next.js v12, but is broken in Next.js v13. This issue has broken the tests for the package next-server-context; it has a fixtures folder of different kinds of Next.js projects that are one by one served for various tests using the one dev dependency installation of next.
Expected Behavior
The Next.js programatic API for serving projects should be usable for multiple Next.js projects, without whichever one that was served and fetched first corrupting the responses for later projects and requests.
Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster
constnext=require("next");const{ createServer }=require("node:http");consthttpServer1=createServer(next({dir: "./next-project-1",}).getRequestHandler());httpServer1.listen(async()=>{const{ port }=httpServer1.address();constresponse=awaitfetch(`http://localhost:${port}`);consthtml=awaitresponse.text();console.log(html);httpServer1.close();consthttpServer2=createServer(next({dir: "./next-project-2",}).getRequestHandler());httpServer2.listen(async()=>{const{ port }=httpServer2.address();constresponse=awaitfetch(`http://localhost:${port}`);consthtml=awaitresponse.text();console.log(html);httpServer2.close();});});
Then in Terminal:
cd next-project-1
npx next build
cd ../next-project-2
npx next build
cd ..
node demo.js
Then note that the logged homepage HTML for both projects incorrectly contains the words Project 1 home page:
If you are to install next@12 instead of using Next.js v13, then the logged HTML for the project 1 home page is Project 1 home page and that of the second project is correctly Project 2 home page.
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale due to two years of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you.
Verify canary release
Provide environment information
What browser are you using? (if relevant)
N/A
How are you deploying your application? (if relevant)
N/A
Describe the Bug
When using the Next.js JS API to programmatically create a Node.js HTTP server for one of several Next.js project directories (that have already been built via
npx next build
), after the first server for the first project has been started and a page has been served, if you stop that server and use the same Next.js installation to serve the second project and fetch the same route (e.g. the home page), the content of the first Next.js project that is no longer being served is incorrectly served in place of the content of the route in the second project.This used to work correctly in Next.js v12, but is broken in Next.js v13. This issue has broken the tests for the package
next-server-context
; it has a fixtures folder of different kinds of Next.js projects that are one by one served for various tests using the one dev dependency installation ofnext
.Expected Behavior
The Next.js programatic API for serving projects should be usable for multiple Next.js projects, without whichever one that was served and fetched first corrupting the responses for later projects and requests.
Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster
N/A
To Reproduce
In
package.json
:In
next-project-1/pages/index.js
:In
next-project-2/pages/index.js
:In
demo.js
:Then in Terminal:
Then note that the logged homepage HTML for both projects incorrectly contains the words
Project 1 home page
:If you are to install
next@12
instead of using Next.js v13, then the logged HTML for the project 1 home page isProject 1 home page
and that of the second project is correctlyProject 2 home page
.The text was updated successfully, but these errors were encountered: