dashboard-plugin
dashboard-plugin copied to clipboard
Cannot read property 'X-Amzn-Trace-Id' of null - Testing Serverless Framework Pro wrapped Lambda function in API Gateway Console
Bug Report
Description
Cannot read property 'X-Amzn-Trace-Id' of null. This is caused by testing a Serverless Framework Pro wrapped Lambda function in API Gateway Console.
- What did you do? Deployed serverless framework API with single lambda function using the Serverless Framework Pro integration.
- What happened? All resources deployed properly. When testing the function in the API gateway console, it broke with the following error:
{
"errorType": "TypeError",
"errorMessage": "Cannot read property 'X-Amzn-Trace-Id' of null",
"stack": [
"TypeError: Cannot read property 'X-Amzn-Trace-Id' of null",
" at Runtime.handler (/var/task/serverless_sdk/index.js:9:87215)",
" at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"
]
}
- What should've happened? It should not require that attribute if the API Gateway console doesn't support it, in their test request.
- What's the content of your
serverless.yml
file?
org: xxxxx
app: xxxxxxxx
service: xxxxxx-auth-api
provider:
name: aws
runtime: nodejs12.x
stage: ${opt:stage, "dev"}
region: ${opt:region, "us-west-2"}
profile: ${opt:profile, "xxxxxxxx"}
functions:
test:
name: ${self:custom.base}-test
handler: index.handler
events:
- http:
path: /test
method: ANY
cors: true
custom:
base: ${self:service}-${self:provider.stage}
# https://serverless.com/framework/docs/dashboard/output-variables/
outputs:
ApiEndpoint:
Fn::Join:
- ''
- - https://
- Ref: ApiGatewayRestApi
- .execute-api.${self:provider.region}.amazonaws.com/${self:provider.stage}
ApiId:
Ref: ApiGatewayRestApi
ApiResourceId:
Fn::GetAtt:
- ApiGatewayRestApi
- RootResourceId
This is caused by testing a Serverless Framework Pro wrapped Lambda function in API Gateway Console.
Can you share more details on that?
Was it tested in Lambda console (by pressing "Test" button), if so, then what event object you've used?
If it was tested in API Gateway console, do you mean that you've clicked API url, and that resulted with such error?
Remove "app" and "org" labels for serverless.yml
Remove "app" and "org" labels for serverless.yml
If you do this, Github deploy triggers won't work.