aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
461 stars 116 forks source link

Next.js fails to build the front end since yesterday, I just tried with a brand new setup using v11 and it has the same problem #2610

Closed bojidaryovchev closed 2 years ago

bojidaryovchev commented 2 years ago

Before opening, please confirm:

JavaScript Framework

Next.js

Amplify APIs

Not applicable

Amplify Categories

Not applicable

Environment information

System: OS: Windows 10 10.0.19043 CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz Memory: 5.59 GB / 15.89 GB Binaries: Node: 16.13.2 - C:\Program Files\nodejs\node.EXE npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 98.0.4758.102 Edge: Spartan (44.19041.1266.0), Chromium (98.0.1108.62) Internet Explorer: 11.0.19041.1202 npmGlobalPackages: @angular/cli: 12.2.8 @aws-amplify/cli: 6.3.1 @expo/ngrok: 2.5.0 @nestjs/cli: 8.1.4 @react-native-community/cli: 5.0.1 aws-cdk: 1.132.0 cordova: 8.1.2 create-react-app: 3.4.1 expo-cli: 4.8.1 graphqlviz: 3.0.0 gulp-cli: 2.3.0 ionic: 4.10.3 node-gyp: 3.8.0 npx: 10.2.2 nx: 10.1.0 prisma: 3.3.0 puppeteer-lottie-cli: 1.0.2 react-native-cli: 2.0.1 rimraf: 3.0.2 serverless: 2.64.1 vercel: 23.0.1 windows-build-tools: 5.2.2 wt-cli: 11.0.2

Describe the bug

So around 2 days ago I initialized AWS Amplify in my Next.js application following the Amplify Docs and it worked fine, however since yesterday (mid-day or evening) the front end fails to build, the error I am getting is ERR! @next/swc-darwin-arm64 not accessible from next

I am using v11 as I know v12 is not supported, but yday I was even able to use v12 without the API routes working, but it still got deployed and everything.. And now I tried a brand new application from scratch because I was afraid I've messed up some dependencies and that's the reason it's not working however that turned out not to be the case.

Apparently it's something that's been changed just yesterday and now it's simply broken - we can no longer deploy a Next.js application with Amplify.

Expected behavior

It should work

Reproduction steps

  1. npx create-next-app@latest --ts
  2. npm i -S -E next@11
  3. npm i -D -E eslint-config-next@11
  4. create a github repo, clone it, commit and push the changes
  5. npx amplify init
  6. follow the docs for Next.js SSG apps (Distribution Directory Path: .next)
  7. go to AWS Console > AWS Amplify > the app we just initialized
  8. connect github CI/CD
  9. the is no longer able to build, it throws the aforementioned error

Code Snippet

No response

Log output

No response

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


