Skip to content

Commit

Permalink
fix: Lambda timeout status code (#1620)
Browse files Browse the repository at this point in the history
DorianMazur authored Dec 6, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 55101d3 commit 56d986b
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/events/alb/HttpServer.js
Original file line number Diff line number Diff line change
@@ -247,12 +247,10 @@ export default class HttpServer {

let statusCode = 200

if (err) {
statusCode = errorStatusCode
}

if (result && !result.errorType) {
statusCode = result.statusCode || 200
} else if (err) {
statusCode = errorStatusCode || 502
} else {
statusCode = 502
}
2 changes: 2 additions & 0 deletions src/events/http/HttpServer.js
Original file line number Diff line number Diff line change
@@ -828,6 +828,8 @@ export default class HttpServer {

if (result && !result.errorType) {
statusCode = result.statusCode || 200
} else if (err) {
statusCode = errorStatusCode || 502
} else {
statusCode = 502
}
2 changes: 1 addition & 1 deletion src/lambda/LambdaFunction.js
Original file line number Diff line number Diff line change
@@ -280,7 +280,7 @@ export default class LambdaFunction {
async #timeoutAndTerminate() {
await setTimeoutPromise(this.#timeout)

throw new LambdaTimeoutError('Lambda timeout.')
throw new LambdaTimeoutError('[504] - Lambda timeout.')
}

async runHandler() {

0 comments on commit 56d986b

Please sign in to comment.