Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon API Gateway : response body is not transformed when the API is called via Postman?

When executing a testvia the AWS API Gateway console, I see that the output response from the Lambda function is correctly transformed:

{
  "type" : "",
  "message" : "",
  "request-id" : ""
}

See logs below:

Tue Sep 06 14:46:06 UTC 2016 : Endpoint request body after transformations: {}
Tue Sep 06 14:46:06 UTC 2016 : Endpoint response body before transformations: {"errorMessage":"501stef"}
Tue Sep 06 14:46:06 UTC 2016 : Endpoint response headers: {x-amzn-Remapped-Content-Length=0, x-amzn-RequestId=a4540f42-7440-11e6-90ce-214b29fcde38, Connection=keep-alive, Content-Length=26, Date=Tue, 06 Sep 2016 14:46:06 GMT, Content-Type=application/json}
Tue Sep 06 14:46:06 UTC 2016 : Method response body after transformations: {
  "type" : "",
  "message" : "",
  "request-id" : ""
}
Tue Sep 06 14:46:06 UTC 2016 : Method response headers: {Content-Type=application/json}
Tue Sep 06 14:46:06 UTC 2016 : Successfully completed execution
Tue Sep 06 14:46:06 UTC 2016 : Method completed with status: 501



However when calling the API via Postman with headers:

Content-Type : application/json
Accept : application/json

enter image description here

No output transformation is happening, and the output JSON message is just:

{
  "errorMessage": "501stef"
}


Partly related to Amazon APi gateway fails to generate transformed request but this one talks about the Request.

like image 704
Stef Heyenrath Avatar asked Sep 06 '16 15:09

Stef Heyenrath


Video Answer


1 Answers

Before the changes are externally visible, you need to Deploy the API !

enter image description here **enter image description here**

like image 118
Stef Heyenrath Avatar answered Sep 27 '22 15:09

Stef Heyenrath