title: Deploy API to Amazon API Gateway
body: <p>In the <em>Amazon API Gateway</em> I have created a simple API containing a single resource called <strong>demo</strong> and one <strong>POST</strong> method corresponding to it:</p>
  
  <p><img src="https://i.stack.imgur.com/zDFzG.png" alt="enter image description here"></p>
  
  <p>Now, I want my endpoint to accept <em>POST</em> request of <strong>any</strong> <em>Content-Type</em>, so not necessarily <em>application/json</em>, but also <em>plain/text</em>. I then want to take the <em>body</em> of the request and wrap it in a <em>JSON</em> object and send it to an <em>Amazon Lambda function</em> (<em>Lambda</em> functions can only accept <em>JSON</em> object as parameter).</p>
  
  <p>For this purpose I have edited the <em>Integration Request</em> corresponding to my method to use a custom template mapping:</p>
  
  <p><img src="https://i.stack.imgur.com/YzNHY.png" alt="enter image description here"></p>
  
  <p>I have used the reference from the Amazon documentation which can be found here: <a href="http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html" rel="nofollow noreferrer">http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html</a></p>
  
  <p>My <em>Lambda function</em> looks like this:</p>
  
  <pre><code>exports.handler = function(event, context) {
      context.succeed(event);
  };
  </code></pre>
  
  <p>When testing, I get the expected output regardless of what I send:</p>
  
  <p><img src="https://i.stack.imgur.com/QOtKN.png" alt="enter image description here"></p>
  
  <p>However, when I deploy, the transformation just doesn't work anymore, it expects <em>JSON</em></p>
  
  <ul>
  <li>Sending anything yelds this:</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/YEoTc.png" alt="enter image description here"></p>
  
  <ul>
  <li>Sending JSON yields this:</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/dH5lg.png" alt="enter image description here"></p>
  
  <p>Is there any part of this process executed wrong? Am I missing something when deploying? To me, it looks like a very annoying Amazon bug, can anyone confirm that?</p>