serverless-offline 9.3.0 → 9.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -4
- package/src/config/supportedRuntimes.js +5 -5
- package/src/lambda/LambdaFunction.js +2 -2
- package/src/lambda/LambdaFunctionPool.js +6 -5
- package/src/lambda/handler-runner/in-process-runner/InProcessRunner.js +0 -5
- package/src/lambda/handler-runner/ruby-runner/RubyRunner.js +1 -5
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dedicatedTo": "Blue, a great migrating bird.",
|
|
3
3
|
"name": "serverless-offline",
|
|
4
|
-
"version": "9.3.
|
|
4
|
+
"version": "9.3.1",
|
|
5
5
|
"description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"main": "./src/index.js",
|
|
8
7
|
"exports": "./src/index.js",
|
|
9
8
|
"type": "module",
|
|
10
9
|
"scripts": {
|
|
@@ -189,7 +188,7 @@
|
|
|
189
188
|
"@hapi/h2o2": "^9.1.0",
|
|
190
189
|
"@hapi/hapi": "^20.2.2",
|
|
191
190
|
"@serverless/utils": "^6.7.0",
|
|
192
|
-
"aws-sdk": "^2.
|
|
191
|
+
"aws-sdk": "^2.1205.0",
|
|
193
192
|
"boxen": "^7.0.0",
|
|
194
193
|
"chalk": "^5.0.1",
|
|
195
194
|
"execa": "^6.1.0",
|
|
@@ -200,7 +199,7 @@
|
|
|
200
199
|
"jsonschema": "^1.4.1",
|
|
201
200
|
"jsonwebtoken": "^8.5.1",
|
|
202
201
|
"jszip": "^3.10.1",
|
|
203
|
-
"luxon": "3.0.
|
|
202
|
+
"luxon": "^3.0.3",
|
|
204
203
|
"node-fetch": "^3.2.10",
|
|
205
204
|
"node-schedule": "^2.1.0",
|
|
206
205
|
"object.hasown": "^1.1.1",
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
|
|
3
3
|
|
|
4
4
|
// .NET CORE
|
|
5
|
-
export const supportedDotnetcore = new Set([
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
])
|
|
5
|
+
// export const supportedDotnetcore = new Set([
|
|
6
|
+
// 'dotnet6',
|
|
7
|
+
// 'dotnetcore3.1',
|
|
8
|
+
// ])
|
|
9
9
|
|
|
10
10
|
// GO
|
|
11
11
|
export const supportedGo = new Set(['go1.x'])
|
|
@@ -37,7 +37,7 @@ export const supportedRuby = new Set(['ruby2.7'])
|
|
|
37
37
|
// deprecated runtimes
|
|
38
38
|
// https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html
|
|
39
39
|
export const supportedRuntimes = new Set([
|
|
40
|
-
...supportedDotnetcore,
|
|
40
|
+
// ...supportedDotnetcore,
|
|
41
41
|
...supportedGo,
|
|
42
42
|
...supportedJava,
|
|
43
43
|
...supportedNodejs,
|
|
@@ -266,8 +266,8 @@ export default class LambdaFunction {
|
|
|
266
266
|
this.#initialized = true
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
get
|
|
270
|
-
return
|
|
269
|
+
get idleTimeInMillis() {
|
|
270
|
+
return performance.now() - this.#idleTimeStarted
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
get functionName() {
|
|
@@ -20,19 +20,20 @@ export default class LambdaFunctionPool {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
#startCleanTimer() {
|
|
23
|
+
const functionCleanupIdleTimeInMillis =
|
|
24
|
+
this.#options.functionCleanupIdleTimeSeconds * 1000
|
|
25
|
+
|
|
23
26
|
// NOTE: don't use setInterval, as it would schedule always a new run,
|
|
24
27
|
// regardless of function processing time and e.g. user action (debugging)
|
|
25
28
|
this.#timerRef = setTimeout(() => {
|
|
26
29
|
// console.log('run cleanup')
|
|
27
30
|
this.#pool.forEach((lambdaFunctions) => {
|
|
28
31
|
lambdaFunctions.forEach((lambdaFunction) => {
|
|
29
|
-
const {
|
|
30
|
-
// console.log(idleTimeInMinutes, status)
|
|
32
|
+
const { idleTimeInMillis, status } = lambdaFunction
|
|
31
33
|
|
|
32
34
|
if (
|
|
33
35
|
status === 'IDLE' &&
|
|
34
|
-
|
|
35
|
-
this.#options.functionCleanupIdleTimeSeconds / 60
|
|
36
|
+
idleTimeInMillis >= functionCleanupIdleTimeInMillis
|
|
36
37
|
) {
|
|
37
38
|
// console.log(`removed Lambda Function ${lambdaFunction.functionName}`)
|
|
38
39
|
lambdaFunction.cleanup()
|
|
@@ -43,7 +44,7 @@ export default class LambdaFunctionPool {
|
|
|
43
44
|
|
|
44
45
|
// schedule new timer
|
|
45
46
|
this.#startCleanTimer()
|
|
46
|
-
},
|
|
47
|
+
}, functionCleanupIdleTimeInMillis)
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
#cleanupPool() {
|
|
@@ -86,11 +86,6 @@ export default class InProcessRunner {
|
|
|
86
86
|
// no try/catch so that errors bubble up and are logged with root stack traces
|
|
87
87
|
const result = handler(event, lambdaContext, callback)
|
|
88
88
|
|
|
89
|
-
// // not a Promise, which is not supported by aws
|
|
90
|
-
// if (result == null || typeof result.then !== 'function') {
|
|
91
|
-
// throw new Error(`Synchronous function execution is not supported.`)
|
|
92
|
-
// }
|
|
93
|
-
|
|
94
89
|
const responses = [callbackWrapper]
|
|
95
90
|
|
|
96
91
|
// Promise was returned
|
|
@@ -83,7 +83,7 @@ export default class RubyRunner {
|
|
|
83
83
|
|
|
84
84
|
// console.log(input)
|
|
85
85
|
|
|
86
|
-
const
|
|
86
|
+
const { stderr, stdout } = await execa(
|
|
87
87
|
runtime,
|
|
88
88
|
[
|
|
89
89
|
resolve(__dirname, 'invoke.rb'),
|
|
@@ -97,10 +97,6 @@ export default class RubyRunner {
|
|
|
97
97
|
},
|
|
98
98
|
)
|
|
99
99
|
|
|
100
|
-
const result = await ruby
|
|
101
|
-
|
|
102
|
-
const { stderr, stdout } = result
|
|
103
|
-
|
|
104
100
|
if (stderr) {
|
|
105
101
|
// TODO
|
|
106
102
|
|