-
Notifications
You must be signed in to change notification settings - Fork 380
Closed
Description
#666 added #[serde(deny_unknown_fields)] to ApiGatewayProxyRequest and other request types:
https://github.com/awslabs/aws-lambda-rust-runtime/blob/d513b13b4c48122602c0690f55147607f3bcc0da/lambda-events/src/event/apigw/mod.rs#L16
Using this serde attribute causes deserialization to fail if any unexpected fields are included in the request payload. This has two negative consequences:
- Due to Bug:
sam localincludes extraneousversionattribute inApiGatewayLambdaEvent(incompatible with aws-lambda-rust-runtime) aws-sam-cli#6442, Lambda functions written using this library cannot be tested with versions ofsam localfrom the past 3 years. This is a bug inaws-sam-cli, not theaws_lambda_eventscrate, but it illustrates a downside to strict request parsing. - If the Amazon API Gateway team were to add a new feature that involved a new request field, all deployed Rust Lambda functions using the Lambda proxy integration might immediately break in production. In most APIs, adding a new field is not considered a breaking change. Unless there's a guarantee from that team never to add additional fields, this could be a ticking time bomb.
Unless there's a strong reason to reject request payloads with unknown fields that outweighs these downsides, I'd recommend removing deny_unknown_fields.
Metadata
Metadata
Assignees
Labels
No labels