Add a note in the deployment guide to inform Linux user they must have
correct permissions to use docker on their system.
### Motivation:
Build instructions fail on a fresh Ubuntu installation. See this error
report.
https://github.com/swift-server/swift-aws-lambda-runtime/issues/449
### Modifications:
Add a note in the deployment guide that Linux user must add their user
in the `docker` group.
### Result:
Hopefully, Linux users will not experience error at first use of `swift
package archive`
As discussed with @0xTim
This PR
- adds a minimal example of deployment using SAM in the README
- adds a `Deployment.md` Swift Docc file to cover deployment with the
AWS console, CLI, SAM, and CDK. It mentions and contains a call to
contributions to further examples for third-party tools such as the
Serverless Framework, Terraform, or Pulumi.
All the `Package.swift` files from the examples use `path: "."` instead
of `path: "Sources"` which triggers error messages when users add a
`Tests` directory.
We want that the runtime only depends on `FoundationEssentials` where
available (ie. on linux) to ensure small binary size.
### Motivation:
Smaller binary size is good for lambda deployment and cold-start times.
The runtime should only depend on `FoundationEssentials`.
### Modifications:
- replace `import Foundation` with `import FoundationEssentials` if
`FoundationEssentials` is available.
- I also applied the same treatment to tests to ensure that catch error
where tests run on linux and we use API that is only available in
`Foundation` which easily happens when you develop on macOS (where
always full `Foundation` is available).
### Result:
This should allow builds without linking full `Foundation`.
* add tracing of request events + mention LOG_LEVEL in README
* fix typo
Co-authored-by: Mahdi Bahrami <github@mahdibm.com>
* clarify the use of env variable and the swift cli
Co-authored-by: Mahdi Bahrami <github@mahdibm.com>
* clarify language about HTTP server
Co-authored-by: Mahdi Bahrami <github@mahdibm.com>
* formatting
Co-authored-by: Mahdi Bahrami <github@mahdibm.com>
* factor in additional suggestions from @mahdibm
* combine two logger statement into one and print only for Kb of payload
---------
Co-authored-by: Mahdi Bahrami <github@mahdibm.com>
Motivation:
Provide the flexibility for custom initialization of the HandlerType as this will often be required by higher level frameworks.
Modifications:
* Modify the LambdaRuntime type to accept a closure to provide the handler rather than requiring that it is provided by a static method on the Handler type
* Update downstream code to use HandlerProvider
* Update upstream code to support passing Handler Type of Handler Provider
* Add and update tests
Originally suggested and coded by @tachyonics in https://github.com/swift-server/swift-aws-lambda-runtime/pull/308
motivation: swift 5.9 ships with builtin backtrace support \o/
changes:
* remove the dependency on swift-backtrace when using swift 5.9 or above
* conditionalize the call to Backtrace.install to relevant versions only
motivation: define stable API in preperation 1.0 release
changes:
* require swift 5.7, remove redundant backwards compatibility code
* make LambdaHandler, EventLoopLambdaHandler, and ByteBufferLambdaHandler disjointed protocols to reduce API surface area
* create coding wrappers for LambdaHandler and EventLoopLambdaHandler to provide bridge to ByteBufferLambdaHandler
* reuse output ByteBuffer to reduce allocations
* add new SimpleLambdaHandler with no-op initializer for simple lambda use cases
* update callsites and tests
* update examples
Co-authored-by: Yim Lee <yim_lee@apple.com>
Co-authored-by: Fabian Fett <fabianfett@apple.com>