Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sst deploy exits 0 even when it fails to deploy due to missing AWS credentials #77

Closed
smoll opened this issue Feb 1, 2021 · 4 comments · Fixed by #398
Closed

sst deploy exits 0 even when it fails to deploy due to missing AWS credentials #77

smoll opened this issue Feb 1, 2021 · 4 comments · Fixed by #398
Assignees
Labels
bug Something isn't working

Comments

@smoll
Copy link

smoll commented Feb 1, 2021

$ sst deploy
Preparing your SST app
Transpiling source
Linting source
Deploying stacks
functionArn: arn:aws:lambda:us-east-1:${Token[AWS.AccountId.0]}:function:mysstapp-app-dev-notify.
dev-mysstapp-infra-dynamodb: deploying...

 ❌  dev-mysstapp-infra-dynamodb failed: Error: Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment
    at SdkProvider.resolveEnvironment (/Users/me/workspace/mysstapp/serverless-infra/node_modules/sst-cdk/lib/api/aws-auth/sdk-provider.ts:208:13)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at CloudFormationDeployments.prepareSdkFor (/Users/me/workspace/mysstapp/serverless-infra/node_modules/sst-cdk/lib/api/cloudformation-deployments.ts:236:33)
    at CloudFormationDeployments.deployStack (/Users/me/workspace/mysstapp/serverless-infra/node_modules/sst-cdk/lib/api/cloudformation-deployments.ts:162:70)
    at CdkToolkit.deploy (/Users/me/workspace/mysstapp/serverless-infra/node_modules/sst-cdk/lib/cdk-toolkit.ts:194:24)
    at Object.deployAsync (/Users/me/workspace/mysstapp/serverless-infra/node_modules/sst-cdk/lib/serverless-stack.ts:122:15)
    at /Users/me/workspace/mysstapp/serverless-infra/node_modules/@serverless-stack/core/index.js:71:17
    at async Promise.all (index 0)
    at deployStacks (/Users/me/workspace/mysstapp/serverless-infra/node_modules/@serverless-stack/core/index.js:48:5)
    at Object.parallelDeploy (/Users/me/workspace/mysstapp/serverless-infra/node_modules/@serverless-stack/core/index.js:446:3)

 ❌  dev-mysstapp-infra-dynamodb failed: Error: Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment

dev-mysstapp-infra-eventbridge: deploying...

 ❌  dev-mysstapp-infra-eventbridge failed: Error: Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment
    at SdkProvider.resolveEnvironment (/Users/me/workspace/mysstapp/serverless-infra/node_modules/sst-cdk/lib/api/aws-auth/sdk-provider.ts:208:13)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at CloudFormationDeployments.prepareSdkFor (/Users/me/workspace/mysstapp/serverless-infra/node_modules/sst-cdk/lib/api/cloudformation-deployments.ts:236:33)
    at CloudFormationDeployments.deployStack (/Users/me/workspace/mysstapp/serverless-infra/node_modules/sst-cdk/lib/api/cloudformation-deployments.ts:162:70)
    at CdkToolkit.deploy (/Users/me/workspace/mysstapp/serverless-infra/node_modules/sst-cdk/lib/cdk-toolkit.ts:194:24)
    at Object.deployAsync (/Users/me/workspace/mysstapp/serverless-infra/node_modules/sst-cdk/lib/serverless-stack.ts:122:15)
    at /Users/me/workspace/mysstapp/serverless-infra/node_modules/@serverless-stack/core/index.js:71:17
    at async Promise.all (index 1)
    at deployStacks (/Users/me/workspace/mysstapp/serverless-infra/node_modules/@serverless-stack/core/index.js:48:5)
    at Object.parallelDeploy (/Users/me/workspace/mysstapp/serverless-infra/node_modules/@serverless-stack/core/index.js:446:3)

 ❌  dev-mysstapp-infra-eventbridge failed: Error: Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment


Stack dev-mysstapp-infra-dynamodb
  Status: failed
  Error: Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment

Stack dev-mysstapp-infra-eventbridge
  Status: failed
  Error: Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment

✨  Done in 2.93s.

If an error is encountered at the cdk synthesizing step, it exits appropriately, though: There was an error synthesizing your app. error Command failed with exit code 1.

Any ideas why this might be the case? I'm trying to write a deploy script and I'd like for SST to properly exit non-zero when it fails to deploy.

@smoll
Copy link
Author

smoll commented Feb 1, 2021

Looking at the code, it looks like there is nothing that checks to see if any of the final stackStates are in a failed state.

Would you accept a PR for this? What do you think the behavior should be, to exit non-zero if any of the stacks failed?

Would it be better if this were a flag, e.g. something like --error-on-failed-states? TBH, even just writing that feels awkward. I think changing it to exit non-zero on any failures is the least surprising default behavior.

@jayair
Copy link
Contributor

jayair commented Feb 1, 2021

@smoll Thanks for looking into it. Yeah the non-zero status is the right behavior for sure. We'd appreciate a PR!

@jayair jayair added the bug Something isn't working label Feb 1, 2021
@molnarzs
Copy link

molnarzs commented May 26, 2021

Just a comment, we also had this problem, we worked around with the attached patch:

@serverless-stack+cli+0.20.0.patch.zip

So if there is no PR yet I could even create it

@fwang fwang self-assigned this May 28, 2021
@fwang fwang added this to the Ongoing issues & requests milestone May 28, 2021
@fwang
Copy link
Contributor

fwang commented May 29, 2021

This has been fixed in v0.23.0

@smoll @molnarzs Thank you guys for bringing this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants