milliHQ / terraform-aws-next-js

Terraform module for building and deploying Next.js apps to AWS. Supports SSR (Lambda), Static (S3) and API (Lambda) pages.
https://registry.terraform.io/modules/milliHQ/next-js/aws
Apache License 2.0
1.47k stars 151 forks source link

Error: Authentication Failed Returns Status Code 0 #364

Open larahroth opened 2 years ago

larahroth commented 2 years ago

Hello,

We are deploying via a bash script calling npx tf-next deploy --endpoint ${OUR ENDPOINT HERE}. Should our credentials not be set, or any other reason, the return status code is 0. This is the same behavior upon success.

Creds Set:

./deploy.sh         
+ npx tf-next deploy --endpoint https://**.execute-api.us-east-1.amazonaws.com
milliVolt CLI 1.0.0-canary.5

success Deployment package uploaded
success Deployment ready
> Available at: *** (copied to clipboard) 
+ echo return code: 0
return code: 0

Creds Not Set:

./deploy.sh                   
+ npx tf-next deploy --endpoint https://**.execute-api.us-east-1.amazonaws.com
milliVolt CLI 1.0.0-canary.5

Error: Authentication failed.
Make sure that the AWS user has the correct permissions.
Could not upload deployment package.
+ echo return code: 0
return code: 0

This has caused a bit of upset with our CI/CD integration and took time to debug. Is there any way to return a different status code on Authentication Failed?

Thank you in advance :D