2022-02-27T10:36:06.124Z [INFO]: # Cloning repository: git@github.com:bojidaryovchev/nextjs-app.git
2022-02-27T10:36:06.413Z [INFO]: Agent pid 135
2022-02-27T10:36:06.451Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2022-02-27T10:36:06.746Z [INFO]: Cloning into 'nextjs-app'...
2022-02-27T10:36:07.146Z [INFO]: Warning: Permanently added the ECDSA host key for IP address '140.82.114.3' to the list of known hosts.
2022-02-27T10:36:07.478Z [INFO]: # Checking for Git submodules at: /codebuild/output/src918549573/src/nextjs-app/.gitmodules
2022-02-27T10:36:07.498Z [INFO]: # Retrieving environment cache...
2022-02-27T10:36:07.518Z [INFO]: # Retrieved environment cache
2022-02-27T10:36:07.519Z [INFO]: ---- Setting Up SSM Secrets ----
2022-02-27T10:36:07.519Z [INFO]: SSM params {"Path":"/amplify/do0afs3m3s4su/dev/","WithDecryption":true}
2022-02-27T10:36:13.912Z [INFO]: # Patching NPM package '@aws-amplify/cli' from 6.3.1 to 7.6.22...
2022-02-27T10:37:06.954Z [INFO]: npm
2022-02-27T10:37:06.957Z [INFO]: WARN deprecated @graphql-toolkit/common@0.9.7: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes.
2022-02-27T10:37:07.041Z [INFO]: npm WARN
2022-02-27T10:37:07.041Z [INFO]: deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
2022-02-27T10:37:14.886Z [INFO]: npm WARN
2022-02-27T10:37:14.888Z [INFO]: deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
2022-02-27T10:37:14.889Z [INFO]: npm
2022-02-27T10:37:14.889Z [INFO]: WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
2022-02-27T10:37:15.400Z [INFO]: npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
2022-02-27T10:37:18.572Z [INFO]: npm WARN
2022-02-27T10:37:18.573Z [INFO]: deprecated @graphql-toolkit/common@0.6.6: GraphQL Toolkit is deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-toolkit for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes.
2022-02-27T10:37:22.289Z [INFO]: npm WARN deprecated graphql-import@0.7.1: GraphQL Import has been deprecated and merged into GraphQL Tools, so it will no longer get updates. Use GraphQL Tools instead to stay up-to-date! Check out https://www.graphql-tools.com/docs/migration-from-import for migration and https://the-guild.dev/blog/graphql-tools-v6 for new changes.
2022-02-27T10:37:22.354Z [INFO]: npm WARN
2022-02-27T10:37:22.355Z [INFO]: deprecated uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
2022-02-27T10:37:22.451Z [INFO]: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
2022-02-27T10:39:29.257Z [INFO]: npm
2022-02-27T10:39:29.262Z [INFO]: 
2022-02-27T10:39:29.263Z [INFO]: WARN
2022-02-27T10:39:29.263Z [INFO]: 
2022-02-27T10:39:29.263Z [INFO]: optional
2022-02-27T10:39:29.263Z [INFO]: SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/@aws-amplify/cli/node_modules/chokidar/node_modules/fsevents):
2022-02-27T10:39:29.271Z [INFO]: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2022-02-27T10:39:29.290Z [INFO]: npm
2022-02-27T10:39:29.290Z [INFO]: 
2022-02-27T10:39:29.291Z [INFO]: WARN
2022-02-27T10:39:29.291Z [INFO]: relay-compiler@12.0.0 requires a peer of graphql@^15.0.0 but none is installed. You must install peer dependencies yourself.
2022-02-27T10:39:29.314Z [INFO]: npm
2022-02-27T10:39:29.314Z [INFO]: 
2022-02-27T10:39:29.314Z [INFO]: WARN
2022-02-27T10:39:29.314Z [INFO]: @aws-amplify/codegen-ui-react@1.2.0 requires a peer of react@^17.0.2 but none is installed. You must install peer dependencies yourself.
2022-02-27T10:39:29.339Z [INFO]: npm
2022-02-27T10:39:29.339Z [INFO]: 
2022-02-27T10:39:29.339Z [INFO]: WARN
2022-02-27T10:39:29.340Z [INFO]: @aws-amplify/codegen-ui-react@1.2.0 requires a peer of react-dom@^17.0.2 but none is installed. You must install peer dependencies yourself.
2022-02-27T10:39:29.340Z [INFO]: 
2022-02-27T10:39:29.414Z [INFO]: # Done patching NPM package '@aws-amplify/cli' to version 7.6.22
2022-02-27T10:39:30.094Z [INFO]: # Retrieving cache...
2022-02-27T10:39:30.132Z [INFO]: # Extracting cache...
2022-02-27T10:39:30.145Z [INFO]: # Extraction completed
2022-02-27T10:39:38.682Z [INFO]: ## Starting Backend Build
                                 # Starting phase: build
2022-02-27T10:39:49.704Z [INFO]: Amplify AppID found: do0afs3m3s4su. Amplify App name is: nextjs-app
2022-02-27T10:39:49.756Z [INFO]: Backend environment dev found in Amplify Console app: nextjs-app
2022-02-27T10:39:50.913Z [WARNING]: - Fetching updates to backend environment: dev from the cloud.
2022-02-27T10:39:51.620Z [WARNING]: ✔ Successfully pulled backend environment dev from the cloud.
2022-02-27T10:39:51.626Z [INFO]: 
2022-02-27T10:39:56.865Z [INFO]: Note: It is recommended to run this command from the root of your app directory
2022-02-27T10:40:02.306Z [WARNING]: - Initializing your environment: dev
2022-02-27T10:40:03.490Z [WARNING]: ✔ Initialized provider successfully.
2022-02-27T10:40:03.546Z [WARNING]: - Updating resources in the cloud. This may take a few minutes...
2022-02-27T10:40:09.622Z [INFO]: 
2022-02-27T10:40:09.625Z [INFO]: UPDATE_IN_PROGRESS amplify-nextjs-app-dev-122640 AWS::CloudFormation::Stack Sun Feb 27 2022 10:40:04 GMT+0000 (Coordinated Universal Time) User Initiated
2022-02-27T10:40:14.613Z [INFO]: 
2022-02-27T10:40:14.615Z [INFO]: UPDATE_COMPLETE_CLEANUP_IN_PROGRESS amplify-nextjs-app-dev-122640 AWS::CloudFormation::Stack Sun Feb 27 2022 10:40:13 GMT+0000 (Coordinated Universal Time)
                                 UPDATE_COMPLETE                     amplify-nextjs-app-dev-122640 AWS::CloudFormation::Stack Sun Feb 27 2022 10:40:14 GMT+0000 (Coordinated Universal Time)
