Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util-dynamodb doesn't marshall properties in prototype chain #1980

Closed
trivikr opened this issue Jan 29, 2021 · 1 comment · Fixed by #1974
Closed

util-dynamodb doesn't marshall properties in prototype chain #1980

trivikr opened this issue Jan 29, 2021 · 1 comment · Fixed by #1974
Labels
bug This issue is a bug.

Comments

@trivikr
Copy link
Member

trivikr commented Jan 29, 2021

Describe the bug

util-dynamodb doesn't marshall properties in prototype chain

Your environment

SDK version number

"@aws-sdk/util-dynamodb": "3.4.0",
"aws-sdk": "2.832.0"

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

All

Details of the browser/Node.js/ReactNative version

tested in Node.js v14.15.4

Steps to reproduce

Run the following file:

index.ts
const AWS = require("aws-sdk");
const { marshall } = require("@aws-sdk/util-dynamodb");

(async () => {
  const input = { a: 1, b: 2 };

  console.log(
    "v2 pure object: " + JSON.stringify(AWS.DynamoDB.Converter.marshall(input))
  );
  console.log("v3 pure object: " + JSON.stringify(marshall(input)));

  console.log(
    "v2 object from Object.create(): " +
      JSON.stringify(AWS.DynamoDB.Converter.marshall(Object.create(input)))
  );
  console.log(
    "v3 object from Object.create(): " +
      JSON.stringify(marshall(Object.create(input)))
  );
})();

Observed behavior

The properties a and b from prototype chain are not marshalled in v3.

Output
v2 pure object: {"a":{"N":"1"},"b":{"N":"2"}}
v3 pure object: {"a":{"N":"1"},"b":{"N":"2"}}
v2 object from Object.create(): {"a":{"N":"1"},"b":{"N":"2"}}
v3 object from Object.create(): {}

Expected behavior

The properties from prototype chain are marshalled.

Additional context

Refs: #1861

@trivikr trivikr added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. and removed needs-triage This issue or PR still needs to be triaged. labels Jan 29, 2021
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant