question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deploy error reporting is not showing the reason of failure when using nested stacks.

See original GitHub issue

main/root stack is not properly reporting errors from nested stacks, there is no way to know why it actually failed because the error is generalized that some resources could not be created, but why, there is no reason. The only chance to see the error is to constantly monitor the deployment on AWS CloudFormation Console, and once it starts to roll back and delete nested stacks you can quickly see why the nested stack failed in events tab.

E.g.:

creating CloudFormation changeset...
 0/3 | 2:07:56 PM | CREATE_IN_PROGRESS   | AWS::CDK::Metadata         | CDKMetadata
 0/3 | 2:07:56 PM | CREATE_IN_PROGRESS   | AWS::CloudFormation::Stack | appsync-bizon.NestedStack/appsync-bizon.NestedStackResource (appsyncbizonNestedStackappsyncbizonNestedStackResource814A53CF)
 0/3 | 2:07:57 PM | CREATE_IN_PROGRESS   | AWS::CloudFormation::Stack | appsync-bizon.NestedStack/appsync-bizon.NestedStackResource (appsyncbizonNestedStackappsyncbizonNestedStackResource814A53CF) Resource creation Initiated
 0/3 | 2:07:58 PM | CREATE_IN_PROGRESS   | AWS::CDK::Metadata         | CDKMetadata Resource creation Initiated
 1/3 | 2:07:58 PM | CREATE_COMPLETE      | AWS::CDK::Metadata         | CDKMetadata
 2/3 | 2:08:19 PM | CREATE_FAILED        | AWS::CloudFormation::Stack | appsync-bizon.NestedStack/appsync-bizon.NestedStackResource (appsyncbizonNestedStackappsyncbizonNestedStackResource814A53CF) Embedded stack arn:aws:cloudformation:eu-west-2:452364846299:stack/ProductName-bizon-appsyncbizonNestedStackappsyncbizonNestedStackResource814A53CF-4NAE12ZLOQGT/a92a4b40-3c46-11ea-9fec-06452e71541c was not successfully created: The following resource(s) failed to create: [dynamodbstackbizonNestedStackdynamodbstackbizonNestedStackResource0AACEAF0, productnameresolversNestedStackproductnameresolversNestedStackResource42DF9B6A].

as you can see there is no reason why it failed, just saying that some resources failed to create. While actually the error on the nested stack events tab is:

E.g.:

Service role arn not specified (Service: AWSAppSync; Status Code: 400; Error Code: BadRequestException; Request ID: 5a9b00be-f21c-4cea-97ad-3d0e8552c5e5)

or

Only one resolver is allowed per field. (Service: AWSAppSync; Status Code: 400; Error Code: BadRequestException; Request ID: 39813c06-7d28-4d72-be32-f05785f4338e)
  QueryListEvents, WikiArticleLastRevision

or

Property validation failure: [Value for property {/Name} does not match pattern {[_A-Za-z][_0-9A-Za-z]*}]

So there is no way to know about those errors because on roll back those stacks are removed, and developer will never know why it failed.

Reproduction Steps

Just add a nested stack and try to simulate the above error examples:

  1. Create AppSync nested stack but don’t create service roll for it, and try to create another resource which should rely on that service role.
  2. Name a resource in a nested stack improperly with - or .
  3. Create 2 same resolver in one nested stack. etc … basically any error that will be thrown inside nested stack

Error Log

already specified above

Environment

  • CLI Version : 1.21.0
  • Framework Version:
  • OS : Windows
  • Language : Typescript

Other

I found this issue opened as a feature #4489 but I don’t think it is a feature, rather it is a bug, since the feature of having Nested Stacks exists, this means that error reporting for nested stack to be chained in the parent wasn’t.


This is 🐛 Bug Report

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:43
  • Comments:8

github_iconTop GitHub Comments

6reactions
nlaffey-icariocommented, Jun 22, 2021

I’m also trying to learn CDK right now and wondering how I’m supposed to debug anything when all I’m getting is something like “The following resource(s) failed to create: [Serverapp, EbsStackawselasticbeanstalkec2roleD9735CA4].”

5reactions
RcSeppcommented, Jun 11, 2022

I faced the same issue, but found the failed nested stack in the CloudFormation CLI under stacks and when toggling the dropdown from “Active” to “Deleted”. The stack events for that one contained the failure reason.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS sam deploy with nested stacks - errors from child ...
When a resource fails to create/update, the resource's backing service returns a reason to the stack, which gets logged as the Status Reason...
Read more >
Troubleshooting CloudFormation - AWS Documentation
If AWS CloudFormation fails to create, update, or delete your stack, you can view error messages or logs to help you learn more...
Read more >
Top 10 Serverless Deployment Errors (and How to Fix Them)
The solution: · Alternatively, you can open the AWS Console, navigate to CloudFormation, and find the failed stack in your Stacks list: ·...
Read more >
CloudFormation Nested Stacks Archives
By default, automatic rollback on error feature is enabled, which will cause all the AWS resources that CloudFormation created successfully for ...
Read more >
Passing values and parameters to nested stacks - N47
The error is self explanatory. It says that you have defined a parameter in one of your stacks that actually is never used....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found