serverless-offline 12.0.0 → 12.0.2
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": "12.0.
|
|
4
|
+
"version": "12.0.2",
|
|
5
5
|
"description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"exports": {
|
|
@@ -82,13 +82,13 @@
|
|
|
82
82
|
]
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@aws-sdk/client-lambda": "^3.
|
|
85
|
+
"@aws-sdk/client-lambda": "^3.226.0",
|
|
86
86
|
"@hapi/boom": "^10.0.0",
|
|
87
87
|
"@hapi/h2o2": "^10.0.0",
|
|
88
88
|
"@hapi/hapi": "^21.1.0",
|
|
89
89
|
"@serverless/utils": "^6.8.2",
|
|
90
90
|
"boxen": "^7.0.0",
|
|
91
|
-
"chalk": "^5.
|
|
91
|
+
"chalk": "^5.2.0",
|
|
92
92
|
"execa": "^6.1.0",
|
|
93
93
|
"fs-extra": "^11.1.0",
|
|
94
94
|
"is-wsl": "^2.2.0",
|
|
@@ -110,17 +110,17 @@
|
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@istanbuljs/esm-loader-hook": "^0.2.0",
|
|
112
112
|
"archiver": "^5.3.1",
|
|
113
|
-
"eslint": "^8.
|
|
113
|
+
"eslint": "^8.29.0",
|
|
114
114
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
115
115
|
"eslint-config-prettier": "^8.5.0",
|
|
116
116
|
"eslint-plugin-import": "^2.25.4",
|
|
117
117
|
"eslint-plugin-prettier": "^4.2.1",
|
|
118
118
|
"git-list-updated": "^1.2.1",
|
|
119
119
|
"husky": "^8.0.2",
|
|
120
|
-
"lint-staged": "^13.0
|
|
121
|
-
"mocha": "^10.
|
|
120
|
+
"lint-staged": "^13.1.0",
|
|
121
|
+
"mocha": "^10.2.0",
|
|
122
122
|
"nyc": "^15.1.0",
|
|
123
|
-
"prettier": "^2.8.
|
|
123
|
+
"prettier": "^2.8.1",
|
|
124
124
|
"serverless": "^3.25.1",
|
|
125
125
|
"standard-version": "^9.5.0"
|
|
126
126
|
},
|
|
@@ -22,8 +22,6 @@ export default class HttpServer {
|
|
|
22
22
|
|
|
23
23
|
#server = null
|
|
24
24
|
|
|
25
|
-
#lastRequestOptions = null
|
|
26
|
-
|
|
27
25
|
#terminalInfo = []
|
|
28
26
|
|
|
29
27
|
constructor(serverless, options, lambda) {
|
|
@@ -140,7 +138,7 @@ export default class HttpServer {
|
|
|
140
138
|
}
|
|
141
139
|
|
|
142
140
|
async start() {
|
|
143
|
-
const {
|
|
141
|
+
const { albPort, host, httpsProtocol } = this.#options
|
|
144
142
|
|
|
145
143
|
try {
|
|
146
144
|
await this.#server.start()
|
|
@@ -172,13 +170,6 @@ export default class HttpServer {
|
|
|
172
170
|
const { functionKey, method, stage } = params
|
|
173
171
|
|
|
174
172
|
return async (request, h) => {
|
|
175
|
-
this.#lastRequestOptions = {
|
|
176
|
-
headers: request.headers,
|
|
177
|
-
method: request.method,
|
|
178
|
-
payload: request.payload,
|
|
179
|
-
url: request.url.href,
|
|
180
|
-
}
|
|
181
|
-
|
|
182
173
|
const requestPath = this.#options.noPrependStageInUrl
|
|
183
174
|
? request.path
|
|
184
175
|
: request.path.substr(`/${stage}`.length)
|
|
@@ -247,12 +238,10 @@ export default class HttpServer {
|
|
|
247
238
|
|
|
248
239
|
let statusCode = 200
|
|
249
240
|
|
|
250
|
-
if (err) {
|
|
251
|
-
statusCode = errorStatusCode
|
|
252
|
-
}
|
|
253
|
-
|
|
254
241
|
if (result && !result.errorType) {
|
|
255
242
|
statusCode = result.statusCode || 200
|
|
243
|
+
} else if (err) {
|
|
244
|
+
statusCode = errorStatusCode || 502
|
|
256
245
|
} else {
|
|
257
246
|
statusCode = 502
|
|
258
247
|
}
|
|
@@ -324,7 +313,11 @@ export default class HttpServer {
|
|
|
324
313
|
})
|
|
325
314
|
|
|
326
315
|
const hapiMethod = method === 'ANY' ? '*' : method
|
|
327
|
-
const hapiOptions = {
|
|
316
|
+
const hapiOptions = {
|
|
317
|
+
response: {
|
|
318
|
+
emptyStatusCode: 200,
|
|
319
|
+
},
|
|
320
|
+
}
|
|
328
321
|
|
|
329
322
|
// skip HEAD routes as hapi will fail with 'Method name not allowed: HEAD ...'
|
|
330
323
|
// for more details, check https://github.com/dherault/serverless-offline/issues/204
|
|
@@ -828,6 +828,8 @@ export default class HttpServer {
|
|
|
828
828
|
|
|
829
829
|
if (result && !result.errorType) {
|
|
830
830
|
statusCode = result.statusCode || 200
|
|
831
|
+
} else if (err) {
|
|
832
|
+
statusCode = errorStatusCode || 502
|
|
831
833
|
} else {
|
|
832
834
|
statusCode = 502
|
|
833
835
|
}
|
|
@@ -1043,6 +1045,9 @@ export default class HttpServer {
|
|
|
1043
1045
|
const hapiOptions = {
|
|
1044
1046
|
auth: authStrategyName,
|
|
1045
1047
|
cors,
|
|
1048
|
+
response: {
|
|
1049
|
+
emptyStatusCode: 200,
|
|
1050
|
+
},
|
|
1046
1051
|
state,
|
|
1047
1052
|
timeout: {
|
|
1048
1053
|
socket: false,
|
|
@@ -1199,7 +1204,9 @@ export default class HttpServer {
|
|
|
1199
1204
|
}
|
|
1200
1205
|
|
|
1201
1206
|
if (hapiMethod !== 'GET' && hapiMethod !== 'HEAD') {
|
|
1202
|
-
hapiOptions.payload = {
|
|
1207
|
+
hapiOptions.payload = {
|
|
1208
|
+
parse: false,
|
|
1209
|
+
}
|
|
1203
1210
|
}
|
|
1204
1211
|
|
|
1205
1212
|
log.notice(`${method} ${hapiPath} -> ${proxyUriInUse}`)
|
|
@@ -280,7 +280,7 @@ export default class LambdaFunction {
|
|
|
280
280
|
async #timeoutAndTerminate() {
|
|
281
281
|
await setTimeoutPromise(this.#timeout)
|
|
282
282
|
|
|
283
|
-
throw new LambdaTimeoutError('Lambda timeout.')
|
|
283
|
+
throw new LambdaTimeoutError('[504] - Lambda timeout.')
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
async runHandler() {
|