Hi
First, I im a newbi to the aws stack and serverless, so if my question is nobbish, im sorry in advance…
Im following the guide from:
https://medium.freecodecamp.com/building-a-nodejs-microservice-on-aws-lambda-6adb6da53cbb#.1gwx3zrmz
I have cloned the repo from git, deployed, and every thing seams fine until i run a test, so the code should be ok.
Do my lampda or the apiGateway lack Read/Write Access rights to Dynamodb? im a bit lost here, Any advices ?
When i test an post/insert im getting the error
{
“errorMessage”: “Error creating pet”
}
and the log:
Execution log for request test-request
Thu Sep 22 09:36:23 UTC 2016 : Starting execution for request: test-invoke-request
Thu Sep 22 09:36:23 UTC 2016 : HTTP Method: POST, Resource Path: /pets
Thu Sep 22 09:36:23 UTC 2016 : Method request path: {}
Thu Sep 22 09:36:23 UTC 2016 : Method request query string: {}
Thu Sep 22 09:36:23 UTC 2016 : Method request headers: {}
Thu Sep 22 09:36:23 UTC 2016 : Method request body before transformations: {
“name”: “Fido”,
“petId”: “0daf29340”,
“type”: “dog”
}
Thu Sep 22 09:36:23 UTC 2016 : Endpoint request URI: https://lambda.eu-central-1.amazonaws.com/2015-03-31/functions/arn:aws:lambda:eu-central-1:753780823860:function:pets-service-dev-createPet/invocations
Thu Sep 22 09:36:23 UTC 2016 : Endpoint request headers: {x-amzn-lambda-integration-tag=test-request, Authorization=***************************************************************************************************************************************************************************************************************************************************************************************************************************599736, X-Amz-Date=20160922T093623Z, x-amzn-apigateway-api-id=jtogdef50f, X-Amz-Source-Arn=arn:aws:execute-api:eu-central-1:753780823860:jtogdef50f/null/POST/pets, Accept=application/json, User-Agent=AmazonAPIGateway_jtogdef50f, Host=lambda.eu-central-1.amazonaws.com, X-Amz-Content-Sha256=8377ed912b656bf6626e4fc4267202a45ff377ccc8d6079b0222781239698eff, Content-Type=application/json}
Thu Sep 22 09:36:23 UTC 2016 : Endpoint request body after transformations:
{
"body": {"name":"Fido","petId":"0daf29340","type":"dog"},
"method": "POST",
"principalId": "",
"stage": "test-invoke-stage",
"headers": {
}
,
"query": {
}
,
"path": {
}
,
"identity": {
"cognitoIdentityPoolId":
""
, "accountId":
"753780823860"
, "cognitoIdentityId":
""
, "caller":
"753780823860"
, [TRUNCATED]
Thu Sep 22 09:36:23 UTC 2016 : Endpoint response body before transformations: {“errorMessage”:“Error creating pet”}
Thu Sep 22 09:36:23 UTC 2016 : Endpoint response headers: {x-amzn-Remapped-Content-Length=0, x-amzn-RequestId=06c25a05-80a8-11e6-90fb-6f354e6d57b9, Connection=keep-alive, Content-Length=37, X-Amz-Function-Error=Handled, Date=Thu, 22 Sep 2016 09:36:23 GMT, Content-Type=application/json}
Thu Sep 22 09:36:23 UTC 2016 : Method response body after transformations: {“errorMessage”:“Error creating pet”}
Thu Sep 22 09:36:23 UTC 2016 : Method response headers: {Content-Type=application/json}
Thu Sep 22 09:36:23 UTC 2016 : Successfully completed execution
Thu Sep 22 09:36:23 UTC 2016 : Method completed with status: 200