swift-server / swift-aws-lambda-events

Swift implementation of AWS Lambda Events
Apache License 2.0
50 stars 27 forks source link

Issue parsing APIGateway Event #17

Closed idelfonsog2 closed 11 months ago

idelfonsog2 commented 2 years ago

Expected behavior

Expected my lambda to return a APIGatewayV2Response along with my body

Actual behavior

Found the following in the CloudWatch Logs

2022-04-25T15:40:54+0000 warning Lambda : lifecycleIteration=1 lambda handler returned an error: requestDecoding(Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "version", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: \"version\", intValue: nil) (\"version\").", underlyingError: nil)))

Steps to reproduce

  1. Use the Deployment Lambda found in the Examples dir and deployed to AWS using APIGateway with a Lambda_PROXY
  2. make an HTTP call to your APIGateway
  3. Observe the errors in the CloudWatch Log

If possible, minimal yet complete reproducer code (or URL to code)

serverless.yml

service: helloworld-swift-aws

provider:
    name: aws
    runtime: provided
    region: us-east-2

package:
    artifact: .build/lambda/HelloWorld/lambda.zip

functions:
    hello:
        handler: HelloWorld
        memorySize: 128
        events:
          - http:
              method: ANY
              path: /{proxy+}
              cors: true

SwiftAWSLambdaRuntime version/commit hash

main branch

Swift & OS version (output of swift --version && uname -a)

Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8) MacOS Monterrey 12.3.1

idelfonsog2 commented 2 years ago

I create a PR #16

sebsto commented 11 months ago

I think this issue can be closed @tomerd @tachyonics

tomerd commented 11 months ago

fixed via #18