2

I am trying to create an API endpoint to execute my AWS Lambda function in my mobile application. When I create a custom API and test the POST method, I get the proper response code of 200 and the correct String phrase returns: "The name is {input}".

However, when I try to import this API into my project, it does not show up in the SDK. When I try and create an API through the Mobile Hub, I follow the same exact steps, but when I enter the POST method, I get the following error message:

Endpoint response body before transformations: "The name is InputName"
Fri Mar 10 17:39:33 UTC 2017 : Endpoint response headers: {x-amzn-Remapped-Content-Length=0, x-amzn-RequestId=8599f413-05b8-11e7-92d2-75672f730ae7, Connection=keep-alive, Content-Length=23, Date=Fri, 10 Mar 2017 17:39:32 GMT, Content-Type=application/json}
Fri Mar 10 17:39:33 UTC 2017 : Execution failed due to configuration error: Output mapping refers to an invalid method response: 200
Fri Mar 10 17:39:33 UTC 2017 : Method completed with status: 500
hermt2
  • 844
  • 3
  • 14
  • 33
  • check out this question/answer http://stackoverflow.com/questions/33601226/mapping-lambda-output-in-api-gateway-gives-server-error let me know if that helps – Yan Mar 11 '17 at 05:01

1 Answers1

4

This usually indicates an issue with how the method responses are configured inside your API.

To view your method responses click on the method you were using for the request in the API Gateway console, then click on the "Method Response" box. You should see a table with one or more HTTP Status codes.

API Gateway uses this to map the response from your Lambda function to a status code of your choosing. I suspect the mapping you have currently doesn't match what is being returned by your Lambda function, causing the error.

This tutorial goes into more depth about response mapping http://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started-models.html

Dan
  • 139
  • 5