Skip to content

appDir not supported when building with output standalone mode. All routes fail with 404 errors. #42812

@ferdingler

Description

@ferdingler

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.6.0: Thu Sep 29 20:13:56 PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000
Binaries:
  Node: 16.14.2
  npm: 8.5.0
  Yarn: 1.22.18
  pnpm: N/A
Relevant packages:
  next: 13.0.3
  eslint-config-next: 13.0.3
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

N/A

How are you deploying your application? (if relevant)

Docker

Describe the Bug

The appDir feature does not work when building the app with output: "standalone" mode. The produced .next/standalone/server directory is missing the app content as well as the corresponding traces, dependencies and chunks. This causes the standalone application to throw 404 errors on all page routes.

Expected Behavior

The .next/standalone folder should contain all the necessary files for the app directory along with required node_modules dependencies and related chunk files. The app should not throw 404 errors when running the node .next/standalone/server.js file.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://codesandbox.io/s/unruffled-bose-7eykvd?file=/next.config.js

To Reproduce

  • Enable experimental.appDir = true in next.config.js file.
  • Enable output = "standalone" in next.config.js file.
  • Run a build: npm run build.
  • Run the produced output node .next/standalone/server.js file.

Application crashes with 404 errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    OutputRelated to the the output configuration option.bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions