You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -28,22 +28,35 @@ function createCallback(response) {
28
28
if(lambdaResponse.body){
29
29
response.write(
30
30
lambdaResponse.isBase64Encoded
31
-
? Buffer.from(lambdaResponse.body,"base64")
31
+
? Buffer.from(lambdaResponse.body,'base64')
32
32
: lambdaResponse.body
33
33
);
34
+
}else{
35
+
if(
36
+
process.env.CONTEXT!=='production'||
37
+
!process.env.SILENCE_EMPTY_LAMBDA_WARNING
38
+
)
39
+
console.log(
40
+
`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).
41
+
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'`
42
+
);
34
43
}
35
44
response.end();
36
-
}
45
+
};
37
46
}
38
47
39
48
functionpromiseCallback(promise,callback){
40
49
if(!promise)return;
41
-
if(typeofpromise.then!=="function")return;
42
-
if(typeofcallback!=="function")return;
50
+
if(typeofpromise.then!=='function')return;
51
+
if(typeofcallback!=='function')return;
43
52
44
53
promise.then(
45
-
function(data){callback(null,data)},
46
-
function(err){callback(err,null)}
54
+
function(data){
55
+
callback(null,data);
56
+
},
57
+
function(err){
58
+
callback(err,null);
59
+
}
47
60
);
48
61
}
49
62
@@ -56,7 +69,10 @@ function buildClientContext(headers) {
0 commit comments