Commit Graph

388 Commits

Author SHA1 Message Date
Sébastien Stormacq 007ac1f192 [ci] Use APIGatewayV2 for link foundation check (#595)
Revert change on
https://github.com/awslabs/swift-aws-lambda-runtime/pull/593

The root cause has been addressed in the Swift AWS Lambda Event library 
https://github.com/awslabs/swift-aws-lambda-events/pull/99

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-10-21 06:52:35 +02:00
Sébastien Stormacq 8168a5c22e fix ci : check libFoundation on HelloWorld example (#593)
Fix errors in the CI
The script that checks the presence of `libFoundation` in the binary
started to fail.
I can't think about a recent change that would cause this.

This PR change the test script to use the `HelloWorld` example instead
of `APIGAtewayV2`

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-10-20 20:01:46 +02:00
Sébastien Stormacq dee635267b change references from /swift-server to /awslabs (#591)
Change Examples, README, and doc to refer to https://github.org/awslabs
instead of https://github.org/swift-server

---------

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-10-17 16:46:58 +02:00
Sébastien Stormacq 8116ba3023 Allow multiple invocations of streaming Lambda functions with the local test server (#590)
The Local HTTP Server (used when testing) used to block after one
invocation of a streaming lambda function. Now you can invoke multiple
times your streaming function without having to restart the local HTTP
server.

### Motivation:

Bug https://github.com/swift-server/swift-aws-lambda-runtime/issues/588

### Modifications:

The flow to respond to streaming and non-streaming requests are
different. In the streaming request flow, we forgot to send an 202
accept response to the lambda runtime client after it posted the end
chunck of the response (in other words, `POST /response` never received
an HTTP 202 response.) This caused the Lambda Runtime to hang and never
issue the next `GET /next `request.

### Result:

You can now send multiple invocations to your streaming lambda.

---------

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-10-17 10:37:38 +02:00
Natan Rolnik e3b74f3a0e Add initializer with LambdaHandler directly with Decodable event and Void output (#589)
_Add convenience initializer for `LambdaRuntime` to accept
`LambdaHandler` instances with `Void` output_

### Motivation:

Following PR #581, which added convenience initializers for
`LambdaRuntime` to accept `LambdaHandler` instances with `Encodable`
outputs, there was still a gap for handlers that return `Void`. This is
useful, for example, for AWS event sources like SQS, where the
`AWSLambdaEvents` package provides `SQSEvent` but there's no
corresponding output type - handlers simply process messages and return
`Void`.

Without this initializer, developers had to manually wrap their handlers
with `LambdaCodableAdapter` and `LambdaHandlerAdapter`, which was
verbose and inconsistent with the new API (similar to what is described
in #581)

### Modifications:

1. Added a new `init(decoder:handler:)` convenience initializer to
`LambdaCodableAdapter` in `Lambda+JSON.swift` that accepts a
`JSONDecoder` for handlers with `Void` output.

2. Added a new convenience initializer to `LambdaRuntime` that accepts a
`LambdaHandler` instance with `Void` output directly, handling the
wrapping internally.

3. Updated documentation comments to distinguish between handlers with
`Void` and `Encodable` outputs.

### Result:

Developers can now initialize `LambdaRuntime` with handlers that return
`Void` using a clean, direct API. This is especially useful for event
sources like SQS:

```swift
import AWSLambdaEvents

struct MySQSHandler: LambdaHandler {
    func handle(_ event: SQSEvent, context: LambdaContext) async throws {
        // Process SQS messages
    }
}

let runtime = LambdaRuntime(lambdaHandler: MySQSHandler())
```

This provides API completeness, matching the convenience initializers
for handlers with `Encodable` outputs, and delivers better ergonomics
for common serverless patterns.
2.3.0
2025-10-16 21:34:49 +02:00
Ben Rosen 9487a09e3a Lambda Handler errors now reports the root error in field errorType rather than "FunctionError" constant (#587)
### Motivation:

Fix for Issue
[#580](https://github.com/swift-server/swift-aws-lambda-runtime/issues/580),
by making it so that the `errorType` in failed requests will be the type
of the error entity, rather than a hardcoded string of `FunctionError`.
This allows orchestration within step functions that perform retry/catch
logic based on different error output types.

### Modifications:

At a high level, the issue is that swift-aws-lambda-runtime, when an
error is thrown, outputs the errorType as hardcoded to FunctionError.
You can see that
[here](https://github.com/swift-server/swift-aws-lambda-runtime/blob/main/Sources/AWSLambdaRuntime/LambdaRuntimeClient%2BChannelHandler.swift#L337):

```
let errorResponse = ErrorResponse(errorType: Consts.functionError, errorMessage: "\(error)")
```

This PR changes this for all cases to output the type of the error,
rather than the hardcoded string:
```
let errorResponse = ErrorResponse(errorType: "\(type(of: error))", errorMessage: "\(error)")
```
Now, I will show 2 examples with this solution:
```
let runtime = LambdaRuntime {
    (event: Input, context: LambdaContext) in

    enum MyTestErrorType: Error {
        case testError
    }
    
    throw MyTestErrorType.testError
}

// outputs {"errorType":"MyTestErrorType","errorMessage":"testError"}
```
```
let dynamoDB: DynamoDB = DynamoDB(client: .init())

let runtime = LambdaRuntime {
    (event: Input, context: LambdaContext) in

    let _ = try await dynamoDB.putItem(DynamoDB.PutItemInput(item: [:], tableName: ""))
    
    return Output()
}

// outputs {"errorType":"AWSClientError","errorMessage":"ValidationError: Length of PutItemInput.tableName (0) is less than minimum allowed value 1."}
```
2.2.0
2025-10-15 00:30:40 +02:00
Sébastien Stormacq 22f9f6d5e7 Double time interval to allow test to succeed on slow machines (#583)
See https://github.com/swift-server/swift-aws-lambda-runtime/issues/582

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2.1.1
2025-10-13 19:40:44 +02:00
Natan Rolnik 461c18af6f Add LambdaRuntime initializer with LambdaHandler directly with Codable support (#581)
_Add convenience initializer for `LambdaRuntime` to accept
`LambdaHandler` instances directly_

### Motivation:

When using the Swift AWS Lambda Runtime with custom handler types that
conform to `LambdaHandler`, developers previously had two options to
initialize `LambdaRuntime`:

1. Manually wrap their handler with `LambdaCodableAdapter` and
`LambdaHandlerAdapter`:
   ```swift
   let lambdaHandler = MyHandler()
   let handler = LambdaCodableAdapter(
       encoder: JSONEncoder(),
       decoder: JSONDecoder(),
       handler: LambdaHandlerAdapter(handler: lambdaHandler)
   )
   let runtime = LambdaRuntime(handler: handler)
   ```

2. Use a closure-based initializer that indirectly calls the handler:
   ```swift
   let lambdaHandler = MyHandler()
   let runtime = LambdaRuntime { event, context in
       try await lambdaHandler.handle(event, context: context)
   }
   ```

Both approaches are verbose and don't provide a clean, ergonomic API for
the common case of initializing `LambdaRuntime` with a custom
`LambdaHandler` instance. The closure approach also creates an
unnecessary indirection layer, wrapping the handler in a
`ClosureHandler` before adapting it, or using `LambdaCodableAdapter`.

### Modifications:

Added a new convenience initializer to `LambdaRuntime` in
`Lambda+JSON.swift` that accepts a `LambdaHandler` instance directly:

```swift
public convenience init<Event: Decodable, Output, LHandler: LambdaHandler>(
    decoder: JSONDecoder = JSONDecoder(),
    encoder: JSONEncoder = JSONEncoder(),
    logger: Logger = Logger(label: "LambdaRuntime"),
    lambdaHandler: sending LHandler
)
where
    Handler == LambdaCodableAdapter<
        LambdaHandlerAdapter<Event, Output, LHandler>,
        Event,
        Output,
        LambdaJSONEventDecoder,
        LambdaJSONOutputEncoder<Output>
    >,
    LHandler.Event == Event,
    LHandler.Output == Output
```

This initializer handles the wrapping of the `LambdaHandler` with the
necessary adapters internally, matching the pattern already established
for closure-based handlers.

### Result:

Developers can now initialize `LambdaRuntime` with a `LambdaHandler`
instance using a clean, direct API:

```swift
let lambdaHandler = MyHandler()
let runtime = LambdaRuntime(lambdaHandler: lambdaHandler)
```

This provides:
- **Better ergonomics**: More intuitive and less verbose API
- **Consistency**: Matches the pattern of accepting handlers directly,
similar to how `StreamingLambdaHandler` can be used
- **No extra indirection**: Avoids wrapping the handler in an
unnecessary `ClosureHandler` or `LambdaCodableAdapter`
- **Type safety**: Maintains full type inference for `Event` and
`Output` types from the handler
2.1.0
2025-10-09 19:20:19 +02:00
Sébastien Stormacq eeb354986b Remove links to runtime v1, add links to the doc on SPI (#576)
- Remove links to runtime v1,
- add links to the doc on the Swift package Index
2025-09-30 11:51:52 +02:00
Sébastien Stormacq 8cfd36a30d Rename APIGateway example to APIGatewayV2 (#575)
Now that we have an APIGatewayV1 example, rename the existing APIGateway
examples to APIGatewayV2.

Fix https://github.com/transfer-aws/swift-aws-lambda-runtime/issues/572
2.0.0
2025-09-29 10:37:30 +02:00
Sébastien Stormacq 74e4efdbac Apply recommendation for security and reliability (#573)
Apply recommendations in code and documentation

- [CI] restrict permissions to read-all instead of the default write-all
- All examples README.md : add a note about Lambda functions
configuration with improved security and scalability changes for
production environment
- Swift docc documentation: add a note about Lambda functions
configuration with improved security and scalability changes for
production environment

---------

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-09-27 12:39:16 +02:00
Erin Sparling d8aa38be78 [Example] Add APIGatewayV1 example (#569)
This PR adds an APIGateway V1 example, which differs slightly from the
existing [V2
example](https://github.com/swift-server/swift-aws-lambda-runtime/tree/main/Examples/APIGateway).

### Motivation:

While APIGatewayV2 has existed for a while, there are still some
scenarios where V1 is preferable (see [Choose between REST APIs and HTTP
APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html)
for more details). This PR adds a working example for the `Api` endpoint
type.

### Modifications:

Sources/main.swift
- Swapped APIGatewayRequestV2 and APIGatewayResponseV2 for their
unversioned counterparts (aka V1).

template.yaml
- Changed the Events name and corresponding `Type: Api` values.
- Added necessary additional properties to define a `GET` endpoint for
an `Api` endpoint.

Readme.md
- Updated the request and response example outputs.

### Result:

Now, an APIGateway and APIGatewayV1 example exist. 

> [!NOTE]
> It is the author's opinion that this new example should technically be
called `APIGateway` and the existing one should be renamed to
`APIGatewayV2` to keep consistent with the request and response type
naming conventions, but this is omitted from this request to be less
disruptive.
2025-09-26 12:13:48 +00:00
Sébastien Stormacq 02d483074d [Example] Use smaller containers in all examples (#571)
All the examples using SAM have a default Lambda runtime environment
memory size of 512Mb.

Lambda functions run in a microVM defined by its memory size. The memory
size influences the CPU power.
(see
https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html)

Increasing memory size increases runtime performance but also increase
costs.

As most of our examples are very simple and small functions, 512Mb
memory is not required. This PR reduces Lambda runtime execution
environment to 128Mb to reduce AWS costs.

Co-authored-by: Sebastien Stormacq <stormacq@amazon.lu>
2025-09-26 10:10:12 +02:00
Sébastien Stormacq a1ab8df708 Update toolchain and doc for 6.2 (#564)
In preparation for the 2.0.0 GA release,

- Update `.swift-version`, `Package.swift` and all examples'
`package.swift` to Swift 6.2
- Update all references to `2.0.0-beta.3` to `2.0.0`. This includes the
doc and readme, but also the dependencies in the examples
`Package.swift`. This will temporary break the build of the examples,
until we tag v2.0.0. Note the CI will not be affected as its consumes
the local version of the library
- [CI] Use Swift-6.2-noble for all testing tasks
- Reinstate the script to generate the contributors list and update the
list
2.0.0-rc.1
2025-09-23 21:12:33 +02:00
Sébastien Stormacq 1843cdcb3c [fix] The library must compile when no traits are enabled (#563)
Make required changed to ensure the library compiles when no traits are
enabled (fix:
https://github.com/swift-server/swift-aws-lambda-runtime/issues/562)

Add an example project that serves as test in the CI

### Motivation:

Recent changes introduced compilation errors when no traits are enabled.

### Modifications:

- `LambdaResponseStreamWriter.writeStatusAndHeaders()` moved to the
`FoundationSupport` directory where all classes and struct depending on
`Encodable` and `Decodable` are located, protected by `#if
FoundationJSONSupport`
- `LambdaRuntime.run()` method when ServiceLifeCycle is disabled in now
public (and therefore can not be `@inlinable` anymore)
- Add an example that disables all traits.
- Add this example to the CI 

### Result:

The Library now compiles when no default traits are enabled.
This is flagged `semver/major` because we change the public API
`LambdaRuntime.run()`
2025-09-16 11:05:45 +02:00
Sébastien Stormacq 303559d9ed Bump Amazon RDS version 19 PG 17 (#561)
Update SwiftServiceLifeCycle example to use Postgres 17 (PG 15 is going
to be deprecated on Amazon RDS)
2025-09-06 10:14:03 +02:00
Fabian Fett 191e27b0a0 Fix compile on macOS (#559)
We need to require ServiceLifecycle 2.8.0.
2025-09-04 15:24:15 +02:00
Sébastien Stormacq d8ee71fc09 add support for LOCAL_LAMBDA_PORT / HOST(#557)
Allows users to define on which port the Local server listens to, using
the `LOCAL_LAMBDA_PORT` environment variable.

While being at it, I also added `LOCAL_LAMBDA_HOST` if the user wants to
bind on a specific IP address.

I renamed `LOCAL_LAMBDA_SERVER_INVOCATION_ENDPOINT` to
`LOCAL_LAMBDA_INVOCATION_ENDPOINT` for consistency.

### Motivation:

Addresses
https://github.com/swift-server/swift-aws-lambda-runtime/issues/556

### Modifications:

- When run outside of the Lambda execution environment, check for the
value of `LOCAL_LAMBDA_PORT` and passes it down to the Lambda HTTP Local
Server and runtime client.

- Add a unit test 

### Result:

```
LAMBDA_USE_LOCAL_DEPS=../.. LOCAL_LAMBDA_PORT=8888 swift run                  

2025-09-01T21:55:22+0200 info LambdaRuntime: host="127.0.0.1" port=8888 [AWSLambdaRuntime] Server started and listening
```
2.0.0-beta.3
2025-09-03 18:22:57 +02:00
Sébastien Stormacq d42ae6975e Refactor the Swift Settings in Package.swift (#558)
- Use the new Swift 6 `@available` macro to remove requirement on
`.platform` in Package.swift.
- DRY: define the swift settings once for all in `Package.swift`

### Motivation:

- Remove the requirement to build on macOS 15 in `Package.swift`. This
allows library builders and end users to be more flexible on their
dependency requirements.
- The code is optionally compiled on macOS 15 and Linux, but SPM don't
enforce it anymore.
- Avoid repeating ourself. Be sure the same settings are applied on all
targets.

### Modifications:

- Create a `var swiftSetting: [SwiftSettings]` and reuse it for all
targets.
- Use `AvailabilityMacro=LambdaSwift 2.0:macOS 15.0`
- Add this on top of the majority struct / classes
```swift
#if swift(>=6.1)
@available(LambdaSwift 2.0, *)
#endif
```
### Result:

When using Swift 6.1, there is no more SPM dependency on macOS 15
2025-09-03 18:00:24 +02:00
Sébastien Stormacq ec28c96696 Rename Tests' timeout() function (#555)
Fixes
https://github.com/swift-server/swift-aws-lambda-runtime/issues/553
2.0.0-beta.2
2025-09-01 13:31:45 +02:00
Sébastien Stormacq 53ec1cbf3a Split LambdaRuntimeClient in two files for easier reading (#554)
Split the long `LambdaRuntimeClient.swift` file in two parts: the
`LambdaRuntimeClient` and the `LambdaChannelHandler` for easier reading
and maintenance
2025-09-01 13:07:40 +02:00
Sébastien Stormacq efc4cd16bf Propagate Connection Closed Information up to top-level (fix #465) (#545)
This PR implements a mechanism to propagate connection loss information
from the Lambda runtime client to the runtime loop, enabling termination
without backtrace when the connection to the Lambda control plane (or a
Mock Server) is lost.

The changes are:

- When the connection is lost,
`ChannelHandlerDelegate.channelInnactive()` now correctly calls
`resume(throwing:)` on the ending continuation, for all states
(`.waitingForNextInvocation ` and `.sentResponse`). This eliminates the
hangs on connection lost..

- I added top-level error handling on `LambdaRuntime._run()` 

- Add a unit test to check that either
`LambdaruntimeError.connectionToControlPlaneLost`, a `ChannelError`, or
an `IOError` is thrown when the server closes the connection
2025-09-01 12:21:13 +02:00
Sébastien Stormacq 323b3f2ac2 fix: Fix deadline header with correct instant value (#551) (#552)
Instant's value now correctly prints as an EPOCH number

### Motivation:

A regression was introduced by
https://github.com/swift-server/swift-aws-lambda-runtime/pull/540. The
HTTP headers returned by `LocalServer` contained an invalid
representation of the Lamba Deadline.

See https://github.com/swift-server/swift-aws-lambda-runtime/issues/551

### Modifications:

- Add `CustomStringConvertible` to `LambdaClock.Instant` to just print
the `Int64` value
- add a unit test 

### Result:

The runtime works correctly with the new `LambdaClock`
2025-08-24 13:37:24 +02:00
Sébastien Stormacq 262c3b539a Revert streaming codable handler and provide it as an example, not an API (#549)
Revert streaming codable handler change and propose it as an example
instead of an handler API.

**Motivation:**
I made a mistake when submitting this PR 
https://github.com/swift-server/swift-aws-lambda-runtime/pull/532

It provides a Streaming+Codable handler that conveniently allows
developers to write handlers with `Codable` events for streaming
functions.

This is a mistake for three reasons:

- This is the only handler that assumes a Lamba Event structure as
input. I added a minimal `FunctionUrlRequest` and `FunctionURLResponse`
to avoid importing the AWS Lambda Events library. It is the first
handler to be event-specific. I don't think the runtime should introduce
event specific code.

- The handler only works when Lambda functions are exposed through
Function URLs. Streaming functions can also be invoke by API or CLI.

- The handler hides `FunctionURLRequest` details (HTTP headers, query
parameters, etc.) from developers

Developers were unaware they were trading flexibility for convenience

The lack of clear documentation about these limitations led to incorrect
usage patterns and frustrated developers who needed full request control
or were using other invocation methods.

**Modifications:**
- Removed the Streaming+Codable API from the library
- Moved the Streaming+Codable code to an example
- Added prominent warning section in the example README explaining the
limitations
- Clarified when to use Streaming+Codable vs ByteBuffer approaches
- Added decision rule framework to help developers choose the right
approach

**Result:**
The only API provided by the library to use Streaming Lambda functions
is exposing the raw `ByteBuffer` as input, there is no more `Codable`
handler for Streaming functions available in the API. I kept the
`Streaming+Codable` code an example.

After this change, developers have clear guidance on when to use each
streaming approach:

- Use streaming codable for Function URL + JSON payload + no request
details needed
- Use ByteBuffer StreamingLambdaHandler for full control, other
invocation methods, or request metadata access

This prevents misuse of the API and sets proper expectations about the
handler's capabilities and limitations, leading to better developer
experience and fewer integration issues.
2025-08-07 10:51:21 +02:00
Dmitry Platonov af7e9db838 [doc] Updated streaming response limit to 200 MB (#548)
### Motivation:
AWS Lambda response streaming now supports a default maximum response
payload size of 200 MB (increased from 20 MB). This update aligns the
documentation with the new AWS limits.

### Modifications:
- Updated readme.md: Changed "soft limit of 20 MB" to "default maximum
response payload size of 200 MB"
- Updated Examples/Streaming/README.md: Same change as above
- Updated terminology to match AWS official documentation

### Result:
Documentation now accurately reflects the current AWS Lambda streaming
response limits, enabling users to understand they can stream up to 200
MB payloads.

Reference:
https://aws.amazon.com/about-aws/whats-new/2025/07/aws-lambda-response-streaming-200-mb-payloads/
2025-08-06 13:35:06 +02:00
Sébastien Stormacq a5ff8e5c00 Add hummingbird Lambda example (#544)
Add Hummingbird web framework integration example for AWS Lambda

**Motivation:**
Developers using the Hummingbird web framework need a clear example of
how to integrate it with AWS Lambda. The existing examples focus on
basic Lambda handlers, but don't demonstrate how to use popular Swift
web frameworks like Hummingbird in a serverless context.

**Modifications:**
Added a complete Hummingbird Lambda example in Examples/Hummingbird/
including Package.swift with Hummingbird Lambda dependencies, main.swift
demonstrating router setup with API Gateway V2 integration, SAM template
for deployment, and comprehensive README documentation with build,
deploy, and usage instructions.

**Result:**
Developers can now easily create AWS Lambda functions using the
Hummingbird web framework, with a working example that shows router
configuration, API Gateway integration, and complete deployment workflow
using familiar Hummingbird syntax.
2025-08-05 15:13:13 +02:00
Sébastien Stormacq 447c1e4db1 Remove dependency on DispatchWallTime (fix #384) (#540)
Fix
[#384](https://github.com/swift-server/swift-aws-lambda-runtime/issues/384)

Note: this PR introduces an API change that will break Lambda functions
using `LambdaContext`, we should integrate this change during the beta
otherwise it will require a major version bump.

### Motivation:

`DispatchWallTime` has no public API to extract the time in
milliseconds, making it a dead end.
Previous implementation used the internal representation of time inside
`DispatchWallTime` to extract the value, creating a risk if its
implementation will change in the future.
Moreover, the use of `DispatchWallTime` obliges users to import the
`Dispatch` library or `Foundation`.

Old Code:
```
extension DispatchWallTime {
    @usableFromInline
    init(millisSinceEpoch: Int64) {
        let nanoSinceEpoch = UInt64(millisSinceEpoch) * 1_000_000
        let seconds = UInt64(nanoSinceEpoch / 1_000_000_000)
        let nanoseconds = nanoSinceEpoch - (seconds * 1_000_000_000)
        self.init(timespec: timespec(tv_sec: Int(seconds), tv_nsec: Int(nanoseconds)))
    }

    var millisSinceEpoch: Int64 {
        Int64(bitPattern: self.rawValue) / -1_000_000
    }
}
```

Issue
[#384](https://github.com/swift-server/swift-aws-lambda-runtime/issues/384)
has a long discussion about possible replacements, including creating a
brand new `UTCClock`, which I think is an overkill for this project.

Instead, I propose this simple implementation, based on two assumptions:

- AWS always sends the time in milliseconds since Unix Epoch (1st Jan
1970) ([Lambda Runtime API
documentation](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html#runtimes-api-next))
- AWS always uses UTC time (not only for Lambda, this is a general rule
for all AWS APIs) ([TZ=UTC on
Lambda](https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html))

Therefore, this library just needs to store and make math on
milliseconds since epoch, without having to care about timezone.

I had two possibilities to implement the storage and the math on
milliseconds since Unix Epoch: either I could use an `UInt64` (as does
[the Rust
implementation](https://github.com/awslabs/aws-lambda-rust-runtime/blob/aff8d883c62997ef2615714dce9f7ddfd557147d/lambda-runtime/src/types.rs#L70))
or I could use a standard Swift type, such as `Duration`.

`Duration` is a good candidate for this because 1/ the time we receive
from the Lambda Service API is indeed a duration between 1/1/1970 and
the execution deadline for the Lambda function, expressed in
milliseconds, 2/ it gives a strong type that can be verified by the
compiler, and 3/ it is possible to do basic arithmetic operations and
compare two values.

As an additional benefit, it allows library users to not import
`Dispatch` or `Foundation`

### Modifications:

I made two changes:

1. I extend the `Duration` type to provide us with simple unix epoch
time manipulation functions and values.

```swift
extension Duration {
    /// Returns the time in milliseconds since the Unix epoch.
    @usableFromInline
    static var millisSinceEpoch: Duration {
        var ts = timespec()
        clock_gettime(CLOCK_REALTIME, &ts)
        return .milliseconds(Int64(ts.tv_sec) * 1000 + Int64(ts.tv_nsec) / 1_000_000)
    }

    /// Returns a Duration between Unix epoch and the distant future
    @usableFromInline
    static var distantFuture: Duration {
        // Use a very large value to represent the distant future
        millisSinceEpoch + Duration.seconds(.greatestFiniteMagnitude)
    }

    /// Returns the Duration in milliseconds
    @usableFromInline
    func milliseconds() -> Int64 {
        Int64(self / .milliseconds(1))
    }

    /// Create a Duration from milliseconds since Unix Epoch
    @usableFromInline
    init(millisSinceEpoch: Int64) {
        self = .milliseconds(millisSinceEpoch)
    }
}
```

3. I replaced all references to `DispatchWallTime` by `Duration` 

### Result:

No more `DispatchWallTime`
No dependencies on Foundation, as I use `clock_gettime()` to get the
epoch from the system clock.
2025-08-05 09:12:11 +02:00
Sébastien Stormacq 11bea7b2ee Performance Test the invocation loop (fix #377) (#542)
re-implement MAX_INVOCATIONS and fix shell script 
Fix https://github.com/swift-server/swift-aws-lambda-runtime/issues/377

### Motivation:

In v1, there was a script measuring the performance of the invocation
loop.
Re-instate this script to allow users and developers to measure the
performance impact of their changes.

### Modifications:

I re-implemented MAX_INVOCATIONS, to avoid the client looping against
the Mock Server. But this time, MAX_INVOCATIONS is handled on the
server, not on the client.

I slightly modified the script to work with v2 and the new MockServer.

### Result:

The script works.

This PR has a dependency on
https://github.com/swift-server/swift-aws-lambda-runtime/issues/465
2025-08-05 08:39:20 +02:00
Sébastien Stormacq bae9f27ccb Use a struct for ClientContext (fix #169) (#539)
Do not use a String for Lambdacontext.ClientContext, use a struct instead.
Fix for https://github.com/swift-server/swift-aws-lambda-runtime/issues/169

Note: this PR introduces an API change that will break function using
`LambdaContext`, we should integrate this change during the beta
otherwise it will require a major version bump.

### Motivation:

Let the compiler detect type errors for us

### Modifications:

- Create a struct for ClientContext and it's embedded ClientApplication
- add three unit test to validate the struct 

### Result:

No more String?

---------

Co-authored-by: Konrad `ktoso` Malawski <konrad.malawski@project13.pl>
2025-08-04 08:24:46 +02:00
Natan Rolnik 76c3a441de Fix link (Response Streaming) in readme.md (#543)
When reading about the V2 changes , I noticed that the link for Response
Streaming in the AWS docs was leading to a 404.

A trailing `]` character was the reason - this PR fixes it.
2025-08-03 12:30:17 +00:00
Sébastien Stormacq 0a6af5b4e1 prepare 2.0.0-beta.1 (#538)
Change dependencies in `Examples/*` and documentation to `from:
"2.0.0-beta.1"`
2.0.0-beta.1
2025-07-30 19:08:39 +04:00
Sébastien Stormacq e6ba07fd06 [example] Add example for Swift Service Lifecycle (#522)
Now that task cancellation works, re publishing this PR with a new
example for Swift Service Lifecycle
2025-07-30 06:40:55 +04:00
Sébastien Stormacq 36dadf9c26 [doc] fix header level warnings from CI soundness/doc scripts (#537)
```
note: The majority of content should be under level-3 headers under the "Overview" section
  --> Deployment.md:22:1-22:17
20 |   * [Third-party tools](#third-party-tools)
21 |
22 + ## Prerequisites
   | ╰─suggestion: Change the title to "Overview"
23 |
24 | 1. Your AWS Account

```

and many others.

Action: I lowered all titles one level down.
2025-07-25 20:13:07 +04:00
Sébastien Stormacq 9287d56e60 [core] Implement Lambda streaming with custom HTTP headers (#521)
Fix https://github.com/swift-server/swift-aws-lambda-runtime/issues/520
2025-07-24 15:03:29 +04:00
Sébastien Stormacq 412a345bdd [core] Add user-facing API for Streaming Lambda functions that receive JSON events (#532)
Add user-facing API for Streaming Lambda functions that receives JSON
events

### Motivation:

Streaming Lambda functions developed by developers had no choice but to
implement a handler that receives incoming data as a `ByteBuffer`. While
this is useful for low-level development, I assume most developers will
want to receive a JSON event to trigger their streaming Lambda function.

Going efficiently from a `ByteBuffer` to a Swift struct requires some
code implemented in the `JSON+ByteBuffer.swift` file of the librray. We
propose to further help developers by providing them with a new
`handler()` function that directly receives their `Decodable` type.

### Modifications:

This PR adds a public facing API (+ unit test + updated README) allowing
developers to write a handler method accepting any `Decodable` struct as
input.

```swift
import AWSLambdaRuntime
import NIOCore

// Define your input event structure
struct StreamingRequest: Decodable {
    let count: Int
    let message: String
    let delayMs: Int?
}

// Use the new streaming handler with JSON decoding
let runtime = LambdaRuntime { (event: StreamingRequest, responseWriter, context: LambdaContext) in
    context.logger.info("Received request to send \(event.count) messages")
    
    // Stream the messages
    for i in 1...event.count {
        let response = "Message \(i)/\(event.count): \(event.message)\n"
        try await responseWriter.write(ByteBuffer(string: response))
        
        // Optional delay between messages
        if let delay = event.delayMs, delay > 0 {
            try await Task.sleep(for: .milliseconds(delay))
        }
    }
    
    // Finish the stream
    try await responseWriter.finish()
    
    // Optional: Execute background work after response is sent
    context.logger.info("Background work: processing completed")
}

try await runtime.run()
```

This interface provides:
- **Type-safe JSON input**: Automatic decoding of JSON events into Swift
structs
- **Streaming responses**: Full control over when and how to stream data
back to clients
- **Background work support**: Ability to execute code after the
response stream is finished
- **Familiar API**: Uses the same closure-based pattern as regular
Lambda handlers

Because streaming Lambda functions can be invoked either directly
through the API or through Lambda Function URL, this PR adds the
decoding logic to support both types, shielding developers from working
with Function URL requests and base64 encoding.

We understand these choice will have an impact on the raw performance
for event handling. Those advanced users that want to get the maximum
might use the existing `handler(_ event: ByteBuffer, writer:
LambaStreamingWriter)` function to implement their own custom decoding
logic.

This PR provides a balance between ease of use for 80% of the users vs
ultimate performance, without closing the door for the 20% who need it.

### Result:

Lambda function developers can now use arbitrary `Decodable` Swift
struct or Lambda events to trigger their streaming functions. 🎉

---------

Co-authored-by: Tim Condon <0xTim@users.noreply.github.com>
2025-07-23 19:03:25 +04:00
Sébastien Stormacq f1514b13d1 [core] Add support for streaming function to the local server (#531)
The local server used for testing functions locally (`swift run`) now
support streaming lambda functions

Fix https://github.com/swift-server/swift-aws-lambda-runtime/issues/528
2025-07-23 10:08:14 +04:00
Sébastien Stormacq cb85fdd782 fix [core] trace level shows the first kb of the payload before being decoded (#534)
Add a log statement in the Lambda loop, before calling the user's
handler to show the raw payload before any attempt to decode it.

This was available in Runtime v1 and is now ported to v2.
This fixes
https://github.com/swift-server/swift-aws-lambda-runtime/issues/404

### Motivation:

This is useful when handling custom event and there is a Decoding error.
It allows to see the exact payload received by the handler before any
attempt to decode it.

### Modifications:

Add a log.trace statement with metatadata. Metadata are computed only
when the log level is trace or below.

### Result:

```
2025-07-21T08:58:33+0200 trace LambdaRuntime : Event's first bytes={"name": "me", "age": 50} aws-request-id=769127502334125 [AWSLambdaRuntime] sending invocation event to lambda handler
```

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 07:31:00 +02:00
Sébastien Stormacq db7e7897eb [test] Add a test for cancellable (#529)
- Add a test on `LambdaRuntime` for cancellable.
- Move the service life cycle test to its own file
2025-07-21 15:15:55 +02:00
Sébastien Stormacq e786f2f620 fix: [core] Hard code version number in user agent string (#98) (#533)
Add a hard coded version number to the user agent string, for an
eventual identification by the Lambda service

### Motivation:

It's [an
issue](https://github.com/swift-server/swift-aws-lambda-runtime/issues/108)
that was open more than 5 years ago and was never addressed. At the
time, the consensus was to pickup a version number for the Package.swift
file and the maintainer at the time decided to wait for Swift to
implement this.
Five years later, and several major version of Swift later, this is
still not available. I decided to move on and implement a less optimal
solution. This can be replaced in the future if package version ever
becomes part of Package.swift.

### Modifications:

Add a version enum to isolate the versioning in one place. I decided to
keep it simple and not over engineering it with major, minor, patch and
pre-release. At the time, it's a simple string. This is all what we need
for usage in the user agent string.

### Result:

User agent now identifies as `Swift-Lambda/2,0` instead of
`Swift-Lambda/unknown`
2025-07-21 15:15:02 +02:00
Sébastien Stormacq aa21cb2daa Update dependencies in CDK example (#535)
ran `npm update` to update `package-lock` file

### Motivation:

Should fix a dependabot security alert 

https://github.com/swift-server/swift-aws-lambda-runtime/security/dependabot/7

### Modifications:

just updated `Package-lock.json` file
2025-07-21 09:23:57 +02:00
Sébastien Stormacq dede067fa1 [tests] minor changes, mostly syntaxic (#530)
tiny syntax changes in the test suite
2025-07-12 11:30:04 +02:00
Sébastien Stormacq 4a7d95e4a3 fix: remove unused code in v2 (#427) 2025-07-04 16:41:07 +02:00
Sébastien Stormacq 344d30b401 [core] Only one LambdaRuntime.run() can be called at a time (fix #507) (#508)
This is a proposal to fix issue #507 

**changes**
- `LambdaRuntime.init()` uses a `Mutex<Bool>` to make sure only one
instance is created
- `LambdaRuntime.init()` can now throw an error in case an instance
already exists (I did not use `fatalError()` to make it easier to test)
- All `convenience init()` methods catch possible errors instead of
re-throwing it to a void breaking the user-facing API
- Renamed existing `LambdaRuntimeError` to `LambdaRuntimeClientError`
- Introduced a new type `LambdaRuntimeError` to represent the double
initialization error

---------

Co-authored-by: Fabian Fett <fabianfett@apple.com>
Co-authored-by: Adam Fowler <adamfowler71@gmail.com>
2025-07-04 13:55:58 +00:00
Sébastien Stormacq bf2385ae08 Plugin v2 proposal (#448)
A proposal for a new set of SwiftPM plugins to facilitate the
scaffolding, build, archive, and deployment of Lambda functions.

This is a call for comments to finalize the design before starting an
actual implementation
2025-07-02 14:20:37 +02:00
Sébastien Stormacq de38324789 [core] Give user the possibility to pass their logger to the lambda runtime (#523)
Allow user to give their logger to the LambdaRuntime.

### Motivation:

Overloaded versions of `LambdaRuntime.init` don't allow to pass a logger

### Modifications:

Add a `logger` parameter to overloaded versions of `LambdaRuntime.init`

### Result:

It is now possible to write 

```
        let runtime = LambdaRuntime(logger: Logger(label: "MyLogger"), body: handler)
```
2025-07-01 20:44:59 +02:00
Adam Fowler b2811a5e1a Add support for local server graceful shutdown (#519)
- Add ServiceLifecycle version of `LambdaRuntime.run` that wraps
internal `_run` call in `cancelOnGracefulShutdown`
- Add cancellation handlers for shutting down existing connections in
Local lambda
- Added test for lambda graceful shutdown

### Motivation:

Ensure local lambda supports graceful shutdown
2025-06-29 09:05:15 +02:00
Adam Fowler b3fbee6b58 Add SendableMetatype conformance (#518)
Add SendableMetatype conformance to StreamingLambdaHandler

### Motivation:

Swift 6.2 introduced new protocol SendableMetatype for Types that are
Sendable

### Modifications:

Added `_Lambda_SendableMetatype` typealias for SendableMetatype in Swift
6.2

and 

```swift
public protocol StreamingLambdaHandler: _Lambda_SendableMetatype {
```

### Result:

No more compile warnings
2025-06-28 19:09:51 +02:00
Sébastien Stormacq a616996722 [test] add a unit test for the LambdaHTTPServer Pool (#500) 2025-06-28 14:11:28 +02:00
Sébastien Stormacq 935ea0fe91 Remove dependency on XCTest (#516)
Remove dependency on XCTest

### Motivation:

As 6.1 does not include XCTest anymore, finish the migration to Swift
testing

### Modifications:

Replace XCTest by Swift Testing in two files

### Result:

`swift test` works on 6.1.2

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-28 13:09:44 +02:00
dependabot[bot] 41c5edaf04 Bump aws-cdk-lib from 2.183.0 to 2.189.1 in /Examples/CDK/infra (#514)
Bumps
[aws-cdk-lib](https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk-lib)
from 2.183.0 to 2.189.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/aws/aws-cdk/releases">aws-cdk-lib's
releases</a>.</em></p>
<blockquote>
<h2>v2.189.1</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>core:</strong> implicit Aspect applications do not override
custom Aspect applications (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34132">#34132</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/b7f4bc7aee1d99b70e4d9d3cedea53e910ee37ef">b7f4bc7</a>)</li>
</ul>
<hr />
<h2>Alpha modules (2.189.1-alpha.0)</h2>
<h2>v2.189.0</h2>
<h3>Features</h3>
<ul>
<li><strong>apigatewayv2:</strong> dualstack HTTP and WebSocket API (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34054">#34054</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/eec900e90f38f34f896b22cf36cb225fc9c13cc8">eec900e</a>)</li>
<li>update L1 CloudFormation resource definitions (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34064">#34064</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/9cb260266e92f45e40a19667e29ccf2decb3d2b8">9cb2602</a>)</li>
<li><strong>bedrock:</strong> support Amazon Nova Reel 1.1 (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34070">#34070</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/3da0c4d267dbb693ffc01b9fae69cebcb180cdec">3da0c4d</a>)</li>
<li>support L2 constructs for Amazon S3 Tables (<a
href="https://redirect.github.com/aws/aws-cdk/issues/33599">#33599</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/2e95252fecbb1fec9874fd5af4b4bd6449d50471">2e95252</a>)</li>
<li><strong>pipelines:</strong> add <code>V2</code> pipeline type
support in L3 construct (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34005">#34005</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/994e95289b589596179553a5b9d7201155bd9ed1">994e952</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/33995">#33995</a></li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>codepipeline:</strong> replace account root principal with
pipeline role in trust policy for cross-account actions (under feature
flag) (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34074">#34074</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/2d901f4e7bb982221e1a48a13666939140109d5a">2d901f4</a>)</li>
<li><strong>custom-resources:</strong> <code>AwsCustomResource</code>
assumed role session name may contain invalid characters (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34016">#34016</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/32b6b4d7fa99723efb667239fbe455ede43b92c6">32b6b4d</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/23260">#23260</a>
<a
href="https://redirect.github.com/aws/aws-cdk/issues/34011">#34011</a></li>
</ul>
<hr />
<h2>Alpha modules (2.189.0-alpha.0)</h2>
<h3>Features</h3>
<ul>
<li><strong>ec2-alpha:</strong> implement mapPublicIpOnLaunch prop in
SubnetV2 (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34057">#34057</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/836c5cf3e4c627f817e4dc8ed2af28a5bba54792">836c5cf</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/32159">#32159</a></li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>amplify:</strong> unable to re-run integ test due to missing
<code>status</code> field in <code>customRule</code> (<a
href="https://redirect.github.com/aws/aws-cdk/issues/33973">#33973</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/6638c08d56afe7ecc4f23cff4cf334b887001e5e">6638c08</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/33962">#33962</a></li>
</ul>
<h2>v2.188.0</h2>
<h3>Features</h3>
<ul>
<li>update L1 CloudFormation resource definitions (<a
href="https://redirect.github.com/aws/aws-cdk/issues/33980">#33980</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/0923b5e82dd0c8da864f0c806f295fae270c22c1">0923b5e</a>)</li>
<li>update L1 CloudFormation resource definitions (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34029">#34029</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/be6210f246b97befcdc9446862e991071738008d">be6210f</a>)</li>
<li><strong>codepipeline:</strong> add usePipelineRoleForActions field
support in L2 (<a
href="https://redirect.github.com/aws/aws-cdk/issues/33961">#33961</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/d8bbc1c3f8479ab5031b8684364735b9a6c31fa2">d8bbc1c</a>)</li>
<li><strong>codepipeline-actions:</strong> support
<code>ECRBuildAndPublish</code> action (<a
href="https://redirect.github.com/aws/aws-cdk/issues/33375">#33375</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/c5cd679b2f979b9e51c7a071b18d930d3a475129">c5cd679</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/33376">#33376</a></li>
<li><strong>codepipeline-actions:</strong> support
<code>InspectorEcrImageScanAction</code> and
<code>InspectorSourceCodeScanAction</code> actions (<a
href="https://redirect.github.com/aws/aws-cdk/issues/33378">#33378</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/2dc8cc7f703ebcd61f2b5f4d20401a1ade788e7a">2dc8cc7</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/33377">#33377</a></li>
<li><strong>cognito:</strong> v3.0 pre token generation trigger event
(<a
href="https://redirect.github.com/aws/aws-cdk/issues/33778">#33778</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/ea1436f85d036bddb9a96dd54f02a639c3aab212">ea1436f</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/33733">#33733</a></li>
<li><strong>events-targets:</strong> support ApiGatewayV2 HttpApi (<a
href="https://redirect.github.com/aws/aws-cdk/issues/33864">#33864</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/91a3076fb16369629a710ebc560c103a91c2ea20">91a3076</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/26649">#26649</a></li>
<li><strong>kinesisfirehose:</strong> support S3 file extension format
(<a
href="https://redirect.github.com/aws/aws-cdk/issues/33776">#33776</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/e314a9aa5d149704cc2abd30927a41d317a3ce6c">e314a9a</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/32154">#32154</a></li>
<li><strong>logs-destinations:</strong> support Amazon Data Firehose
logs destination (<a
href="https://redirect.github.com/aws/aws-cdk/issues/33683">#33683</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/a8edf696e91c44cbda286889896464960dd03266">a8edf69</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/32038">#32038</a>
<a
href="https://redirect.github.com/aws/aws-cdk/issues/24766">#24766</a></li>
<li><strong>pipelines:</strong> actions can default to the pipeline
service role instead of a newly created role (<a
href="https://redirect.github.com/aws/aws-cdk/issues/33991">#33991</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/2ebc51e694e85aa0d8e0401dbb1fc1037298eda5">2ebc51e</a>)</li>
<li><strong>rds:</strong> engine lifecycle support (<a
href="https://redirect.github.com/aws/aws-cdk/issues/33902">#33902</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/c0f8d293df157cd196e2bd9fb569374d0535f471">c0f8d29</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/33859">#33859</a></li>
</ul>
<h3>Bug Fixes</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/aws/aws-cdk/blob/main/CHANGELOG.v2.alpha.md">aws-cdk-lib's
changelog</a>.</em></p>
<blockquote>
<h1>Changelog</h1>
<p>All notable changes to this project will be documented in this file.
See <a
href="https://github.com/conventional-changelog/standard-version">standard-version</a>
for commit guidelines.</p>
<h2><a
href="https://github.com/aws/aws-cdk/compare/v2.198.0-alpha.0...v2.199.0-alpha.0">2.199.0-alpha.0</a>
(2025-05-27)</h2>
<h2><a
href="https://github.com/aws/aws-cdk/compare/v2.197.0-alpha.0...v2.198.0-alpha.0">2.198.0-alpha.0</a>
(2025-05-22)</h2>
<h3>⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES</h3>
<ul>
<li><strong>amplify:</strong> A compute role is created when
<code>platform</code> is <code>Platform.WEB_COMPUTE</code> or
<code>Platform.WEB_DYNAMIC</code>.</li>
</ul>
<h3>Features</h3>
<ul>
<li><strong>amplify:</strong> add compute role support for Amplify app
(<a
href="https://redirect.github.com/aws/aws-cdk/issues/33962">#33962</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/7490b921aa2c464e32ad27064fa4b84571d5ba1a">7490b92</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/33882">#33882</a></li>
<li><strong>ec2:</strong> add i7i instance class (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34453">#34453</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/3fe8ab4bb100e23042f3d55d4a52bfc8cdbf495a">3fe8ab4</a>)</li>
</ul>
<h2><a
href="https://github.com/aws/aws-cdk/compare/v2.196.1-alpha.0...v2.197.0-alpha.0">2.197.0-alpha.0</a>
(2025-05-20)</h2>
<h2><a
href="https://github.com/aws/aws-cdk/compare/v2.196.0-alpha.0...v2.196.1-alpha.0">2.196.1-alpha.0</a>
(2025-05-19)</h2>
<h2><a
href="https://github.com/aws/aws-cdk/compare/v2.195.0-alpha.0...v2.196.0-alpha.0">2.196.0-alpha.0</a>
(2025-05-15)</h2>
<h3>Features</h3>
<ul>
<li><strong>msk:</strong> support Kafka versions 3.9.x and 3.9.x Kraft
(<a
href="https://redirect.github.com/aws/aws-cdk/issues/34213">#34213</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/a1226db3164f885ab1bbf13a18697831cfde74d0">a1226db</a>)</li>
<li><strong>pipes-targets:</strong> add SNS (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34159">#34159</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/2f846b395cc5061363bd6def946a04740ac0139b">2f846b3</a>)</li>
<li><strong>s3tables:</strong> server-side encryption by customer
managed KMS key (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34229">#34229</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/488f0db714c20fcaf5dbdf682277a70c6a938d3f">488f0db</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>ec2:</strong> dual-stack vpc without private subnets creates
EgressOnlyInternetGateway (under feature flag) (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34437">#34437</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/35e818b4f86638b5fe6074705511d1eee16266d2">35e818b</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/30981">#30981</a></li>
<li><strong>ec2-alpha:</strong> fix resource id references and tags for
migration behind feature flag (<a
href="https://redirect.github.com/aws/aws-cdk/issues/34377">#34377</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/aa735341a8e95224a14241b5e1c5c5ba71de5022">aa73534</a>)</li>
</ul>
<h2><a
href="https://github.com/aws/aws-cdk/compare/v2.194.0-alpha.0...v2.195.0-alpha.0">2.195.0-alpha.0</a>
(2025-05-07)</h2>
<h3>⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES</h3>
<ul>
<li><strong>iot:</strong> By default,
<code>deviceDertificateAgeCheck</code> is automatically enabled.</li>
</ul>
<h3>Features</h3>
<ul>
<li><strong>iot:</strong> device certificate age check audit
configuration (<a
href="https://redirect.github.com/aws/aws-cdk/issues/33816">#33816</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/9ad383d5300c5d5f5a9d2552fbd541436570a404">9ad383d</a>)</li>
<li><strong>location:</strong> support L2 API Key Construct (<a
href="https://redirect.github.com/aws/aws-cdk/issues/32733">#32733</a>)
(<a
href="https://github.com/aws/aws-cdk/commit/d86787889dd49dce220324d141bf48e1bfa8fc3b">d867878</a>),
closes <a
href="https://redirect.github.com/aws/aws-cdk/issues/30684">#30684</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/aws/aws-cdk/commit/e7432ee4f8ae6f4ba000b1c1833188dddeb15624"><code>e7432ee</code></a>
chore(release): 2.189.1</li>
<li><a
href="https://github.com/aws/aws-cdk/commit/b7f4bc7aee1d99b70e4d9d3cedea53e910ee37ef"><code>b7f4bc7</code></a>
fix(core): implicit Aspect applications do not override custom Aspect
applica...</li>
<li><a
href="https://github.com/aws/aws-cdk/commit/dcd077fb04f6900fd92e127d92a777cc38cdf932"><code>dcd077f</code></a>
chore: update analytics metadata blueprints</li>
<li><a
href="https://github.com/aws/aws-cdk/commit/b997bf125f0782d37fb8c99db0e0be09f4b10295"><code>b997bf1</code></a>
chore(release): 2.189.0</li>
<li><a
href="https://github.com/aws/aws-cdk/commit/eec900e90f38f34f896b22cf36cb225fc9c13cc8"><code>eec900e</code></a>
feat(apigatewayv2): dualstack HTTP and WebSocket API (<a
href="https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk-lib/issues/34054">#34054</a>)</li>
<li><a
href="https://github.com/aws/aws-cdk/commit/9cb260266e92f45e40a19667e29ccf2decb3d2b8"><code>9cb2602</code></a>
feat: update L1 CloudFormation resource definitions (<a
href="https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk-lib/issues/34064">#34064</a>)</li>
<li><a
href="https://github.com/aws/aws-cdk/commit/2d901f4e7bb982221e1a48a13666939140109d5a"><code>2d901f4</code></a>
fix(codepipeline): replace account root principal with pipeline role in
trust...</li>
<li><a
href="https://github.com/aws/aws-cdk/commit/3da0c4d267dbb693ffc01b9fae69cebcb180cdec"><code>3da0c4d</code></a>
feat(bedrock): support Amazon Nova Reel 1.1 (<a
href="https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk-lib/issues/34070">#34070</a>)</li>
<li><a
href="https://github.com/aws/aws-cdk/commit/b1e8879a800850efb130cb8aaaef596195de56f9"><code>b1e8879</code></a>
docs(pipelines): add link to developer guide on how to use docker
drop-in rep...</li>
<li><a
href="https://github.com/aws/aws-cdk/commit/1b98a41853c17dcce53c5bb7074011c8dd928fb3"><code>1b98a41</code></a>
docs(batch): add note on update fatgate compute environment (<a
href="https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk-lib/issues/34022">#34022</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/aws/aws-cdk/commits/v2.189.1/packages/aws-cdk-lib">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=aws-cdk-lib&package-manager=npm_and_yarn&previous-version=2.183.0&new-version=2.189.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/swift-server/swift-aws-lambda-runtime/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sébastien Stormacq <sebastien.stormacq@gmail.com>
2025-06-01 18:56:19 +02:00