File tree Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ private enum LocalLambda {
149
149
Self . invocations. append ( invocation)
150
150
}
151
151
// /next endpoint is called by the lambda polling for work
152
- case ( . GET, let url) where url. hasSuffix ( Consts . requestWorkURLSuffix ) :
152
+ case ( . GET, let url) where url. hasSuffix ( Consts . getNextInvocationURLSuffix ) :
153
153
// check if our server is in the correct state
154
154
guard case . waitingForLambdaRequest = Self . invocationState else {
155
155
self . logger. error ( " invalid invocation state \( Self . invocationState) " )
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ extension Lambda {
46
46
func run( logger: Logger , handler: Handler ) -> EventLoopFuture < Void > {
47
47
logger. debug ( " lambda invocation sequence starting " )
48
48
// 1. request work from lambda runtime engine
49
- return self . runtimeClient. requestWork ( logger: logger) . peekError { error in
49
+ return self . runtimeClient. getNextInvocation ( logger: logger) . peekError { error in
50
50
logger. error ( " could not fetch work from lambda runtime engine: \( error) " )
51
51
} . flatMap { invocation, payload in
52
52
// 2. send invocation to handler
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import Dispatch
16
16
import NIO
17
17
18
18
internal enum Consts {
19
- private static let apiPrefix = " /2018-06-01 "
19
+ static let apiPrefix = " /2018-06-01 "
20
20
static let invocationURLPrefix = " \( apiPrefix) /runtime/invocation "
21
21
static let getNextInvocationURLSuffix = " /next "
22
22
static let postResponseURLSuffix = " /response "
Original file line number Diff line number Diff line change 12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
- import AWSLambdaRuntimeCore
15
+ import AWSLambdaRuntime
16
16
import NIO
17
17
18
18
// in this example we are receiving and responding with strings
@@ -26,7 +26,10 @@ struct Handler: EventLoopLambdaHandler {
26
26
}
27
27
}
28
28
29
- Lambda . run ( Handler ( ) )
29
+
30
+ try Lambda . withLocalServer {
31
+ Lambda . run ( Handler ( ) )
32
+ }
30
33
31
34
// MARK: - this can also be expressed as a closure:
32
35
You can’t perform that action at this time.
0 commit comments