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.

[cli] cdk diff always reports diff if resource has non-ASCII characters

See original GitHub issue

cdk diff always reports diff if resource has non-ASCII characters.

Reproduction Steps

import * as cdk from "@aws-cdk/core";
import * as codebuild from "@aws-cdk/aws-codebuild";

const app = new cdk.App();
const stack = new cdk.Stack(app, "stack1");
new codebuild.Project(stack, "FooProject", {
  buildSpec: codebuild.BuildSpec.fromObject({
    version: "0.2",
    phases: {
      build: {
        commands: ["echo こんにちは"], // "Hello" in Japanese
      },
    },
  }),
});

$ cdk --version
1.63.0 (build 7a68125)

$ cdk deploy stack1 --require-approval=never
stack1: deploying...
<snip>
 ✅  stack1

$ cdk diff stack1
Stack stack1
Resources
[~] AWS::CodeBuild::Project FooProject FooProject9FE653E4 
 └─ [~] Source
     └─ [~] .BuildSpec:
         ├─ [-] {
  "version": "0.2",
  "phases": {
    "build": {
      "commands": [
        "echo ?????"
      ]
    }
  }
}
         └─ [+] {
  "version": "0.2",
  "phases": {
    "build": {
      "commands": [
        "echo こんにちは"
      ]
    }
  }
}

What did you expect to happen?

cdk diff reports no diff, when resources are in sync.

What actually happened?

cdk diff always reports diff, even when resources are in sync.

Environment

  • CLI Version : 1.63.0
  • Framework Version: 1.63.0
  • Node.js Version: v12.18.4
  • OS : Linux (Docker container)
  • Language (Version): all (I guess…)

Other

Guessing from its behavior, it seems like correct encoding(UTF-8?) is not specified while fetching current template from CloudFormation. So that the non-ASCII characters are converted to the “?” character and treated as if it is having diffs.


This is 🐛 Bug Report

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:33
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
idm-ryoucommented, Jun 22, 2022

If anyone is interested in this feature, I recommend opening an issue in Cloudformation coverage roadmap

Done. https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues/1220

0reactions
peterwoodworthcommented, Jun 21, 2022

If anyone is interested in this feature, I recommend opening an issue in Cloudformation coverage roadmap

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS CDK Toolkit (cdk command) - AWS Documentation
The AWS CDK Toolkit, the CLI command cdk , is the primary tool for interacting with ... cdk diff. Compares the specified stack...
Read more >
Cloudformation doesn't properly return non-ascii characters
Using the aws-sdk, the http api, the aws cli and the aws cloudformation console, the GetTemplate action does not return non-ascii characters properly...
Read more >
What does CDK Diff do in AWS CDK | bobbyhadz
The CDK diff command allows us to compare the deployed and local versions of the CloudFormation templates.
Read more >
Lessons in AWS Python CDK: 1-Getting Started
TLDR Install dependencies: Definitely - brew install aws-cdk Maybe: ... (almost always the best way to see if you have something installed).
Read more >
Tag Archives: AWS CDK - Noise
There is one default pipeline responsible for deploying resources to the different application environments (e.g., Development, Pre-Prod, and Prod). The code is ...
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