-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: sam local
includes extraneous version
attribute in ApiGatewayLambdaEvent
(incompatible with aws-lambda-rust-runtime)
#6442
Comments
Hi @ramosbugs, thanks for reporting the issue. I see your PR in |
Yup, but I think this is still a bug in aws-sam-cli worth fixing.
API Gateway HTTP APIs support two payload versions, which is what that link documents. API Gateway REST APIs do not have a It's easy to confuse because HTTP APIs are sometimes called v2 APIs, and REST APIs are sometimes called v1 APIs, but this nomenclature is independent of the HTTP API payload versioning represented by the Quote from the docs you linked above:
In this repo, I believe aws-sam-cli/tests/unit/local/apigw/test_local_apigw_service.py Lines 33 to 65 in 821fcb6
|
Thanks for providing the detailed references @ramosbugs. Marking this as a bug for the team to check if the field |
Patch is released in v1.107.0. Closing |
Description:
#1942 added support for API Gateway HTTP (aka v2) APIs to
sam local
. This change also modified the API Gateway REST API (aka v1) request payload to include a"version": "1.0"
attribute that is not part of the payload that API Gateway includes in production.This extraneous
version
attribute breaks compatibility with runtimes like the aws-lambda-rust-runtime that reject payloads that include unexpected fields.As a consequence, the current versions of aws-sam-cli and aws-lambda-rust-runtime are mutually incompatible with one another for local testing. This is quite frustrating.
Since
sam local
is supposed to behave identically (as much as possible) to the corresponding AWS services, I feel theversion
attribute should be removed fromApiGatewayLambdaEvent
:aws-sam-cli/samcli/local/events/api_event.py
Line 208 in aa132f8
Steps to reproduce:
AWS::Serverless::Api
resource and corresponding Lambda proxy integrationsam local
Observed result:
Lambda receives a request payload that includes
"version": "1.0"
(not present in API Gateway payloads).Expected result:
Lambda should receive a request payload without
version
that mirrors the payload API Gateway sends in production.The text was updated successfully, but these errors were encountered: