Skip to content

Commit 56d986b

Browse files
authored
fix: Lambda timeout status code (#1620)
1 parent 55101d3 commit 56d986b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/events/alb/HttpServer.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,10 @@ export default class HttpServer {
247247

248248
let statusCode = 200
249249

250-
if (err) {
251-
statusCode = errorStatusCode
252-
}
253-
254250
if (result && !result.errorType) {
255251
statusCode = result.statusCode || 200
252+
} else if (err) {
253+
statusCode = errorStatusCode || 502
256254
} else {
257255
statusCode = 502
258256
}

src/events/http/HttpServer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,8 @@ export default class HttpServer {
828828

829829
if (result && !result.errorType) {
830830
statusCode = result.statusCode || 200
831+
} else if (err) {
832+
statusCode = errorStatusCode || 502
831833
} else {
832834
statusCode = 502
833835
}

src/lambda/LambdaFunction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ export default class LambdaFunction {
280280
async #timeoutAndTerminate() {
281281
await setTimeoutPromise(this.#timeout)
282282

283-
throw new LambdaTimeoutError('Lambda timeout.')
283+
throw new LambdaTimeoutError('[504] - Lambda timeout.')
284284
}
285285

286286
async runHandler() {

0 commit comments

Comments
 (0)