I am trying to figure out how to map the response from Lambda in the API gateway to different status codes and at the same time get the JSON object from my lambda function.
In Lambda there is the following:
context.done('Not Found:',jsonObject);
And in my API gateway, in the integration response , I have a regular expression of Lambda error on 403, saying Not found :. * . This works, the method returns a 403 return.
The problem is that I cannot return jsonObject . I tried to create an application mapping template / json that looks like this (also in integration response):
{"error" : $input.json('$')}
But this only leads to the fact that my answer is as follows:
{"error" : {"errorMessage":"Not Found:"}}
I misunderstood the pattern matching?