2022-02-27T10:40:35.009Z [WARNING]: - Uploading files...
2022-02-27T10:40:35.090Z [WARNING]: - Uploading files...
2022-02-27T10:40:35.147Z [WARNING]: - Uploading files...
2022-02-27T10:40:35.207Z [WARNING]: ✔ All resources are updated in the cloud
2022-02-27T10:40:35.207Z [INFO]: 
2022-02-27T10:40:35.208Z [INFO]: 
2022-02-27T10:40:35.852Z [INFO]: Initialized your environment successfully.
2022-02-27T10:40:35.852Z [INFO]: Your project has been successfully initialized and connected to the cloud!
                                 Some next steps:
                                 "amplify status" will show you what you've added already and if it's locally configured or deployed
                                 "amplify add <category>" will allow you to add features like user login or a backend API
                                 "amplify push" will build all your local backend resources and provision it in the cloud
                                 "amplify console" to open the Amplify Console and view your project status
                                 "amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud
                                 Pro tip:
                                 Try "amplify add api" to create a backend API and then "amplify push" to deploy everything
2022-02-27T10:40:40.930Z [INFO]: # Completed phase: build
                                 ## Completed Backend Build
2022-02-27T10:40:40.932Z [INFO]: ## Starting Frontend Build
                                 # Starting phase: preBuild
                                 # Executing command: npm ci
2022-02-27T10:40:41.296Z [WARNING]: npm
2022-02-27T10:40:41.296Z [WARNING]: ERR! @next/swc-darwin-arm64 not accessible from next
2022-02-27T10:40:41.300Z [WARNING]: 
2022-02-27T10:40:41.300Z [WARNING]: npm ERR! A complete log of this run can be found in:
                                    npm ERR!     /root/.npm/_logs/2022-02-27T10_40_41_296Z-debug.log
2022-02-27T10:40:41.300Z [HELP]: Outputting the npm debug log
                                 0 info it worked if it ends with ok
                                 1 verbose cli [
                                 1 verbose cli   '/root/.nvm/versions/node/v14.18.1/bin/node',
                                 1 verbose cli   '/root/.nvm/versions/node/v14.18.1/bin/npm',
                                 1 verbose cli   'ci'
                                 1 verbose cli ]
                                 2 info using npm@6.14.15
                                 3 info using node@v14.18.1
                                 4 verbose npm-session 0591ab3873deea3e
                                 5 info prepare initializing installer
                                 6 verbose prepare starting workers
                                 7 verbose prepare installation prefix: /codebuild/output/src918549573/src/nextjs-app
                                 8 verbose prepare using package-lock.json
                                 9 verbose checkLock verifying package-lock data
                                 10 verbose teardown shutting down workers.
                                 11 info teardown Done in 0.001s
                                 12 verbose stack Error: @next/swc-darwin-arm64 not accessible from next
                                 12 verbose stack     at reqAddr (/root/.nvm/versions/node/v14.18.1/lib/node_modules/npm/node_modules/npm-logical-tree/index.js:159:17)
                                 12 verbose stack     at /root/.nvm/versions/node/v14.18.1/lib/node_modules/npm/node_modules/npm-logical-tree/index.js:129:22
                                 12 verbose stack     at Array.forEach (<anonymous>)
                                 12 verbose stack     at addChild (/root/.nvm/versions/node/v14.18.1/lib/node_modules/npm/node_modules/npm-logical-tree/index.js:128:40)
                                 12 verbose stack     at /root/.nvm/versions/node/v14.18.1/lib/node_modules/npm/node_modules/npm-logical-tree/index.js:113:5
                                 12 verbose stack     at Array.forEach (<anonymous>)
                                 12 verbose stack     at lockTree (/root/.nvm/versions/node/v14.18.1/lib/node_modules/npm/node_modules/npm-logical-tree/index.js:107:5)
                                 12 verbose stack     at /root/.nvm/versions/node/v14.18.1/lib/node_modules/npm/node_modules/libcipm/index.js:144:21
                                 13 verbose cwd /codebuild/output/src918549573/src/nextjs-app
                                 14 verbose Linux 4.14.252-195.483.amzn2.x86_64
                                 15 verbose argv "/root/.nvm/versions/node/v14.18.1/bin/node" "/root/.nvm/versions/node/v14.18.1/bin/npm" "ci"
                                 16 verbose node v14.18.1
                                 17 verbose npm  v6.14.15
                                 18 error @next/swc-darwin-arm64 not accessible from next
                                 19 verbose exit [ 1, true ]
2022-02-27T10:40:41.304Z [ERROR]: !!! Build failed
2022-02-27T10:40:41.304Z [ERROR]: !!! Non-Zero Exit Code detected
2022-02-27T10:40:41.305Z [INFO]: # Starting environment caching...
2022-02-27T10:40:41.305Z [INFO]: # Environment caching completed
Terminating logging...```
chrisbonifacio commented 2 years ago

Hi @bojidaryovchev 👋 thanks for raising this issue. Because it has to do with hosting, I'm transferring this over to the console repo for better feedback and support.

github-actions[bot] commented 2 years ago

Hi :wave:, thanks for opening! While we look into this...

If this issue is related to custom domains, be sure to check the custom domains troubleshooting guide to see if that helps. Also, there is a more general troubleshooting FAQ that may be helpful for other questions.

Lastly, please make sure you've specified the App ID and Region in the issue!

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.