Skip to content

Commit a1337a3

Browse files
committed
fix compilation error for local server in release mode
1 parent 40d7769 commit a1337a3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Sources/AWSLambdaRuntimeCore/Lambda+LocalServer.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
// commented out as long as we have a fix for Swift 6 language mode CI
16-
1715
#if DEBUG
1816
import Dispatch
1917
import Logging

Sources/AWSLambdaRuntimeCore/LambdaRuntime.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ public final class LambdaRuntime<Handler>: @unchecked Sendable where Handler: St
7676

7777
} else {
7878

79-
// we're not running on Lambda, let's start a local server for testing
79+
#if DEBUG
80+
// we're not running on Lambda and we're compiled in DEBUG mode,
81+
// let's start a local server for testing
8082
try await Lambda.withLocalServer(invocationEndpoint: Lambda.env("LOCAL_LAMBDA_SERVER_INVOCATION_ENDPOINT"))
8183
{
8284

@@ -92,6 +94,10 @@ public final class LambdaRuntime<Handler>: @unchecked Sendable where Handler: St
9294
)
9395
}
9496
}
97+
#else
98+
// in release mode, we can't start a local server because the local server code is not compiled.
99+
throw LambdaRuntimeError(code: .missingLambdaRuntimeAPIEnvironmentVariable)
100+
#endif
95101
}
96102
}
97103
}

0 commit comments

Comments
 (0)