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.

(aws-cdk): changeset fails with Description attribute mismatch

See original GitHub issue

Upon deploying a stack which has not seen any changes to the local CDK code via cdk deploy, we receive a message of:

ChangeSet cdk-deploy-change-set cannot be created due to a mismatch with existing attribute Description

My first stop was to synth and output the template for the failing stack. The template only had one resource which had a Description field. The value in the template matched perfectly to what had been in the code for some time prior, and the Description on the resource in the AWS Console.

Next, I went into the CloudFormation Stack for the failing stack and took a look at the changesets. For each of our failing stacks, there was a pending changeset. Each changeset had JSON changes which looked like this:

[
  {
    "resourceChange": {
      "logicalResourceId": "CDKMetadata",
      "action": "Modify",
      "physicalResourceId": "6fffac30-9bfd-11eb-9c43-0e0748486565",
      "resourceType": "AWS::CDK::Metadata",
      "replacement": "Conditional",
      "moduleInfo": null,
      "details": [
        {
          "target": {
            "name": "Analytics",
            "requiresRecreation": "Conditionally",
            "attribute": "Properties"
          },
          "causingEntity": null,
          "evaluation": "Static",
          "changeSource": "DirectModification"
        }
      ],
      "changeSetId": null,
      "scope": [
        "Properties"
      ]
    },
    "hookInvocationCount": null,
    "type": "Resource"
  }
]

My initial thought was to delete the pending changesets for the failing services, thinking that maybe they were left over from some interrupted deploy and were causing the conflict. Deleting the changesets just resulted in new pending changesets from subsequent deploy attempts.

Next, I figured I would manually execute the changesets in the failing stacks to see what happened. Every changeset in every failing stack, suffering from the error above, executed successfully when triggered manually in the AWS Console. After manually executing, all failing stacks succeeded with (no changes) in their success messages via cdk deploy

The only possible correlation that I could find in the code here was: https://github.com/aws/aws-cdk/blob/9e421e5b25c43cb9f49ebfb29751a42d73b87e6a/packages/aws-cdk/lib/api/deploy-stack.ts#L250

Other than that, I’m at a loss.

Reproduction Steps

I’m honestly not sure how to reproduce this. After we initially solved the problem by manually executing the changesets, everything seemed to work as expected.

What did you expect to happen?

Successful deploys.

What actually happened?

Please see above

Environment

  • CDK CLI Version : 1.98.0
  • Framework Version: 1.98.0
  • Node.js Version: 14.15.3
  • OS : MacOS
  • Language (Version): TS 4.1.3

Other


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
shellscapecommented, Apr 23, 2021

@rix0rrr appreciate the reply here, but seems like a premature close. Passing the buck to the users for a race/context conflict comes across as (forgive me, I can’t think of another word, and I don’t mean to be overly negative here) lazy. For a project with as much reach as this one, it seems like an important problem to solve without requiring user intervention.

At the very least, this should be codified in documentation explicitly, no?

1reaction
rix0rrrcommented, Apr 23, 2021

This error seems to occur when two CDK invocations create the change set at the same time. They’ll try to create a change set with the same name, which is causing this error.

Pass --change-set-name to potentially parallel invocations to make sure they create different change sets.

Only one of them will be able to deploy successfully anyway, but at least the error message will be different 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve change set errors in CloudFormation - Amazon AWS
I receive an error when I try to import resources into an AWS CloudFormation stack. Short description. Based on the type of error...
Read more >
awslabs/aws-cdk - Gitter
... ChangeSet awscli-cloudformation-package-deploy-1568607333 cannot be created due to a mismatch with existing attribute Description.
Read more >
cdk deploy - AWS CDK Workshop
Bootstrapping an environment # The first time you deploy an AWS CDK app into an ... cloudformation:CreateChangeSet within the scope of your account/session ......
Read more >
@aws-cdk/assert | Yarn - Package Manager
The AWS Cloud Development Kit (AWS CDK) is an open-source software development framework to define cloud infrastructure in code and provision it through...
Read more >
AWS CDK Toolkit - npm
Command, Description. cdk docs, Access the online documentation. cdk init, Start a new CDK project (app or library). cdk list, List stacks ...
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