3

I am creating an AWS ApiGateway & it invoking a lambda function asynchronously. Once apigateway sent the message lambda it'll send a 200 response with empty response. I need to send some static information with in the response message.

{
    "code":"SUCCESS",
    "description":"Successfully sent to lambda"
}

I tried to set up a model. But there I'm unable to set static values. Please help on this ?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

2

You need to configure AWS API Gateway Integration Response Data Mapping return the response message from your Lambda function. If you use Lambda proxy, you can directly send the entire response including headers.

Note: If its only a static response, you don't need Lambda, you can use a Mock Endpoint with static message response.

Ashan
  • 18,898
  • 4
  • 47
  • 67
  • Thank you for the reply. I read the above mentioned document & able to fix that. Since I'm invoking the lambda asynchronously, apigateway didn't wait for the lambda response. once invoked the lambda, it will send an empty response. I need to override that for static success reply. I configured a model in method response & template in integration response. in integration template i added static values. now its working – Nishanthi Wickramasinghe Aug 25 '17 at 06:50
  • For future users, you have to setup an "asynchronous" Lambda invocation if you don't want to wait for the lambda to run, and you want to respond immediately: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-integration-async.html – Migwell Mar 04 '22 at 00:48