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

PDR-326 updating AWS-SDK to V3 #331

Merged
merged 2 commits into from
May 13, 2024
Merged

Conversation

cameronpettit
Copy link
Contributor

PDR-326 Upgrading to AWS-SDK V3

A couple gotchas with this ticket for future conversions (#326):

  • Serverless uses SDK V2. Until we migrate to SAM, we will continue to get the 'Switch to v3' error message.

  • marshall and unmarshall have changed, and seem to have difficulty with empty fields and nested objects. Be warned for future conversions. Use marshall(item, {removeUndefinedValues: true }) to avoid errors.

  • Review AWS's recommended approaches for interacting with DynamoDB and strive to follow them on net-new code. The preexisting method of dyanmodb.putItem(itemWithNestedProps) for example should be replaced with:

const { DynamoDBClient, PutCommand } = require('@aws-sdk/client-dynamodb');
const dynamodb = new DynamoDBClient(options);
let input = {
   TableName: TABLE_NAME,
   Item: marshall(itemWithNestedProps, {removeUndefinedValues: true}),
};
let command = new PutCommand(input);
let result = await dynamodb.send(command);

Look here for more information.

Copy link

sonarqubecloud bot commented May 9, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@cameronpettit cameronpettit merged commit f37fd92 into bcgov:main May 13, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants