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

Incorrect Typescript type for DynamoDB StringSetAttributeValue #3627

Closed
2 of 3 tasks
Nevon opened this issue Feb 8, 2021 · 7 comments
Closed
2 of 3 tasks

Incorrect Typescript type for DynamoDB StringSetAttributeValue #3627

Nevon opened this issue Feb 8, 2021 · 7 comments
Labels
closed-for-staleness feature-request A feature should be added or improved. typings Issue is related to typings.

Comments

@Nevon
Copy link

Nevon commented Feb 8, 2021

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug

The Typescript type definition for a StringSetAttributeValue in a DynamoDB response is string[]:

export type StringAttributeValue = string;
export type StringSetAttributeValue = StringAttributeValue[];

But in reality, it's the DynamoDBSet type.

Is the issue in the browser/Node.js?
Browser & Node.js

If on Node.js, are you running this on AWS Lambda?
Yes, but it shouldn't matter.

Details of the browser/Node.js version
v14.15.1

SDK version number
2.580.0

To Reproduce (observed behavior)

Just do a get on an item with a StringSet. For example:

const db = new aws.DynamoDB.DocumentClient();
const params: aws.DynamoDB.DocumentClient.GetItemInput = {
    Key: {
        account_id,
    },
    TableName
};
const result = await db.get(params).promise();
console.log(result?.Item)

// output
{
  approved_usage: Set {
    wrapperName: 'Set',
    values: [ 'performance', 'staging' ],
    type: 'String'
  },
  account_id: '123456789',
}

Expected behavior

I would expect that the StringSetAttributeValue would be something like a DynamoDBSet<string>, not a string[]. I assume the other set types have the same issue.

@Nevon Nevon added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 8, 2021
@ajredniwja
Copy link
Contributor

Hey @Nevon thanks for opening this issue, the Typescript definitions were added late to the SDK, while I am not sure when this will be fixed in this SDK, The version 3.x of the AWS SDK for JavaScript is generally available.
For more information see the Developer Guide
or API Reference.

The V3 is written in TypeScript to provide type safety, while documentClient is not implemented in V3 because of the issues mentioned here, the getItem should work just the same which should solve the problem.

Please let us know you feel about using V3 for your application.

@ajredniwja ajredniwja added the response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. label Feb 11, 2021
@github-actions
Copy link

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Feb 19, 2021
@Nevon
Copy link
Author

Nevon commented Feb 19, 2021

The V3 is written in TypeScript to provide type safety, while documentClient is not implemented in V3 because of the issues mentioned here, the getItem should work just the same which should solve the problem.

This is true, but migrating from aws-sdk v2 to v3 is unfortunately not as simple as a single method call for non-trivial systems. Eventually we will of course migrate over, but seeing as how v2 is still supported and even baked into the NodeJS lambda runtimes by default, it doesn't seem like too much to ask that the Typescript types be updated to be correct.

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. labels Feb 20, 2021
@ajredniwja ajredniwja added the typings Issue is related to typings. label Feb 25, 2021
@ajredniwja ajredniwja added feature-request A feature should be added or improved. and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 28, 2021
@ajredniwja
Copy link
Contributor

@Nevon apologies for late reply here V3 was able to have the full implementation of all the DynamoDb functions, with that being said, I believe you are right but since its already fixed in V3 of the SDK it takes less of a priority. We welcome PRs in case you wanna open one but I am not sure about the priority for this mostly because V3 was intended to solve this problem.

@github-actions
Copy link

Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Sep 29, 2022
@Nevon
Copy link
Author

Nevon commented Sep 29, 2022

This is still an issue

@github-actions github-actions bot removed the closing-soon This issue will automatically close in 4 days unless further comments are made. label Sep 30, 2022
@github-actions
Copy link

github-actions bot commented Oct 1, 2023

Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Oct 1, 2023
@github-actions github-actions bot closed this as completed Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness feature-request A feature should be added or improved. typings Issue is related to typings.
Projects
None yet
Development

No branches or pull requests

2 participants