Skip to content

(cli): (2.34.0 parses AWS account ID as a number) #21381

@ilazakis

Description

@ilazakis

Describe the bug

This change in 2.34.0 forces parsing AWS account ids as numbers.

This breaks code like the following:

func LoadContextValue(scope constructs.Construct, key string) (value string) {
	value = fmt.Sprintf("%s", scope.Node().TryGetContext(jsii.String(key)))
	log.Printf("%s", value)
	if value == "" {
		log.Fatalf("FATAL ERROR: missing '%s' context argument", key)
	}
	return
}

If I run a CDK command e.g. cdk diff -v --context accountID=111111111111 the log output is %!s(float64=1.11111111111e+11).

Expected Behavior

If I run a CDK command e.g. cdk diff -v --context accountID=111111111111, I expect the log output to be 111111111111.

Current Behavior

In 2.33.0, if I run a CDK command e.g. cdk diff -v --context accountID=111111111111, the log output is 111111111111 and I can diff/deploy/destroy stacks successfully.

Reproduction Steps

Run any CDK command that expects a number to be parsed as a string.

In my case, I run cdk diff -v --context accountID=111111111111, but the same issue exists for any CDK command e.g. deploy, destroy etc.

Possible Solution

I suspect this change in 2.34.0 causes the issue.

Additional Information/Context

No response

CDK CLI Version

2.34.0

Framework Version

No response

Node.js Version

v16.13.1

OS

macOS 12.4

Language

Go

Language Version

Go 1.18

Other information

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p0package/toolsRelated to AWS CDK Tools or CLI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions