title: Why Calling REST API (API Gateway Service Proxy) which invokes DynamoDB Scan API directly returning empty array of items?
body: <p>I successfully created and tested in API Gateway Console a REST Service Proxy API returning all items in a DynamoDB table using Scan API. And to make DB's response as a JSON object, I added a mapping template in 'Integration Response' which transforms the response as follows:</p>
  
  <pre><code>{
    "tableItems": [
        { // item_1
          "attribute_1": "value",
          "attribute_2": "someValue"
        },
        { //item_2
          "attribute_1": "value",
          "attribute_2": "someValue"
        },
        { //item_3
          "attribute_1": "value",
          "attribute_2": "someValue"
        }
     ]
  }
  </code></pre>
  
  <p>But then I enabled CORS (keeping all options default), deployed the API with testing stage 'beta' and finally called it in a web app using jQuery's $.get() method. I got following response with empty "tableItems" array:</p>
  
  <pre><code>{
     "tableItems": []
  }
  </code></pre>
  
  <p>Suspecting something wrong in 'Method Response' section of API Gateway, I checked the 'Response Body for 200 ' settings. The content type was set to 'application/json' with models 'Empty'. Apparently, I can't change the latter values.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>To drill down on the root problem, I enabled the Cloudwatch logs for Api Gateway, and invoke the REST API GET endpoint as follows:</p>
  
  <pre><code>$.get("https://my_api_id.execute-api_region.amazonaws.com/beta/get-items/{tablename}", { 
       tablename: "abc"
  })
  .then(res =&gt; console.log(res))
  .catch(err =&gt; console.error(err));
  </code></pre>
  
  <p>In logs I'm getting following info:</p>
  
  <pre><code>{
      "requestId": "...",
      "ip": "...",
      "caller": "-",
      "user": "-",
      "requestTime": "21/Apr/2020:08:03:41 +0000",
      "httpMethod": "GET",
      "resourcePath": "/get-items/{tablename}",
      "status": "200",
      "protocol": "HTTP/1.1",
      "responseLength": "44"   &lt;--- to probe
  }
  </code></pre>