From 660e0b3a8f4812e0ffd8ebdd80ca3adbc6db874c Mon Sep 17 00:00:00 2001 From: Joey van Dijk Date: Thu, 8 Jun 2017 10:36:36 +0200 Subject: [PATCH] Support "Task timed out" warnings as HTTP 504-errors Currently if Lambda functions have a timeout then you will not see any errors in Cloudwatch, while the user gets a 200 http response code with `{ errorMessage: 'Task timed out in 10.0 s'}`. This change will show 5XX errors in Cloudwatch. To support this I need to copy all the default patterns in `serverless.yml` per function, so therefore I think this need to be a default setting, while this is not caused by the Serverless(/our) code but by AWS Lambda itself. --- .../aws/package/compile/events/apiGateway/lib/validate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins/aws/package/compile/events/apiGateway/lib/validate.js b/lib/plugins/aws/package/compile/events/apiGateway/lib/validate.js index 2cbbfe924..ba663fb96 100644 --- a/lib/plugins/aws/package/compile/events/apiGateway/lib/validate.js +++ b/lib/plugins/aws/package/compile/events/apiGateway/lib/validate.js @@ -29,7 +29,7 @@ const DEFAULT_STATUS_CODES = { pattern: '[\\s\\S]*\\[502\\][\\s\\S]*', }, 504: { - pattern: '[\\s\\S]*\\[504\\][\\s\\S]*', + pattern: '([\s\S]*\[504\][\s\S]*)|(^[Task timed out].*)', }, };