aws-api-gateway-cli-test icon indicating copy to clipboard operation
aws-api-gateway-cli-test copied to clipboard

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

Open boxabirds opened this issue 4 years ago • 3 comments

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.

boxabirds avatar Dec 22 '19 05:12 boxabirds

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

jayair avatar Dec 29 '19 22:12 jayair

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"
}
'

boxabirds avatar Jan 07 '20 10:01 boxabirds

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

jayair avatar Jan 19 '20 03:01 jayair