Skip to content

bug(util-dynamodb): BigInt value increases by 1n after marshall+unmarshall #1543

Closed
@trivikr

Description

@trivikr

Describe the bug
BigInt value increases by 1n after marshall+unmarshall

SDK version number
@aws-sdk/[email protected]

Is the issue in the browser/Node.js/ReactNative?
Node.js

Details of the browser/Node.js/ReactNative version
v12.18.3

To Reproduce (observed behavior)

Code
const { deepStrictEqual } = require("assert");
const { marshall, unmarshall } = require("@aws-sdk/util-dynamodb");

const bigInt = 9007199254740995n;
deepStrictEqual(bigInt, unmarshall(marshall({ bigInt })));
Output
assert.js:100
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected

+ 9007199254740995n
- {
-   bigInt: 9007199254740996n
- }
    at Object.<anonymous> (/local/home/trivikr/workspace/ddb-test/bigint.js:5:1)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: 9007199254740995n,
  expected: { bigInt: 9007199254740996n },
  operator: 'deepStrictEqual'
}

Expected behavior
Value of BigInt doesn't change while marshalling/unmarshalling. i.e. No AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions