aws-samples / aws-serverless-workshops

Code and walkthrough labs to set up serverless applications for Wild Rydes workshops
http://wildrydes.com
Apache License 2.0
4.2k stars 2.63k forks source link

Error when trying to run the function test. #276

Open dannyanders opened 4 years ago

dannyanders commented 4 years ago

First off, documentation says to select Node 6 as the runtime, but only node 10 and node 12 are available.

Then, I created a test event with the code specified in step 4 at https://aws.amazon.com/getting-started/projects/build-serverless-web-app-lambda-apigateway-s3-dynamodb-cognito/module-3/

When I run the test event, I get the following error:

Response: { "statusCode": 500, "body": "{\"Error\":\"One or more parameter values were invalid: Missing the key RiderId in the item\",\"Reference\":\"7aa60bad-5651-44ae-afc3-c53c42904f9d\"}", "headers": { "Access-Control-Allow-Origin": "*" } }

Request ID: "7aa60bad-5651-44ae-afc3-c53c42904f9d"

Function Logs: START RequestId: 7aa60bad-5651-44ae-afc3-c53c42904f9d Version: $LATEST 2020-03-07T00:25:20.392Z 7aa60bad-5651-44ae-afc3-c53c42904f9d INFO Received event ( r9CVzv-44aqY4WR4D7_nHA ): { path: '/ride',

Grossincome commented 4 years ago

First off, documentation says to select Node 6 as the runtime, but only node 10 and node 12 are available.

Then, I created a test event with the code specified in step 4 at https://aws.amazon.com/getting-started/projects/build-serverless-web-app-lambda-apigateway-s3-dynamodb-cognito/module-3/

When I run the test event, I get the following error:

Response: { "statusCode": 500, "body": "{"Error":"One or more parameter values were invalid: Missing the key RiderId in the item","Reference":"7aa60bad-5651-44ae-afc3-c53c42904f9d"}", "headers": { "Access-Control-Allow-Origin": "*" } }

Request ID: "7aa60bad-5651-44ae-afc3-c53c42904f9d"

Function Logs: START RequestId: 7aa60bad-5651-44ae-afc3-c53c42904f9d Version: $LATEST 2020-03-07T00:25:20.392Z 7aa60bad-5651-44ae-afc3-c53c42904f9d INFO Received event ( r9CVzv-44aqY4WR4D7_nHA ): { path: '/ride',

Same problem for me.

R2E commented 3 years ago

I had the same question about node.js runtimes, and received the same error as you. I ended up successfully going through the complete tutorial using node.js version 14 as my Lambda runtime. So I confirmed that you don't have to use node.js version 6 as instructed by the tutorial. The issue of the 500 error ended up being unrelated.

Regarding the 500 error, I too received it when testing the function as instructed by the tutorial. As it turns out, the error was unrelated to the node.js version. For me, I incorrectly typed the DynamoDB partition key (typed "RideID" instead of the correct "RideId") which triggered the error in the function test. Once I fixed the partition key ID to the correct case sensitivity, everything worked and the app ran as designed. (FYI - I discovered this fix via this conversation https://github.com/aws-samples/aws-serverless-workshops/issues/268)