Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note about standalone mode not working for app router #51828

Closed
wants to merge 1 commit into from

Conversation

bjornarhagen
Copy link

No description provided.

@HamAndRock
Copy link

We are using standalone mode with appDirectory without any issues on 2 prod projects, as far as I know. The only issue we have is the server dying after some time due to OOM issues, but that's I think unrelated to standalone: #45508

But please correct me if I am wrong and we should get rid of output: standalone

@Innei
Copy link

Innei commented Jun 27, 2023

It seems that this isn't just a problem with appDir, my project uses pageDir, but it's also has this problem

@HamAndRock
Copy link

Yeah, I know. Just wanted to say that we use standalone mode without any problems with appDirectory. The OOM/crashes are not related to this issue.

@bjornarhagen
Copy link
Author

Sorry if this is actually no longer the case, and standalone mode should work fine with the App router. I just ran into this when trying to use standalone mode for this template https://github.com/medusajs/nextjs-starter-medusa. I also tried to install next@canary and build, but get the same error.

So without standalone mode it works fine, but when I turn it on, I get this build error

> Build error occurred
[Error: ENOENT: no such file or directory, lstat '/Users/USERNAME/dev/nextjs-starter-medusa/.next/server/app'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/Users/USERNAME/dev/nextjs-starter-medusa/.next/server/app'
}

@HamAndRock
Copy link

Well I am just unsure, you get some weird errors on start but seems like it works fine in prod,

Copy link
Member

@leerob leerob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking because I'd like to get some clarity here first before this gets merged.

@DuCanhGH
Copy link
Contributor

DuCanhGH commented Jun 29, 2023

@bjornarhagen if you are using the pages/ directory only, perhaps you can try setting experimental.appDir to false? Or add an app/ page if there's none? Thanks!

I added App Router support for output: "standalone" months ago, so the note added in this PR is not correct :)

@bjornarhagen
Copy link
Author

@DuCanhGH I see, must be something https://github.com/medusajs/nextjs-starter-medusa is doing that is causing the standalone build to fail then. Setting experimental.appDir to false does fix the issue.

Thank you so much! 😄

@leerob
Copy link
Member

leerob commented Jun 29, 2023

Note that the experimental flag is not needed with v13.4+.

@kodiakhq kodiakhq bot closed this in #51993 Jul 10, 2023
kodiakhq bot pushed a commit that referenced this pull request Jul 10, 2023
…re is no `app/` page (#51993)

### What?
This PR fixes build crashing when `output: 'standalone'` and `experimental.appDir` is enabled but there is no app pages.

### How?
It does that by checking whether `.next/server/app` exists before copying the folder to `.next/standalone/...`

Closes #51828
Fixes #44442
Fixes #44120
@bjornarhagen bjornarhagen deleted the patch-1 branch July 12, 2023 09:50
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants