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
state.dynamodb: validate AWS connection #3285
state.dynamodb: validate AWS connection #3285
Conversation
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
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.
Please fix the linter issues
state/aws/dynamodb/dynamodb.go
Outdated
TableName: aws.String(d.table), | ||
Key: map[string]*dynamodb.AttributeValue{ | ||
d.partitionKey: { | ||
S: aws.String(uuid.NewString()), |
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.
uuid.NewString
can panic (if the kernel doesn't have entropy). Please use uuid.NewRandom
and then call .String()
on the result
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.
Also, ptr.Of
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.
Thanks @ItalyPaleAle! Check out if you like how I did this. In case of error, I chose to use a fixed string, since I didn't want to have the initialisation of dapr fail because of it; it's just a dummy check anyway.
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena-kolevska@users.noreply.github.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Description
I added a Get check to a dummy key on component Init for aws Dynamodb. This will prevent Dapr from initialising if we have wrong component info (credentials/table name).
Issue reference
#3190
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: