In the Amazon API Gateway, I created a simple API containing one resource named demo and one POST method corresponding to it:

Now I want my endpoint to accept the POST request of any Content-Type, so not necessarily application / json, but also plain / text. Then I want to take the request body and wrap it in a JSON object and send it to the Amazon Lambda function (Lambda functions can only accept a JSON object as a parameter).
For this purpose, I edited the integration request that matches my method to use custom pattern matching:

I used the link from the Amazon documentation that can be found here: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
My Lambda function looks like this:
exports.handler = function(event, context) {
context.succeed(event);
};
When testing, I get the expected result no matter what I submit:

However, when I deploy, the conversion just doesn't work anymore, it expects JSON
- Sending something does this:

- Submitting JSON gives the following:

Is there any part of this process that was performed incorrectly? Am I losing something during deployment? To me this seems like a very annoying Amazon error, can anyone confirm this?
source
share