Closed
Description
#666 added #[serde(deny_unknown_fields)]
to ApiGatewayProxyRequest
and other request types:
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 local
includes extraneousversion
attribute inApiGatewayLambdaEvent
(incompatible with aws-lambda-rust-runtime) aws/aws-sam-cli#6442, Lambda functions written using this library cannot be tested with versions ofsam local
from the past 3 years. This is a bug inaws-sam-cli
, not theaws_lambda_events
crate, 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