aws-amplify / aws-amplify/amplify-hosting

NextJS build failing for fully static web app

Open
#3,250 4 comments 0 reactions 0 assignees View on GitHub
compute investigating question
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-hosting/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

### App Id

d32nq10lsibjno

### AWS Region

ap-northeast-1

### Amplify Hosting feature

Frontend builds

### Describe the bug

Frontend build throwing error about unsupported SSR features when the app doesn't even use SSR (getStaticProps or anything). Build and deployment is fine on Vercel and local.

### Expected behavior

Should build and deploy without any errors

### Reproduction steps

Click on redploy this version

### Build Settings

_No response_

### Log output

```
2023-01-19T06:39:06.786Z [INFO]: Cloning into 'celebratious-client'...
2023-01-19T06:39:06.786Z [INFO]: # Checking for Git submodules at: /codebuild/output/src348503938/src/celebratious-client/.gitmodules
2023-01-19T06:39:06.794Z [INFO]: # Retrieving environment cache...
2023-01-19T06:39:06.838Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}
2023-01-19T06:39:06.838Z [INFO]: ---- Setting Up SSM Secrets ----
2023-01-19T06:39:06.838Z [INFO]: SSM params {"Path":"/amplify/d32nq10lsibjno/main/","WithDecryption":true}
2023-01-19T06:39:06.889Z [WARNING]: !Failed to set up process.env.secrets
2023-01-19T06:39:06.889Z [INFO]: # Defaulting to Node version 16
2023-01-19T06:39:21.580Z [INFO]: # Node version 16 is available for installation
2023-01-19T06:39:21.670Z [INFO]: # Installing Node version 16
2023-01-19T06:39:30.314Z [INFO]: # Now using Node version 16
2023-01-19T06:39:30.430Z [INFO]: No live updates for this build run
2023-01-19T06:39:30.432Z [INFO]: Setting NEXT_PRIVATE_STANDALONE=true to produce .next/standalone directory
2023-01-19T06:39:30.433Z [INFO]: # Retrieving cache...
2023-01-19T06:39:30.482Z [INFO]: # Retrieved cache
2023-01-19T06:40:30.134Z [INFO]: ## Starting Backend Build
## Checking for associated backend environment...
## No backend environment association found, continuing...
## Completed Backend Build
2023-01-19T06:40:30.137Z [INFO]: ## Starting Frontend Build
2023-01-19T06:40:30.137Z [INFO]: # Starting phase: preBuild
# Executing command: yarn install
2023-01-19T06:40:30.427Z [INFO]: yarn install v1.22.0
2023-01-19T06:40:30.478Z [WARNING]: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
2023-01-19T06:40:30.481Z [INFO]: [1/4] Resolving packages...
2023-01-19T06:40:30.611Z [INFO]: [2/4] Fetching packages...
2023-01-19T06:40:51.289Z [INFO]: info @next/swc-android-arm-eabi@13.1.2: The platform "linux" is incompatible with this module.
2023-01-19T06:40:51.290Z [INFO]: info "@next/swc-android-arm-eabi@13.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-android-arm-eabi@13.1.2: The CPU architecture "x64" is incompatible with this module.
info @next/swc-android-arm64@13.1.2: The platform "linux" is incompatible with this module.
info "@next/swc-android-arm64@13.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-android-arm64@13.1.2: The CPU architecture "x64" is incompatible with this module.
info @next/swc-darwin-arm64@13.1.2: The platform "linux" is incompatible with this module.
info "@next/swc-darwin-arm64@13.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-darwin-arm64@13.1.2: The CPU architecture "x64" is incompatible with this module.
info @next/swc-darwin-x64@13.1.2: The platform "linux" is incompatible with this module.
info "@next/swc-darwin-x64@13.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-freebsd-x64@13.1.2: The platform "linux" is incompatible with this module.
info "@next/swc-freebsd-x64@13.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-linux-arm-gnueabihf@13.1.2: The CPU architecture "x64" is incompatible with this module.
info "@next/swc-linux-arm-gnueabihf@13.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-linux-arm64-gnu@13.1.2: The CPU architecture "x64" is incompatible with this module.
info "@next/swc-linux-arm64-gnu@13.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-linux-arm64-musl@13.1.2: The CPU architecture "x64" is incompatible with this module.
info "@next/swc-linux-arm64-musl@13.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-win32-arm64-msvc@13.1.2: The platform "linux" is incompatible with this module.
info "@next/swc-win32-arm64-msvc@13.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-win32-arm64-msvc@13.1.2: The CPU architecture "x64" is incompatible with this module.
info @next/swc-win32-ia32-msvc@13.1.2: The platform "linux" is incompatible with this module.
info "@next/swc-win32-ia32-msvc@13.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-win32-ia32-msvc@13.1.2: The CPU architecture "x64" is incompatible with this module.
info @next/swc-win32-x64-msvc@13.1.2: The platform "linux" is incompatible with this module.
info "@next/swc-win32-x64-msvc@13.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
2023-01-19T06:40:51.290Z [INFO]: [3/4] Linking dependencies...
2023-01-19T06:40:51.291Z [WARNING]: warning " > @chakra-ui/icons@2.0.16" has unmet peer dependency "@chakra-ui/system@>=2.0.0".
2023-01-19T06:40:51.291Z [WARNING]: warning "@chakra-ui/icons > @chakra-ui/icon@3.0.15" has unmet peer dependency "@chakra-ui/system@>=2.0.0".
2023-01-19T06:40:51.297Z [WARNING]: warning "@emotion/react > @emotion/babel-plugin@11.10.5" has unmet peer dependency "@babel/core@^7.0.0".
warning "@emotion/react > @emotion/babel-plugin > @babel/plugin-syntax-jsx@7.18.6" has unmet peer dependency "@babel/core@^7.0.0-0".
2023-01-19T06:40:53.711Z [INFO]: [4/4] Building fresh packages...
2023-01-19T06:40:53.725Z [INFO]: Done in 23.30s.
2023-01-19T06:40:53.753Z [INFO]: # Completed phase: preBuild
# Starting phase: build
2023-01-19T06:40:53.753Z [INFO]: # Executing command: yarn run build
2023-01-19T06:40:53.872Z [INFO]: yarn run v1.22.0
2023-01-19T06:40:53.896Z [INFO]: $ next build
2023-01-19T06:40:54.253Z [INFO]: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
2023-01-19T06:40:54.265Z [INFO]: Attention: Next.js now collects completely anonymous telemetry regarding usage.
2023-01-19T06:40:54.265Z [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-01-19T06:40:54.353Z [INFO]: info - Linting and checking validity of types...
2023-01-19T06:40:54.461Z [WARNING]: It looks like you're trying to use TypeScript but do not have the required package(s) installed.
Please install typescript and @types/node by running:
yarn add --dev typescript @types/node
If you are not trying to use TypeScript, please remove the tsconfig.json file from your package root (and any TypeScript files in your pages directory).
2023-01-19T06:40:54.490Z [WARNING]: error Command failed with exit code 1.
2023-01-19T06:40:54.490Z [INFO]: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2023-01-19T06:40:54.498Z [ERROR]: !!! Build failed
2023-01-19T06:40:54.498Z [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-01-19T06:40:54.498Z [ERROR]: !!! Non-Zero Exit Code detected
2023-01-19T06:40:54.498Z [INFO]: # Starting environment caching...
2023-01-19T06:40:54.499Z [INFO]: # Environment caching completed
Terminating logging...
```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

No repository files or tests are named. Start by reproducing the logged `yarn run build` failure for the static Next.js app, then review the linked supported and unsupported SSR features and troubleshooting documentation. Done means the reported static app builds and deploys successfully through Amplify Hosting.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, typescript
Domain
build-system, ci-cd, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.