"amplify publish" fails to deploy without any detailed error stack trace

4k views Asked by At

We are using AWS amplify to develop our next.js application for the first time and trying manual deployment process. We are getting following error when we try to run "amplify publish". This error is frustrating because there is no stack trace to figure out what is causing the issue. I can see the artifacts were successfully loaded to S3 bucket. But deployment fails.

Error:

Export successful
✔ Zipping artifacts completed.
✖ Deployment failed! Please report an issue on the Amplify Console GitHub issue tracker at https://github.com/aws-amplify/amplify-console/issues.
An error occurred during the publish operation

I tried to manually upload the zipped file using the "drag and drop". It feels like its stuck with the message Your build is being queued.... for hours now.

Any help is highly appreciated. This is a huge blocker for us.

4

There are 4 answers

0
Omar Magdy On

https://docs.amplify.aws/guides/hosting/nextjs/q/platform/js/

1) SSG Only:

Inside package.json

"scripts": {
  "build": "next build && next export",
  ...
}

Run this command.

amplify configure project

Then, keep every thing the way it is, except this:

Distribution Directory Path: out

2) SSG & SSR:

Inside package.json

"scripts": {
  "build": "next build",
  ...
}

Run this command.

amplify configure project

Then, keep every thing the way it is, except this:

Distribution Directory Path: .next

Note:

Do not forget to change the Image in index.js, because currently AWS does not support next/image.
https://docs.amplify.aws/guides/hosting/nextjs/q/platform/js/#deploy-and-host-an-ssg-only-app

0
June2017 On

We resolved the above issue. The issue was with the IAM policies. Once we fixed the role policies we were able to publish and see the progress of the deployment.

0
Manmay Barot On

Try to put static content on S3 manually. For example, if you have generated static contents in the dist/ directory using nuxt generate, run the following command:

aws s3 sync dist/ s3://{YOUR_BUCKET_NAME}

If this solves your problem then try to use CodeCommit for your amplify project until this gets fixed.

GitHub issue: https://github.com/aws-amplify/amplify-console/issues/1369

0
Sachintha Heshan On

I fixed this issue.

first run this command

amplify configure project

after set 'out' to Distribution Directory Path like this.

Distribution Directory Path: out

configurations.png