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

Doesn't appear to use standard AWS API for access? #18

Open
boxabirds opened this issue Dec 22, 2019 · 3 comments
Open

Doesn't appear to use standard AWS API for access? #18

boxabirds opened this issue Dec 22, 2019 · 3 comments

Comments

@boxabirds
Copy link

boxabirds commented Dec 22, 2019

Firstly thanks for this tool! It is really useful for debugging issues.

And also, I spent a big chunk of time hunting down what was in the end a simple typo in my code for the name of the primary index column. One of the problems that slightly exacerbated it was that the HTTP status code returned was 500 but under the hood it's actually 400. E.g.

Making API request
{
  status: 500,
  statusText: 'Internal Server Error',
  data: {
    status: false,
    exception: '{"message":"The provided key element does not match the schema","code":"ValidationException","time":"2019-12-22T00:18:40.455Z","requestId":"CRVC9347J1AGP60CB6818OPN6JVV4KQNSO5AEMVJF66Q9AXXXXXX","statusCode":400,"retryable":false,"retryDelay":40.114206418810625}'
  }

Digging into the code a bit to see where this mapping was, I noticed this CLI utility, as helpful as it is, seems to refer to this independent AWS client. I'm confused because that repository does have headers that say copyright Amazon; I can only presume this is a fork?

The issue is I don't think the 400 code should be mapped to a 500 code as this loses important information and is hard to trace back to official AWS docs when the code has been changed.

@jayair
Copy link
Member

jayair commented Dec 29, 2019

Hmm I don't think it's doing any error mapping AFAIK. How do you know it was a 400 error?

@boxabirds
Copy link
Author

Ah yes so when I try and run the query directly using the dynamodb cli it produces the 400 error.

The column is "noteId" as per book, but I had "nodeId" and it produced this error:

https://aws.amazon.com/premiumsupport/knowledge-center/key-element-error-dynamodb-hive-emr/

… which is error 400 apparently.

aws dynamodb update-item --cli-input-json '{
  "TableName": "notes",                                                                                                                  "Key": {                                                                                                                                 "userId": { "S": "us-east-1:…" },
    "noteId": { "S": "5bb9e890…" }
  },
  "UpdateExpression": "SET content = :content, attachment = :attachment",
  "ExpressionAttributeValues": {
    ":attachment": { "S": "hello.jpg" },
    ":content": { "S": "hello world" }
  },
  "ReturnValues": "ALL_NEW"
}
'

@jayair
Copy link
Member

jayair commented Jan 19, 2020

Right but the Lambda function returns a 500 error? The CLI isn't doing any remapping in this case right?

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

No branches or pull requests

2 participants