How to return nothing to AWS API Gateway?

Sorry for this dumb question, but I tried everything.

I have AWS API Gateway from Lambda function, I need to return only HTTP 200 code without body. If the lambda returns an empty string, the body displays "" (2 quotes). If lambda returns null, the body displays the word null.

What is the catch? How to return an empty body?

For information, I use the Slack dash command to call the API. Thus, the call returns HTTP 200 OK, and the result is sent to POST in the response URL; therefore, processing can be performed after the HTTP result in order to avoid timeout problems.

+5
source share
1 answer

If you use lambda proxy integration in the “integration request” section (see the attached screenshot), you can simply return the empty string to the following structure.

enter image description here

module.exports.hello = (event, context, callback) => { const response = { statusCode: 200, body: '' }; callback(null, response); }; 
+3
source

All Articles