-
Notifications
You must be signed in to change notification settings - Fork 361
Tighten lambda-http event deserializer #788
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
Conversation
We just removed those attributes in #753. Can we do anything else to improve the serialization logic besides that? |
The schema for these HTTP related events rarely change. For breaking changes, the service team usually publishes another version of the schema. For example, APIGW v1 and v2. |
Why are bedrock events being mistaken with APIGW events? they are two completely different services. I'd prefer to fix that. |
Yes, they are two completely different services and schema. But 'ApiGatewayProxyRequest''s properties are either optional or have defaults. 'ApiGatewayWebsocketProxyRequest' has the same problem. 'ApiGatewayV2httpRequest' has 'skip_serializing_if' on several properties. 'AlbTargetGroupRequest' has one mandatory property 'http_method'. One solution is to use 'skip_serializing_if' on 'ApiGatewayProxyRequest' and 'ApiGatewayWebsocketProxyRequest'. |
I'm puzzled: the SQS event has no issue. Only Bedrock one has this issue. |
I found the reason. Bedrock event has 'httpMethod'. This single property made it deserializable into 'ApiGatewayProxyRequest' and 'ApiGatewayWebsocketProxyRequest'. |
…'ApiGatewayProxyRequest' and 'ApiGatewayWebsocketProxyRequest'
@calavera I have updated the PR. Please take a look again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Issue #, if available:
related to awslabs/aws-lambda-web-adapter#317
Description of changes:
Add 'deny_unknown_fields' to ApiGatewayProxyRequest, ApiGatewayV2httpRequest, and ApiGatewayWebsocketProxyRequest. This prevents the runtime to deserialize Bedrock Agent event as 'ApiGatewayProxyRequest'.
By submitting this pull request