From 3fd1f38517995c4fdd9924616777e9dc1ac9957f Mon Sep 17 00:00:00 2001 From: Jared Henderson Date: Wed, 31 Jul 2019 16:45:57 -0400 Subject: [PATCH] fix empty lambda warning --- lib/serve.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/serve.js b/lib/serve.js index b39413e3..49ba9be1 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -45,12 +45,13 @@ function createCallback(response) { ); } else { if ( - process.env.CONTEXT !== "production" || + response.statusCode !== 204 && + process.env.CONTEXT !== "production" && !process.env.SILENCE_EMPTY_LAMBDA_WARNING ) console.log( `Your lambda function didn't return a body, which may be a mistake. Check our Usage docs for examples (https://github.com/netlify/netlify-lambda#usage). - If this is intentional, you can silence this warning by setting process.ENV.SILENCE_EMPTY_LAMBDA_WARNING to a truthy value or process.env.CONTEXT to 'production'` + If this is intentional, you can silence this warning by setting process.env.SILENCE_EMPTY_LAMBDA_WARNING to a truthy value or process.env.CONTEXT to 'production'` ); } response.end();