Throws 404 on accessing routes in the app directory routing of nextjs 13
See original GitHub issueVerify canary release
- 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 21.4.0: Mon Feb 21 20:35:58 PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T6000 Binaries: Node: 16.17.0 npm: 8.19.2 Yarn: 1.22.19 pnpm: 7.5.2 Relevant packages: next: 13.0.0 eslint-config-next: 13.0.0 react: 18.2.0 react-dom: 18.2.0
Which example does this report relate to?
with-docker
What browser are you using? (if relevant)
Chrome 106.0.5249.119
How are you deploying your application? (if relevant)
No response
Describe the Bug
On next dev
and next start
, routes from both pages and app directory load. But 404 is thrown on app directory routes when served from a docker build.
Expected Behavior
Routes loaded from both pages and app directory must serve
To Reproduce
- Created a new app using:
npx create-next-app@latest --experimental-app
- Added the docker configuration to be able to deploy to GCP Cloud Run from the with-docker example
- Built a docker images using:
docker build -t nextjs-docker .
- Ran the built docker image using:
docker run -p 3000:3000 nextjs-docker
- Visit any route from the new app directory and it will throw a 404
Issue Analytics
- State:
- Created a year ago
- Reactions:8
- Comments:5 (1 by maintainers)
Top Results From Across the Web
404 Routes in /app directory #42560 - vercel/next.js - GitHub
This is a feature request about being able to add 404 routes in the /app directory. There's no exact point to stick with,...
Read more >Getting 404 when first loading dynamic routes on nextjs
The real issue is that exporting a next app will make it generate static HTML files. Even though it will still be able...
Read more >Dynamic Routes Details - Next.js
The paths that have not been generated at build time will not result in a 404 page. Instead, Next.js will serve a “fallback”...
Read more >How to handle 404 errors in Next.js 13 | Chapter Three
Next.js 13 uses special files for routing. ... not found/404 errors, we use a special route-name/not-found.tsx file. ... Throwing 404 errors.
Read more >How the App Directory Works in Next.js 13 - MakeUseOf
Next.js 13 introduced a new routing system using the app directory. Next.js 12 already provided an easy way of handling routes through ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@balazsorban44 Thank you. Is there a docker example with nextjs 13 using app directory that can be deployed to Cloud Run (or similar) for testing?
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.