serverless-offline 9.1.3 → 9.1.6
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dedicatedTo": "Blue, a great migrating bird.",
|
|
3
3
|
"name": "serverless-offline",
|
|
4
|
-
"version": "9.1.
|
|
4
|
+
"version": "9.1.6",
|
|
5
5
|
"description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "./src/index.js",
|
|
@@ -194,7 +194,8 @@
|
|
|
194
194
|
"@hapi/boom": "^10.0.0",
|
|
195
195
|
"@hapi/h2o2": "^9.1.0",
|
|
196
196
|
"@hapi/hapi": "^20.2.2",
|
|
197
|
-
"
|
|
197
|
+
"@serverless/utils": "^6.7.0",
|
|
198
|
+
"aws-sdk": "^2.1187.0",
|
|
198
199
|
"boxen": "^7.0.0",
|
|
199
200
|
"chalk": "^5.0.1",
|
|
200
201
|
"execa": "^6.1.0",
|
|
@@ -204,7 +205,7 @@
|
|
|
204
205
|
"jsonpath-plus": "^7.0.0",
|
|
205
206
|
"jsonschema": "^1.4.1",
|
|
206
207
|
"jsonwebtoken": "^8.5.1",
|
|
207
|
-
"jszip": "^3.10.
|
|
208
|
+
"jszip": "^3.10.1",
|
|
208
209
|
"luxon": "^3.0.1",
|
|
209
210
|
"node-fetch": "^3.2.10",
|
|
210
211
|
"node-schedule": "^2.1.0",
|
|
@@ -230,7 +231,6 @@
|
|
|
230
231
|
"standard-version": "^9.5.0"
|
|
231
232
|
},
|
|
232
233
|
"peerDependencies": {
|
|
233
|
-
"@serverless/utils": "^6.7.0",
|
|
234
234
|
"serverless": "^3.2.0"
|
|
235
235
|
}
|
|
236
236
|
}
|
|
@@ -79,11 +79,16 @@ export default class HttpServer {
|
|
|
79
79
|
},
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
//
|
|
82
|
+
// https support
|
|
83
83
|
if (typeof httpsProtocol === 'string' && httpsProtocol.length > 0) {
|
|
84
|
+
const [cert, key] = await Promise.all([
|
|
85
|
+
readFile(resolve(httpsProtocol, 'cert.pem'), 'utf-8'),
|
|
86
|
+
readFile(resolve(httpsProtocol, 'key.pem'), 'utf-8'),
|
|
87
|
+
])
|
|
88
|
+
|
|
84
89
|
serverOptions.tls = {
|
|
85
|
-
cert
|
|
86
|
-
key
|
|
90
|
+
cert,
|
|
91
|
+
key,
|
|
87
92
|
}
|
|
88
93
|
}
|
|
89
94
|
|
|
@@ -103,7 +108,9 @@ export default class HttpServer {
|
|
|
103
108
|
? request.response.output
|
|
104
109
|
: request.response
|
|
105
110
|
|
|
106
|
-
const explicitlySetHeaders = {
|
|
111
|
+
const explicitlySetHeaders = {
|
|
112
|
+
...response.headers,
|
|
113
|
+
}
|
|
107
114
|
|
|
108
115
|
if (
|
|
109
116
|
this.#serverless.service.provider.httpApi &&
|
|
@@ -146,7 +146,10 @@ export default class LambdaProxyIntegrationEvent {
|
|
|
146
146
|
const httpMethod = method.toUpperCase()
|
|
147
147
|
const requestTime = formatToClfTime(received)
|
|
148
148
|
const requestTimeEpoch = received
|
|
149
|
-
|
|
149
|
+
// NOTE replace * added by generateHapiPath util so api gateway event is accurate
|
|
150
|
+
const resource =
|
|
151
|
+
this.#routeKey ||
|
|
152
|
+
route.path.replace(`/${this.#stage}`, '').replace('*', '+')
|
|
150
153
|
|
|
151
154
|
return {
|
|
152
155
|
body,
|
|
@@ -41,19 +41,6 @@ export default class ChildProcessRunner {
|
|
|
41
41
|
},
|
|
42
42
|
)
|
|
43
43
|
|
|
44
|
-
let message
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
message = new Promise((res, rej) => {
|
|
48
|
-
childProcess.on('message', (data) => {
|
|
49
|
-
if (data.error) rej(data.error)
|
|
50
|
-
else res(data)
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
} finally {
|
|
54
|
-
childProcess.kill()
|
|
55
|
-
}
|
|
56
|
-
|
|
57
44
|
childProcess.send({
|
|
58
45
|
context,
|
|
59
46
|
event,
|
|
@@ -63,12 +50,21 @@ export default class ChildProcessRunner {
|
|
|
63
50
|
let result
|
|
64
51
|
|
|
65
52
|
try {
|
|
66
|
-
result = await
|
|
53
|
+
result = await new Promise((res, rej) => {
|
|
54
|
+
childProcess.on('message', (data) => {
|
|
55
|
+
if (data.error) {
|
|
56
|
+
rej(data.error)
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
res(data)
|
|
60
|
+
})
|
|
61
|
+
})
|
|
67
62
|
} catch (err) {
|
|
68
63
|
// TODO
|
|
69
64
|
log.error(err)
|
|
70
|
-
|
|
71
65
|
throw err
|
|
66
|
+
} finally {
|
|
67
|
+
childProcess.kill()
|
|
72
68
|
}
|
|
73
69
|
|
|
74
70
|
return result
|