Skip to content

Problem getting message from SQS in the lambda #179

Closed
@jimadamsss

Description

@jimadamsss

I have created a lambda to read json requests sent in as the body element. This is something I have done previously using a lava based lambda but I wanted to try this with Swift. My issue is that my lambda fails when the message comes in due to a missing messageId. Once this happens the lambda is in a infinite loop attempting to read the same message over and over.

This is the error from Cloudwatch
2020-12-11T23:20:35+0000 warning Lambda : lifecycleIteration=0 lambda handler returned an error: requestDecoding(Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "messageId", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: "messageId", intValue: nil) ("messageId").", underlyingError: nil)))

Expected behavior

What I expect to happen is the lambda to fail with an error that stops the lambda from firing again. Secondly I would like to see the raw string so this can be debugged.

This was run using Swift 5.2 and swift lambda runtime version 0.3.0

SwiftAWSLambdaRuntime version/commit hash

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/documentationImprovements or additions to documentation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions