-
Notifications
You must be signed in to change notification settings - Fork 403
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: The KinesisFirehoseRecordMetadata model is typed incorrectly and forces a pydantic ValidationError. #3237
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Hi @ahitchin! Thanks for opening this issue and I can confirm it's a bug. Checking the links you sent and here this field should actually be Would you like to submit a PR to fix this? We'd love to have your first contribution here. If so, change the class, the test and also the [event] (https://github.com/aws-powertools/powertools-lambda-python/blob/develop/tests/events/kinesisFirehoseKinesisEvent.json). You can do the same for the data class test. |
|
This is now released under 2.26.1 version! |
Expected Behaviour
1. Overview
If you are using a data processor Lambda Function for a Kinesis Firehose Delivery Stream, you should be able to use the
KinesisFirehoseModel
model to validate events without encountering a pydanticValidationError
.Current Behaviour
1. Overview
When you validate a Kinesis Firehose Delivery Stream event with the
KinesisFirehoseModel
model, it fails because the kinesis record metadata'ssubsequenceNumber
(records[].kinesisRecordMetadata.subsequenceNumber) attribute has an incorrect type. This forces pydantic to throw aValidationError
that should not happen.Specifically, the
KinesisFirehoseModel
model starts validating its sub-structures. Once it validates its kinesis records' metadata with theKinesisFirehoseRecordMetadata
model, it fails. This is because sub-sequence numbers are integers, but the model'ssubsequenceNumber
attribute is expecting a string.2. ValidationError Output
Code snippet
Possible Solution
1. Overview
Update the Kinesis Firehose pydantic model and data class with the correct type hints.
2. Problematic Code
3. Proposal for the Pydantic Model
4. Proposal for the Data Class Dictionary Wrapper
5. Examples From Other Amazon/AWS Packages
Steps to Reproduce
1. Overview
KinesisFirehoseModel
pydantic model.KinesisFirehoseRecordMetadata
fails to validate.2. Sample Event
Powertools for AWS Lambda (Python) version
2.26.0
AWS Lambda function runtime
3.11
Packaging format used
PyPi
Debugging logs
The text was updated successfully, but these errors were encountered: