question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Throws 404 on accessing routes in the app directory routing of nextjs 13

See original GitHub issue

Verify 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

  1. Created a new app using: npx create-next-app@latest --experimental-app
  2. Added the docker configuration to be able to deploy to GCP Cloud Run from the with-docker example
  3. Built a docker images using: docker build -t nextjs-docker .
  4. Ran the built docker image using: docker run -p 3000:3000 nextjs-docker
  5. Visit any route from the new app directory and it will throw a 404

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:8
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
ankushrankacommented, Oct 30, 2022

@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?

0reactions
github-actions[bot]commented, Dec 8, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found