Closed
Description
Expected behavior
Making headers optional on APIGatewayRequest allows for trivial testing via test console in AWS. While it's unlikely a request will not have headers in real world usage, it's trivial to reproduce in API Gateway console during testing.
I ran into this use case while testing the integration between a simple GET
endpoint and my Lambda. My lambda doesn't interact with headers at all, so while it's trivial to add one for testing, I'm curious if there's a specific reason that the headers aren't optional, and if they can be updated.
Actual behavior
2024-11-11T19:55:58+0000 warning Lambda : lifecycleIteration=0 [AWSLambdaRuntimeCore] lambda handler returned an error: requestDecoding(Swift.DecodingError.valueNotFound(Swift.Dictionary<Swift.String, Any>, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "headers", intValue: nil)], debugDescription: "Cannot get value of type Dictionary<String, Any> -- found null value instead", underlyingError: nil)))
Steps to reproduce
- Create any Lambda using the Swift Lambda Runtime that's triggered by API Gateway
- Make an empty request in the API Gateway console
If possible, minimal yet complete reproducer code (or URL to code)
The demo implementation at the SPM page will be adequate as long as it's triggered by API Gateway.
SwiftAWSLambdaRuntime version/commit hash
1.0.0-alpha
Swift & OS version (output of swift --version && uname -a
)
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx15.0
Darwin MacBook-Pro.localdomain 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:15 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6000 arm64