Skip to content

README.MD example about SimpleLambdaHandler  #285

Closed
@fitomad

Description

@fitomad

The README.MD file contains an example about the use of SimpleLambdaHandler receiving an Amazon SQS event

import AWSLambdaRuntime
import AWSLambdaEvents

@main
struct MyLambda: SimpleLambdaHandler {
    // In this example we are receiving a SQS Event, with no response (Void).
    func handle(_ event: SQS.Event, context: LambdaContext) async throws -> Void {
        ...
    }
}

There's no SQS.Event type available in the AWSLambdaEvents package, It seems that the expected type is SQSEvent

import AWSLambdaRuntime
import AWSLambdaEvents

@main
struct MyLambda: SimpleLambdaHandler {
    // In this example we are receiving a SQS Event, with no response (Void).
    func handle(_ event: SQSEvent, context: LambdaContext) async throws {
        ...
    }
}

Also removed the returning Void following the Apple style guide, but I understand that is presented due to educational purpose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions