motivation: Notice that if you check the contents of the SQS records, some kind of transform happened on the original SNS message. MessageAttributes in the above example, these will not be set, so this is the initial fix.
changes: make MessageAttributes are optional
- Add an `AsyncLambdaHandler`. Will be renamed to `LambdaHandler` as soon as we drop the current callback based `LambdaHandler`.
- The default way to use an `AsyncLambdaHandler` is to use `@main` to execute it. Don't use `Lambda.run` for it. We wan't to remove `Lambda.run` for 1.0.
Co-authored-by: tomer doron <tomerd@apple.com>
motivation: support s3:ObjectRemoved:* event
changes:
* Changed the S3.Event object size field to an optional due to the missing field on a s3:ObjectRemoved:* event
* Added one additional test to check propper json decoding
Add `@inlinable` to default LambdaHandler implementations. This ensures that those implementations can be inlined into user code and can be specialized for their input and output types.
Modifications:
- Replace `HTTPHandler` with `NIOHTTPClientResponseAggregator`, to fix a CoW issue. This increases performance.
- Ensure that we only use one `EventLoop` in tests.
- Use `syncOperations` to setup the `HTTPClient`.
motivation: in error cases where lamnda fails to start the process fails silently and exists with code 0
changes: change the blocking API to check on the result and fatalError if lambda cannot be started / run
motivation: more correct Xray TraceID
changes:
* add AmazonHeaders::generateXRayTraceID
* Generate correct trace ID in LocalLambda Server
* Generate correct trace ID in LambdaRuntimeClientTest
motivation: Sometimes common header date comes with an alphabetical timezone in brackets after the numeric timezone
changes:
* Support common header date format with brackets
* Update readme with SES Event link
motivation: make shutdown easier to use
changes:
* override shutdown to use the offloadQueue to perform syncShutdown
* add empty syncShutdown that can be implmented by the concrete Lambda function
* allow the users of client to provide headers
* add initialization error header
* add error header to failed invocations
* fix external setting of ip and port via config
* add tests
motivation: in more complex initialization scearios you may want access to a logger or other utilities
changes:
* introduce new InitializationContext type that could be extended in the future without breaking the API in semantic-major way
* instead of passing in EventLoop to the handler factory, pass in a context that includes a Logger, an EventLoop and a ByteBufferAllocator
* fix a bug where we dont hop back to the event loop when coming back from the handler
* adjust tests to the new signature
motivation: better mock server
changes:
* add handler for :requestID/error
* return .accepted to lambda
* return .internalServerError to client + error json
* small refactoring of response code in mock server to make it DRYer
motivation: make using the local debugging server easier to turn off/on without the need to change code when oyu are preparing to deploy
changes:
* add code to lambda so that in debug mode only, if the LOCAL_LAMBDA_SERVER_ENABLED env variable is set the local debugging server is started
* make withLocalServer internal
* update example code
motivation: allow end to end testing locally
changes:
* add a Lambda+LocalServer which exposes Lambda.withLocalServer available only in DEBUG mode
* local server can receive POST requests with payloads on a configurable endpoint and and send them to the Lambda
* move Lifecycle completely into EventLoop
* remove all locks since running in one EventLoop
* Use UUID for requestId
Co-authored-by: tom doron <tomer@apple.com>
motivation: testing harness should only be used for testing, and uses @testable import which doe not work in release builds
changes: hide code behind #if check
motivation: make testing lambda easy
changes:
* add a AWSLambdaTesting module
* add helper methods for testing different types of Lambda handlers / closures
motivation: easy integration of web frameworks frameworks like vapor and smoke
changes: expose `Lifecycle` as a public API to allow easy integration with higher level frameworks
motivation: beter performance
changes:
* abstract JSONCoders and have a default static instance
* make encoding/decoding DRYer across String and Codable