Closed dgastudio closed 1 year ago
Hello, @dgastudio 👋 and thanks for opening this issue. Can you share what version of Amplify you're currently using (didn't see it in your package.json
above) along with possibly sharing what's in your next.cofig
? Also, could you try deleting your node_modules
folder along with your package-lock.json (or yarn.lock) file and try reinstalling your dependencies with either npm install
or yarn install
?
Hello @cwomack thank you for your response, but, i was wrong. the issue is related with deployment to amplify, not with amplify-js itself i have already fixed the issue, amplify does not support app dir in nextjs 13
thank you!
@dgastudio, appreciate the quick replies and confirmation. While there's still some polishing going on to fully support the new app directory feature with Next.js, there's some helpful documentation for it here. If you have further issues or questions, feel free to reply back or open a new issue as needed.
Hello!
I'm also getting the same error message in the AWS Amplify Console. The app builds fine locally.
2023-06-20T18:57:17.616Z [INFO]: # Completed phase: preBuild
# Starting phase: build
# Executing command: yarn run build
2023-06-20T18:57:17.739Z [INFO]: yarn run v1.22.0
2023-06-20T18:57:17.764Z [INFO]: $ next build
2023-06-20T18:57:18.257Z [INFO]: - warn No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
2023-06-20T18:57:18.269Z [INFO]: Attention: Next.js now collects completely anonymous telemetry regarding usage.
2023-06-20T18:57:18.270Z [INFO]: This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
2023-06-20T18:57:18.355Z [INFO]: - info Creating an optimized production build...
2023-06-20T18:57:37.258Z [WARNING]: (node:1645) [DEP_WEBPACK_MODULE_UPDATE_HASH] DeprecationWarning: Module.updateHash: Use new ChunkGraph API
(Use `node --trace-deprecation ...` to show where the warning was created)
2023-06-20T18:57:40.508Z [INFO]: - info Compiled successfully
2023-06-20T18:57:40.533Z [INFO]: - info Linting and checking validity of types...
2023-06-20T18:57:44.194Z [INFO]: - info Collecting page data...
2023-06-20T18:57:59.130Z [INFO]: - info Generating static pages (0/6)
2023-06-20T18:57:59.197Z [INFO]: - info Generating static pages (1/6)
2023-06-20T18:57:59.219Z [INFO]: - info Generating static pages (2/6)
2023-06-20T18:57:59.235Z [INFO]: - info Generating static pages (4/6)
2023-06-20T18:57:59.251Z [INFO]: - info Generating static pages (6/6)
2023-06-20T18:57:59.591Z [INFO]: - info Finalizing page optimization...
2023-06-20T18:57:59.601Z [INFO]:
2023-06-20T18:57:59.613Z [WARNING]:
2023-06-20T18:57:59.613Z [WARNING]: > Build error occurred
2023-06-20T18:57:59.617Z [WARNING]: [Error: ENOENT: no such file or directory, lstat '/codebuild/output/src033679038/src/clarityfrontend/.next/server/app'] {
errno: -2,
code: 'ENOENT',
syscall: 'lstat',
path: '/codebuild/output/src033679038/src/clarityfrontend/.next/server/app'
}
2023-06-20T18:57:59.652Z [WARNING]: error Command failed with exit code 1.
2023-06-20T18:57:59.652Z [INFO]: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2023-06-20T18:57:59.657Z [ERROR]: !!! Build failed
2023-06-20T18:57:59.657Z [INFO]: Please check the supported SSR features to find if your build failure is related to an unsupported feature: https://docs.aws.amazon.com/amplify/latest/userguide/ssr-Amplify-support.html#supported-unsupported-features. You may also find this troubleshooting guide useful: https://docs.aws.amazon.com/amplify/latest/userguide/troubleshooting-ssr-deployment.html
2023-06-20T18:57:59.657Z [ERROR]: !!! Non-Zero Exit Code detected
2023-06-20T18:57:59.657Z [INFO]: # Starting environment caching...
2023-06-20T18:57:59.658Z [INFO]: # Uploading environment cache artifact...
2023-06-20T18:57:59.736Z [INFO]: # Uploaded environment cache artifact
2023-06-20T18:57:59.736Z [INFO]: # Environment caching completed
I reviewed the docs provided in the previous comment and I had them applied to my app already. Is there a specific setting I should be modifying to resolve this issue? Is there a version that is not conflicting that we can use?
Thanks!
Hi @dannyk08 since it sounds like the issue is happening while deploying on Hosting. Due to this, I recommend either opening an issue with the Hosting repo, or finding a similar issue already open.
Thanks!
Hey @nadetastic
Thank you for getting back to me
I was able to figure out the issue and it was on me for not paying attention to the fact that the app
folder is a special folder when using nextjs. The failed build would only happen on the cloud and I had no means of debugging but to try to revert a lot of changes.
Thanks for checking in!
i found out that i can't have a folder named app
inside of the src
directory, just renamed and the cloud build was completed
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Not applicable
Amplify Categories
Not applicable
Environment information
Describe the bug
Build error occurred 2023-05-24T20:46:34.263Z [WARNING]: [Error: ENOENT: no such file or directory, lstat '/codebuild/output/src554686390/src/hkv_3_nextjs/.next/server/app'] { errno: -2, code: 'ENOENT', syscall: 'lstat', path: '/codebuild/output/src554686390/src/hkv_3_nextjs/.next/server/app' }
Expected behavior
build should be completed
Reproduction steps
amplify connected to gitlab repo, auto deploy
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response