-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat(dynamodb): add dynamodb storage adapter #206
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi.
Thanks for your contribution, really appreciate this.
But can you please do few changes?
"name": "@grammyjs/storage-dynamodb", | ||
"version": "2.4.0", | ||
"description": "AWS DynamoDB storage adapter for grammY", | ||
"types": "dist/index.d.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think main
field missed there?
if (item) { | ||
return JSON.parse(item.Value.S) as T; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should response with null in case item not found.
} catch (error) { | ||
console.error('Error reading item from DynamoDB:', error); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we shouldn't catch something there and especially logging.
try { | ||
await this.client.send(putItemCommand); | ||
} catch (error) { | ||
console.error('Error writing item to DynamoDB:', error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trycatch please.
try { | ||
await this.client.send(deleteItemCommand); | ||
} catch (error) { | ||
console.error('Error deleting item from DynamoDB:', error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trycatch please.
In this pull request I add an additional storage adapter for DynamoDB.
Let me know if you have questions.
Best regards,
Manuel Tarouca