Jump to content

Hey All,

 

Does anyone here have experience with AWS REST APIs and Integration Response Mapping? I seem to be struggling with something that should be very simple. 

 

So I have a Lambda function that returns an error. The default response would be this

 

{
  "errorType": "string",
  "errorMessage": "{\"statusCode\":400,\"body\":{\"message\":\"Invalid Body\",\"errorDateTime\":\"2021-11-08T15:50:04.238Z\"}}",
  "trace": []
}

I have changed the Integration Response mapping to be the following

image.thumb.png.5ad4e4568c13f4a2e61e536980b0b333.png

 

This now returns the response like so

 

{
  "statusCode": 400,
  "body": {
    "message": "Invalid Body",
    "errorDateTime": "2021-11-08T15:51:25.998Z"
  }
}

My next step is that I only want to return the body in the response like so

 

  {
    "message": "Invalid Body",
    "errorDateTime": "2021-11-08T15:51:25.998Z"
  }

but for some reason I can't get access to the body key from the object and have no idea why. 

 

Anyone got any ideas?

 

Thanks

Craig

Link to comment
https://linustechtips.com/topic/1387032-aws-integration-response-mapping/
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×