aws / aws/aws-cdk

(core): Very large numbers are rounded in synthesized template

Open
#21,271 2 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/core bug effort/medium p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

Very large numbers end up getting rounded in the synthesized template rather than being the values originally passed in by the user

### Expected Behavior

If you pass in a number to a construct which takes an int, the number in the synthesized template would be the same as what was passed

### Current Behavior

The number is not the same. For example, passing in `9223372036854775807` to a construct will round to `9223372036854776000` in the template

### Reproduction Steps

Create a resource that takes in an int e.g.
```
new Table(this, 'Table', {
partitionKey: { name: 'id', type: AttributeType.STRING },
readCapacity: 9223372036854775807
});
```

Then view the template and notice the numbers differ

### Possible Solution

The max safe integer for Typescript numbers is 9007199254740991. Numbers exceeding this require use of BigInt, which isn't supported in CDK likely due to needing to convert numbers to json.

### Additional Information/Context

_No response_

### CDK CLI Version

.

### Framework Version

_No response_

### Node.js Version

.

### OS

.

### Language

Typescript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests. Reproduce the Table with readCapacity 9223372036854775807, trace how the value is serialized into the synthesized template, and verify that supported integer values are preserved exactly without breaking template generation.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.