Closed npellegrin closed 2 months ago
Your payload example shows that you're not receiving payloads from an APIGW HTTP endpoint, but an APIGW Rest endpoint. The version
field is the indicator:
{
"version": "1.0",
If your integrating send events from APIGW HTTP, the version would be 2.0
. See this payload as an example: https://github.com/awslabs/aws-lambda-rust-runtime/blob/main/lambda-events/src/fixtures/example-apigw-v2-request-no-authorizer.json#L2
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one.
Thank you @calavera for your quick answer.
The payload actually came from an authentic HTTP API Gateway v2. But you are correct, the 1.0 payload compatibility was activated on it.
As I understand, apigw_http
feature flag will currently only works with 2.0 payloads, even if 1.0 payloads are available in HTTP APIs. Is it a design choice in the module to not support 1.0 payloads with apigw_http
? Can we add a note about it in the README to prevent further mistakes when using this feature flag ?
This is the first time I see version 1 being used with an HTTP endpoint, tbh. The feature name is just to indicate how we part the event payloads, but it really doesn't matter where they come from. I'm ok documenting this in the readme.
I have deployed an HTTP API (Amazon Api Gateway v2) with a Rust lambda backend, but I am facing some problems with request deserialization. I am not sure if it is a bug or a mistake on my side, but it seems the lambda-http module only recognize an Amazon API Gateway v2 HTTP Lambda Proxy Integration Request format when both
apigw_rest
andapigw_http
features are enabled. I expected to enable onlyapigw_http
feature when working with HTTP APIs (apigateway v2).The behavior is:
features = ["apigw_http"]
in Cargo.toml, any request thows the error:this function expects a JSON payload from Amazon API Gateway, Amazon Elastic Load Balancer, or AWS Lambda Function URLs, but the data doesn't match any of those services' events"
features = ["apigw_rest", "apigw_http"]
in Cargo.toml: it worksBelow are the resources to reproduce the issue.
Lambda source code
Invalid Cargo.toml
Working Cargo.toml configuration
JSON Event from API integration reproducing the problem