SSR build step failed on Next.js app
Before opening, please confirm:
- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have searched for duplicate or closed issues.
- [X] I have read the guide for submitting bug reports.
- [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.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v16.13.1
Amplify CLI Version
9.1.0
What operating system are you using?
Mac Monterey
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No changes made
Amplify Categories
hosting
Amplify Commands
push
Describe the bug
I'm using eu-west-1 region.
I followed the guide to deploy a Next.js app with SSG: https://docs.aws.amazon.com/amplify/latest/userguide/server-side-rendering-amplify.html
I have my github repo configured here with correct env variables:
https://github.com/theodesp/amplify-nextjs-example
The build fails with the following log trail:
# Starting phase: build
2022-07-29T10:35:00.780Z [INFO]: [0mAmplify AppID found: d3iucrpm5ses1r. Amplify App name is: amplifyfaustexample[0m
2022-07-29T10:35:00.821Z [INFO]: [0mBackend environment dev found in Amplify Console app: amplifyfaustexample[0m
2022-07-29T10:35:01.393Z [WARNING]: - Fetching updates to backend environment: dev from the cloud.
2022-07-29T10:35:01.966Z [INFO]: Overrides functionality is not implemented for this category
2022-07-29T10:35:02.004Z [WARNING]: ✔ Successfully pulled backend environment dev from the cloud.
2022-07-29T10:35:02.010Z [INFO]: ✅
2022-07-29T10:35:03.422Z [INFO]: [33mNote: It is recommended to run this command from the root of your app directory[39m
2022-07-29T10:35:04.307Z [WARNING]: - Initializing your environment: dev
2022-07-29T10:35:04.783Z [INFO]: Overrides functionality is not implemented for this category
2022-07-29T10:35:04.783Z [WARNING]: ✔ Initialized provider successfully.
2022-07-29T10:35:04.843Z [INFO]: Overrides functionality is not implemented for this category
2022-07-29T10:35:04.928Z [WARNING]: - Updating resources in the cloud. This may take a few minutes...
2022-07-29T10:35:10.926Z [INFO]:
2022-07-29T10:35:10.928Z [INFO]: UPDATE_IN_PROGRESS amplify-amplifyfaustexample-dev-113037 AWS::CloudFormation::Stack Fri Jul 29 2022 10:35:05 GMT+0000 (Coordinated Universal Time) User Initiated
CREATE_IN_PROGRESS hostingamplifyhosting AWS::CloudFormation::Stack Fri Jul 29 2022 10:35:09 GMT+0000 (Coordinated Universal Time)
2022-07-29T10:35:15.941Z [INFO]:
2022-07-29T10:35:15.944Z [INFO]: CREATE_IN_PROGRESS hostingamplifyhosting AWS::CloudFormation::Stack Fri Jul 29 2022 10:35:11 GMT+0000 (Coordinated Universal Time) Resource creation Initiated
2022-07-29T10:35:16.024Z [INFO]:
2022-07-29T10:35:16.026Z [INFO]: CREATE_IN_PROGRESS amplify-amplifyfaustexample-dev-113037-hostingamplifyhosting-1PEESCFT3F8WQ AWS::CloudFormation::Stack Fri Jul 29 2022 10:35:10 GMT+0000 (Coordinated Universal Time) User Initiated
CREATE_IN_PROGRESS AmplifyBranch AWS::Amplify::Branch Fri Jul 29 2022 10:35:14 GMT+0000 (Coordinated Universal Time)
CREATE_FAILED AmplifyBranch AWS::Amplify::Branch Fri Jul 29 2022 10:35:15 GMT+0000 (Coordinated Universal Time) Resource handler returned message: "Resource of type 'AWS::Amplify::Branch' with identifier 'null' was not found." (RequestToken: 4f3610de-e36f-074e-197b-4510e27a3c3c, HandlerErrorCode: NotFound)
2022-07-29T10:35:21.025Z [INFO]:
2022-07-29T10:35:21.028Z [INFO]: CREATE_FAILED amplify-amplifyfaustexample-dev-113037-hostingamplifyhosting-1PEESCFT3F8WQ AWS::CloudFormation::Stack Fri Jul 29 2022 10:35:16 GMT+0000 (Coordinated Universal Time) The following resource(s) failed to create: [AmplifyBranch].
2022-07-29T10:35:25.931Z [INFO]:
2022-07-29T10:35:25.932Z [INFO]: CREATE_FAILED hostingamplifyhosting AWS::CloudFormation::Stack Fri Jul 29 2022 10:35:21 GMT+0000 (Coordinated Universal Time) Embedded stack arn:aws:cloudformation:eu-west-1:737181868008:stack/amplify-amplifyfaustexample-dev-113037-hostingamplifyhosting-1PEESCFT3F8WQ/1f384d60-0f2a-11ed-99d6-02362f85bc0b was not successfully created: The following resource(s) failed to create: [AmplifyBranch].
UPDATE_ROLLBACK_IN_PROGRESS amplify-amplifyfaustexample-dev-113037 AWS::CloudFormation::Stack Fri Jul 29 2022 10:35:22 GMT+0000 (Coordinated Universal Time) The following resource(s) failed to create: [hostingamplifyhosting].
2022-07-29T10:35:31.043Z [INFO]:
2022-07-29T10:35:31.044Z [INFO]: UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS amplify-amplifyfaustexample-dev-113037 AWS::CloudFormation::Stack Fri Jul 29 2022 10:35:30 GMT+0000 (Coordinated Universal Time)
2022-07-29T10:35:35.951Z [INFO]:
2022-07-29T10:35:35.952Z [INFO]: DELETE_IN_PROGRESS hostingamplifyhosting AWS::CloudFormation::Stack Fri Jul 29 2022 10:35:32 GMT+0000 (Coordinated Universal Time)
2022-07-29T10:35:36.025Z [INFO]:
2022-07-29T10:35:36.026Z [INFO]: DELETE_IN_PROGRESS amplify-amplifyfaustexample-dev-113037-hostingamplifyhosting-1PEESCFT3F8WQ AWS::CloudFormation::Stack Fri Jul 29 2022 10:35:32 GMT+0000 (Coordinated Universal Time) User Initiated
2022-07-29T10:38:01.112Z [INFO]:
2022-07-29T10:38:01.113Z [INFO]: DELETE_COMPLETE AmplifyBranch AWS::Amplify::Branch Fri Jul 29 2022 10:37:57 GMT+0000 (Coordinated Universal Time)
DELETE_COMPLETE amplify-amplifyfaustexample-dev-113037-hostingamplifyhosting-1PEESCFT3F8WQ AWS::CloudFormation::Stack Fri Jul 29 2022 10:37:58 GMT+0000 (Coordinated Universal Time)
2022-07-29T10:38:11.038Z [INFO]:
2022-07-29T10:38:11.040Z [INFO]: DELETE_COMPLETE hostingamplifyhosting AWS::CloudFormation::Stack Fri Jul 29 2022 10:38:10 GMT+0000 (Coordinated Universal Time)
UPDATE_ROLLBACK_COMPLETE amplify-amplifyfaustexample-dev-113037 AWS::CloudFormation::Stack Fri Jul 29 2022 10:38:10 GMT+0000 (Coordinated Universal Time)
2022-07-29T10:38:41.251Z [INFO]: Following resources failed
Resource Name: AmplifyBranch (AWS::Amplify::Branch)
Event Type: create
Reason: Resource handler returned message: "Resource of type 'AWS::Amplify::Branch' with identifier 'null' was not found." (RequestToken: 4f3610de-e36f-074e-197b-4510e27a3c3c, HandlerErrorCode: NotFound)
2022-07-29T10:38:41.253Z [WARNING]: ✖ An error occurred when pushing the resources to the cloud
✖ There was an error initializing your environment.
2022-07-29T10:38:41.256Z [INFO]: [0mResourceNotReady: Resource is not in the state stackUpdateComplete[0m
[0m at constructor.setError (/snapshot/repo/build/node_modules/aws-sdk/lib/resource_waiter.js:182:47)[0m
[0m at Request.CHECK_ACCEPTORS (/snapshot/repo/build/node_modules/aws-sdk/lib/resource_waiter.js:44:12)[0m
[0m at Request.callListeners (/snapshot/repo/build/node_modules/aws-sdk/lib/sequential_executor.js:106:20)[0m
[0m at Request.emit (/snapshot/repo/build/node_modules/aws-sdk/lib/sequential_executor.js:78:10)[0m
[0m at Request.emit (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:686:14)[0m
[0m at Request.transition (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:22:10)[0m
[0m at AcceptorStateMachine.runTo (/snapshot/repo/build/node_modules/aws-sdk/lib/state_machine.js:14:12)[0m
[0m at /snapshot/repo/build/node_modules/aws-sdk/lib/state_machine.js:26:10[0m
[0m at Request.<anonymous> (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:38:9)[0m
[0m at Request.<anonymous> (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:688:12)[0m
[0m at Request.callListeners (/snapshot/repo/build/node_modules/aws-sdk/lib/sequential_executor.js:116:18)[0m
[0m at Request.emit (/snapshot/repo/build/node_modules/aws-sdk/lib/sequential_executor.js:78:10)[0m
[0m at Request.emit (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:686:14)[0m
[0m at Request.transition (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:22:10)[0m
[0m at AcceptorStateMachine.runTo (/snapshot/repo/build/node_modules/aws-sdk/lib/state_machine.js:14:12)[0m
[0m at /snapshot/repo/build/node_modules/aws-sdk/lib/state_machine.js:26:10[0m
[0m at Request.<anonymous> (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:38:9)[0m
[0m at Request.<anonymous> (/snapshot/repo/build/node_modules/aws-sdk/lib/request.js:688:12)[0m
[0m at Request.callListeners (/snapshot/repo/build/node_modules/aws-sdk/lib/sequential_executor.js:116:18)[0m
[0m at callNextListener (/snapshot/repo/build/node_modules/aws-sdk/lib/sequential_executor.js:96:12)[0m
[0m at IncomingMessage.onEnd (/snapshot/repo/build/node_modules/aws-sdk/lib/event_listeners.js:335:13)[0m
[0m at IncomingMessage.emit (events.js:412:35)[0m
[0m at IncomingMessage.emit (domain.js:475:12)[0m
[0m at endReadableNT (internal/streams/readable.js:1334:12)[0m
[0m at processTicksAndRejections (internal/process/task_queues.js:82:21) {[0m
[0m code: 'ResourceNotReady',[0m
[0m retryable: false,[0m
[0m time: 2022-07-29T10:38:36.248Z,[0m
[0m statusCode: 200,[0m
[0m retryDelay: 30000[0m
[0m}[0m
2022-07-29T10:38:41.289Z [ERROR]: !!! Build failed
2022-07-29T10:38:41.289Z [ERROR]: !!! Non-Zero Exit Code detected
2022-07-29T10:38:41.289Z [INFO]: # Starting environment caching...
2022-07-29T10:38:41.290Z [INFO]: # Environment caching completed
Terminating logging...
Expected behavior
Build step completes without issues
Reproduction steps
You can fork my repo: https://github.com/theodesp/amplify-nextjs-example
Follow the steps to deploy a Next.js app using this guide https://docs.aws.amazon.com/amplify/latest/userguide/server-side-rendering-amplify.html
1 amplify configure 2 amplify init 3 amplify push 4 Navigate to the Build tab in AWS Amplify dashboard 5 Add the following env variables
GraphQL schema(s)
# Put schemas below this line
Project Identifier
e1ec8ec2f8860f3e8e89ea122b9ae367
Log output
# Put your logs below this line
Additional information
No response