chiefbiiko / dynamodb

deno <3 dynamodb
MIT License
25 stars 11 forks source link

Support AWS_SESSION_TOKEN #1

Closed hayd closed 4 years ago

hayd commented 4 years ago

For example in aws lambda, in order for the client to work it needs to pass the header (if it exists):

    "X-Amz-Security-Token": Deno.env("AWS_SESSION_TOKEN"),

in createHeaders. Note this is a short-lived token so likely this has to be looked up each time anyways (I don't think this can be cached)...

I can confirm this fix works for deno+dynamodb on aws lambda 🎉 but perhaps there is a better way to do it from a style/testing point of view?


Aside: Without this fix the underlying request gives a "The security token included in the request is invalid." error, but you don't see that without modifying the dynamodb code just Error: http query request failed: 400 Bad Request, it'd be great to bubble up the json error message (which was googleable / suggested this solution).