Edge Chunks are not copied over from original .next/server to .next in .next/standalone/server
Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro for Workstations
Binaries:
Node: 18.12.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 13.0.3-canary.3
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
What browser are you using? (if relevant)
Chrome 107.0.5304.89 / Firefox Developer Edition 107.0b9
How are you deploying your application? (if relevant)
Fly.io (https://reproduction-next-standalone-edge-chunks.fly.dev/ //removed because of the 2-app limit set by Fly.io)
Describe the Bug
When I used output: "standalone" in next.config.js and deployed it on Fly.io using Dockerfile (same as the one in examples/with-docker) and then went to /api/hello, instead of seeing the expected og image generated with vercel/og, I saw an error like this "Internal Server Error". When I checked Fly.io's log it turned out that there's no such file as '.next/server/edge-chunks/wasm_5b50c798761dc0131e9ebe945031077e8a02633b.wasm'.
So I tried building the app locally it turned out that there exists files with the name 'wasm_long hash.wasm' in the root .next's ./server/edge-chunks, but that edge-chunks folder wasn't copied into the .next/server folder in .next/standalone.
Oh, and upon building it locally, I also saw this
I don't know if it may be related to the issue, so here it is.
Thank you :)
Expected Behavior
Everything should works normally as if in next dev or production without standalone mode.
Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster
https://github.com/DuCanhGH/no-edge-chunks-in-next-standalone
To Reproduce
To reproduce you have to:
- Deploy the repository on somewhere that supports Dockerfile, or:
- Clone the repository.
- Run
pnpm i. - Run
pnpm build. - Run
node .next/standalone/server.js, if this doesn't work then you may have to use Docker to build an image and start it (this is the case for me on Windows). - Go to /api/hello.
same issue
Same, got root page in app directory, but got 404.
nextjs: `13.0.5`
module.exports = {
poweredByHeader: false,
reactStrictMode: true,
swcMinify: true,
experimental: {
appDir: true,
},
output: 'standalone',
};
next build
cp -r ./.next/standalone ./app
cp -r ./.next/static ./app/.next
cp -r ./public ./app/.next
node ./app/server.js
Page will throw 404.
When i will try to copy manualy folders chunks and app, it works.
cp -r ./.next/server ./app/.next/server
cp -r ./.next/chunks ./app/.next/server
@jandolezal71 have you tested it with the latest canary build? Support for app/ dir in output: "standalone" arrived a few days ago, so you shouldn't see 404 error for urls from app/ anymore.
@jandolezal71 have you tested it with the latest canary build? Support for app/ dir in
output: "standalone"arrived a few days ago, so you shouldn't see 404 error for urls from app/ anymore.
Hi,
cool, with 13.0.6-canary1 it works now, BUT, static somehow stopped working :-) After next build, i will copy static directory into standalone/.next directory, besides server directory, but static are returning 404.


@jandolezal71 that's kinda weird. I'm not seeing that issue for some reason. Have you tried restarting the server? Maybe you copied static/ into .next/standalone/.next after you had launched the server? In that case, you'd have to restart the server for it to recognize the static/ dir and serve it.
Ah, 🤦 i did not. Thank you, that's resolved then.
Can confirm this is an issue with 13.0.5 & an edge api route I'm using.
I'm using the OG image generation, which doesn't work with 13.0.5: https://github.com/cstenglein/manysats/blob/main/pages/api/og.tsx
With 13.0.6-canary.2 the edge API route is working again, but building the application still generates the following warning:
warn - Failed to copy traced files for /manysats/.next/server/pages/api/og.js [Error: ENOENT: no such file or directory, open '/manysats/.next/server/pages/api/og.js.nft.json'] {
@cstenglein I've opened a PR on that warning, see #43326 :) Should be gone after that one hopefully gets approved
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.