-
Notifications
You must be signed in to change notification settings - Fork 116
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
Standalone directory not found - NextJS 13 Amplify #3132
Comments
Hi @ShiftySlothe 👋🏽 Please try running a build locally to ensure that the
Also please ensure that you are using Next.js version |
Hey @hloriana thanks for the response. https://docs.aws.amazon.com/amplify/latest/userguide/ssr-Amplify-support.html makes it clear you support NextJS 13. Is this not the case? I can also confirm the standalone repo is working locally. EDIT: I note that in the screenshot taken from the article about hosting Next13 "framework" is set. However on my build settings I do not see this option. EDIT 2: I've now created a new branch with just the start template you use on the article I linked above and it initially failed, having ran EDIT 3: I've successfully built the majority of the site now using Next13, I had to add pages incrementally, build and finally it would allow me to build all the pages! However, I now get this issue:
Is it possible to increase this figure? |
I have met this issue too.
|
Hi, unfortunately there is a hard limit of 200MB for the bundle. Our current recommendation for now is to try to reduce the size by minimizing your files. |
Is there a plan to allow increases to that limit in the future and do you have an idea of timelines? We're minimising already however our site has a large number of pages and I doubt we can shave 50% off the bundle size. |
this is a problem that we're looking into, but we don't have a timeline at the moment. Something that would help us is if you could add here the output of running these three commands:
|
I ran into this same This would be very in-line with next.js's edge-first philosophy. I'd be interested to see if the Amplify team could implement that kind of thing as part of the build process. |
Hi, We have the same issue here: It worked before we upgraded to Web Compute with the same project. I solved it temporarily by excluding paths in getStaticPaths and generating the pages on demand for some paths. But that's not an ideal solution. The build output is limited to 220MB, meaning it's possible to statically build about 1 800 pages during the build process if each page is 125KB. |
Hey, Just started to look to use AWS Amplify for my NextJS13 app. I've also ran into the build size issue. My NextJS is using SSR for all pages. Errror I've attempted what was suggested by the docs and added the following to my build step in the .yml file
However this provides another error
Not sure if this is related to the fact I'm using I've searched around for this error but have been unable to find anything. Also here is an output of the three commands
Will see if there's anything I can do to reduce it but any feedback or direction would be greatly appreciated. |
It's over a month later, but I found that:
If you create a minify.sh bash script and add it to your build steps in amplify.yml, this worked for reducing my bundle size:
Unfortunately, even after meeting the size requirements, WEB_COMPUTE is currently having a deployment bundling issue that is causing deployments to fail silently #3213. |
I've run this script and I can't seem to get my output size down any further. I've also tried running esbuild on
Running esbuild helped a bit as I've gotten the bundle size from
Any help reducing this bundle size would be greatly appreciated. |
Running the minify script seemed to do something ... but the output from Updating to add that when getting Amplify to build my application, the minify script reduced the build output from 463721822 to 450400919 ... so that didn't really help much :( |
FYI standalone dir errors can appear also when using a monorepo - #3179 |
Noting here that I am also a victim of the Amplify build limit for a production application we're looking to upgrade to Next.js 13 🥲 And this is after using ESBuild following this StackOverflow post |
Has anyone found a solution to the original problem. I also am getting an error for not having a standalone directory. |
I get the same issue, and it's a road blocker for me. |
I'm stuck too, and would need to find an alternative hosting provider due to this limitation. |
I was having issues as well similar to those above however we couldn't wait and really wanted to reap the benefits of serverless, edge and nextjs 13. Luckily we found another solution that also deploys to AWS services (lambda, apigateway, etc) and has been working really well in our tests so far: https://sst.dev/. Would recommend for those that want to still utilize AWS and need a working solution now. |
I solved the error "CustomerError: Standalone directory not found" doing the following:
const nextConfig = {
reactStrictMode: true,
output: 'standalone',
images: {
unoptimized: true,
}
}
module.exports = nextConfig Step 3: Update the build script in the package.json file to include the next export command, which generates the static files for the app: "scripts": {
"dev": "next dev",
"build": "next build && next export",
"start": "next start",
"lint": "next lint"
} Step 4: Change the output directory to out. This is where the generated static files will be stored. Here's an example of what your deployment configuration might look like: version: 1
frontend:
phases:
preBuild:
commands:
- yarn install
build:
commands:
- yarn run build
artifacts:
baseDirectory: out
files:
- '**/*'
cache:
paths:
- node_modules/** I hope it works for you. |
I still having this issue |
NextJS 13 error still occurs. amplify.yml has very straightforward configuration version: 1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- yarn install
build:
commands:
- yarn build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/* du -s .next/standalone/ 159720 .next/standalone/ Standalone folder approximately 80 mbs As you see in the screenshot. On Amplify build phase it still gives error for exceeding the build output size. |
@sawakaga have you managed to find a solution? Seeing the same on Amplify today. Running |
same problem here |
@rafaelvicio if you use |
@kachkaev Thank you.
This worked for me by placing these commands into an
|
Problem still occurs unfortunately. Currently we dont host application on amplify |
Just wanted to update you all that I successfully migrated our company's Next.js 11 project to Next.js 13. However, I encountered an issue with the bundle size, which was over 900MB. I reached out to AWS support, and after some discussions and various attempts to fix it, we concluded that we need to wait for the issue to be resolved as they are currently working on it. In case you're interested, here's the documentation I found regarding a potential solution using the command placement in the amplify.yml file after the build step: Amplify Troubleshooting SSR Deployment |
facing same issue |
Hey everyone 👋 We just released some changes to improve how we bundle Next.js apps. These changes don't need the standalone directory anymore. That should help eliminate the problem of reaching the 200MB bundle limit. These changes require a new deploy in your application to take effect. The expected outcome is that your app bundles should be smaller, and not bump into the size limit. If you have comments or questions don't hesitate to reach us via AWS support. |
|
This issue has been automatically locked. |
Before opening, please confirm:
App Id
d3lq4oet4t4ooj
AWS Region
eu-west-1
Amplify Hosting feature
Frontend builds
Describe the bug
Standalone directory not found, please enable output standalone on your next.config.js file or set NEXT_PRIVATE_STANDALONE=true.
Output is standalone in next.config.js AND set to true as an ENV variable.
It appears that the build is finishing early for some reason.
On a single build, it could find the standalone output, but deemed the output to be too large.
Expected behavior
Build runs sucessfully.
Reproduction steps
Run build, await standalone directory not to be found.
Build Settings
Log output
Additional information
No response
The text was updated successfully, but these errors were encountered: