Skip to content

util-dynamodb convertToAttr throws error when trying to serialize ES6 classes #1535

Closed
@trivikr

Description

@trivikr

Describe the bug
util-dynamodb convertToAttr throws error when trying to serialize ES6 classes
Refs: #1531 (comment)

SDK version number
master

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

To Reproduce (observed behavior)
A unit test is added under unsupported type in PR #1531

Expected behavior
Questionable, as v2 DynamodDB serializes ES6 class objects as maps.

Storing as string using JSON.stringify is more helpful, as class properties can be deserialized using JSON.parse:

JSON.stringify will also store Date (ref: #1534) in ISO 8601 format as follows:

> const now = new Date();
> const serialized = JSON.stringify(now);
> const past = new Date(JSON.parse(serialized));
> now.getTime() === past.getTime()
true

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions