HttpApi lambda error mismatch with sam local
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 1.2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 52
Description
### Description:
Hey team,
Found a discrepancy between `sam local start-api` and running in an AWS account.
While running in an AWS account, unhandled errors thrown from AWS lambda connected with API gateway return a 500 internal server error.
While running locally via `sam local start-api` these same errors return a 200:
```json
{
"errorType": "Error",
"errorMessage": "",
"trace": [
"Error",
" at Runtime.exports.index [as handler] (/var/task/app.js:13:9)",
" at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"
]
}
```
### Steps to reproduce:
I've provided a repo https://github.com/iRoachie/http-api-example.
- Clone the repo
##### For local:
- `sam local start-api`
- `curl -i localhost:3000`
```
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 192
Server: Werkzeug/1.0.1 Python/3.8.7
Date: Fri, 05 Feb 2021 16:23:11 GMT
{"errorType": "Error", "errorMessage": "", "trace": ["Error", " at Runtime.exports.index [as handler] (/var/task/app.js:13:9)", " at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"]}%
```
##### For AWS
- `sam deploy --guided`
- See outputs `ApiURL`
- `curl -i {ApiURL}`
```
HTTP/2 500
date: Fri, 05 Feb 2021 16:34:30 GMT
content-type: application/json
content-length: 35
apigw-requestid: aR7_khtxoAMEVlQ=
{"message":"Internal Server Error"}%
```
### Expected result:
`sam local start-api` should have the same output as running on AWS
### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
1. OS: mac os 10.15.7
2. `sam --version`: 1.17.0
3. AWS region: us-east-1
Contributor guide
Assessment
This issue has not been assessed yet.