aws-amplify / aws-amplify/amplify-hosting

Nextjs Frontend build fails, Starting SSR Build Error command killed with Sigkill

Open
#2,362 9 comments 0 reactions 0 assignees View on GitHub
frontend-builds question ssr
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-console/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-console/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-console/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

### App Id

d1n0jvx24rxomq

### Region

us-east-1

### Amplify Console feature

Build settings, Logging

### Describe the bug

Build fails continuously at this stage with the following logs. I can build and deploy on both a local environment and vercel. This only seems to be happening with amplify.

Edited repository name in logs.

2021-11-03T13:37:31.214Z [INFO]: Starting SSR Build...
2021-11-03T13:40:14.853Z [ERROR]: error:
Error: Command was killed with SIGKILL (Forced termination): node_modules/.bin/next build
Warning: Built-in CSS support is being disabled due to custom CSS configuration being detected.
See here for more info: https://nextjs.org/docs/messages/built-in-css-disabled
info - Loaded env from /codebuild/output/src292403481/src/repository/.env
info - Using webpack 4. Reason: webpack5 flag is set to false in next.config.js https://nextjs.org/docs/messages/webpack5
info - Checking validity of types...
info - Creating an optimized production build...
info - Using external babel configuration from /codebuild/output/src292403481/src/repository/.babelrc
at makeError (/root/.//node_modules/execa/lib/error.js:60:11)
at handlePromise (/root/.//node_modules/execa/index.js:118:26)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Builder.build (/root/.//node_modules/@sls-next/lambda-at-edge/dist/build.js:376:13) {
shortMessage: 'Command was killed with SIGKILL (Forced termination): node_modules/.bin/next build',
command: 'node_modules/.bin/next build',
escapedCommand: '"node_modules/.bin/next" build',
exitCode: undefined,
signal: 'SIGKILL',
signalDescription: 'Forced termination',
stdout: 'info - Loaded env from /codebuild/output/src292403481/src/repository/.env\n' +
'info - Using webpack 4. Reason: webpack5 flag is set to false in next.config.js https://nextjs.org/docs/messages/webpack5\n' +
'info - Checking validity of types...\n' +
'info - Creating an optimized production build...\n' +
'info - Using external babel configuration from /codebuild/output/src292403481/src/repository/.babelrc',
stderr: 'Warning: Built-in CSS support is being disabled due to custom CSS configuration being detected.\n' +
'See here for more info: https://nextjs.org/docs/messages/built-in-css-disabled\n',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
[?25h
133s › d1n0jvx24rxomq › Error: Command was killed with SIGKILL (Forced termination): node_modules/.bin/next build
Warning: Built-in CSS support is being disabled due to custom CSS configuration being detected.
See here for more info: https://nextjs.org/docs/messages/built-in-css-disabled
info - Loaded env from /codebuild/output/src292403481/src/repository/.env
info - Using webpack 4. Reason: webpack5 flag is set to false in next.config.js https://nextjs.org/docs/messages/webpack5
info - Checking validity of types...
info - Creating an optimized production build...
info - Using external babel configuration from /codebuild/output/src292403481/src/repository/.babelrc
[?25h
Terminating logging...

### Expected behavior

Build to succeed, I have tried debugging any webpack or babel errors, but without success. Also cannot reproduce in the local environment or deploying with vercel.

### Reproduction steps

1.New project from Github repository
2.Default image
3.amplify.yml as below
4.Redeploy this version

### Build Settings

```yaml
version: 1
frontend:
phases:
preBuild:
commands:
- rm -rf node_modules/
- nvm install 16
- yarn install
- export NODE_OPTIONS="--max-old-space-size=8120"
build:
commands:
- yarn run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
- .next/cache/**/*
```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the reported amplify.yml, the Next.js build command, next.config.js, and .babelrc, then reproduce the default-image deployment in Amplify using the listed app and region. Compare the Amplify logs with the successful local and Vercel builds, focusing on the SIGKILL during `next build`; done means the SSR build completes and deploys successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, node.js, webpack
Domain
build-system, ci-cd, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.