Skip to content

Bug: SQS MessageAttribute Schema invalid #3398

@hrzbrg

Description

@hrzbrg

Expected Behavior

Using the SQS Envelope and my custom body schema, I expected to be able to parse SQS events generated by Symfony Messenger.

Current Behavior

Parsing fails, because binaryValue is null. The SQS SqsMsgAttributeSchema defines it as optional string, but not nullish.

Code snippet

        "messageAttributes": {
          "X-Symfony-Messenger": {
            "stringValue": "{\"X-Message-Stamp-Symfony\\\\Component\\\\Messenger\\\\Stamp\\\\BusNameStamp\":\"[{\\\"busName\\\":\\\"external.event.bus\\\"}]\"}",
            "binaryValue": null,
            "stringListValues": [],
            "binaryListValues": [],
            "dataType": "String"
          },
          "type": {
            "stringValue": "App\\Event\\ChangeLogEvent",
            "binaryValue": null,
            "stringListValues": [],
            "binaryListValues": [],
            "dataType": "String"
          },
          "Content-Type": {
            "stringValue": "application/json",
            "binaryValue": null,
            "stringListValues": [],
            "binaryListValues": [],
            "dataType": "String"
          }
        },

Steps to Reproduce

  1. Use the Powertools Parser with envelope: SqsEnvelope to parse an SQS event with the above mentioned messageAttributes.

Possible Solution

BinaryValue could be set to be nullish: binaryValue: z.string().nullish()

Powertools for AWS Lambda (TypeScript) version

2.10

AWS Lambda function runtime

20.x

Packaging format used

npm

Execution logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparserThis item relates to the Parser UtilityrejectedThis is something we will not be working on. At least, not in the measurable future

    Type

    No type

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions