Skip to content

Bug: DynamoDBStreamEvent returns NaN when working with zero numbers #4931

Closed
@leandrodamascena

Description

@leandrodamascena

Expected Behaviour

This PR #4863 intrudoced a regression when working with Zero numbers. It's now returning NaN instead of a 0 Decimal.

Current Behaviour

Returning NaN when working with 0.

Code snippet

from aws_lambda_powertools.utilities.data_classes.dynamo_db_stream_event import (
    DynamoDBStreamEvent,
    DynamoDBRecordEventName
)

def lambda_handler(event, context):
    event: DynamoDBStreamEvent = DynamoDBStreamEvent(event)
    for record in event.records:
        print(record.dynamodb.new_image)

Possible Solution

No response

Steps to Reproduce

Invoke a Lambda with DynamoDB Stream and try to access old image.

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.12

Packaging format used

PyPi

Debugging logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagePending triage from maintainers

    Type

    No type

    Projects

    Status

    Shipped

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions