Skip to content

Commit

Permalink
fix: Lambda timeout status code (#1620)
Browse files Browse the repository at this point in the history
  • Loading branch information
DorianMazur committed Dec 6, 2022
1 parent 55101d3 commit 56d986b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/events/alb/HttpServer.js
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions src/events/http/HttpServer.js
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion src/lambda/LambdaFunction.js
Expand Up @@ -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() {
Expand Down

0 comments on commit 56d986b

Please sign in to comment.