API Gatway proxy response when using ExclusiveStartKey

被刻印的时光 ゝ 提交于 2019-12-25 01:36:47

问题


Consider this example from docs for Amazon DynamoDB, here we have:

dynamoDb.scan(params, onScan);

function onScan(err, data) {
      if (err) {
          return;
      } else {
        collectedItems.push(data.Items);

        const response = {
          statusCode: 200,
          headers: {
            'Access-Control-Allow-Origin': '*',
          },
          body: JSON.stringify(collectedItems),
        };
        callback(null, response);

        // continue scanning if we have more movies, because
        // scan can retrieve a maximum of 1MB of data
        if (typeof data.LastEvaluatedKey != "undefined") {
            console.log("Scanning for more...");
            params.ExclusiveStartKey = data.LastEvaluatedKey;
            dynamoDb.scan(params, onScan);
        }



      }
  }

that should show me collectedItems as json response for API Gateway. But it returns

{
 message: "Internal server error"
}

来源:https://stackoverflow.com/questions/52920146/api-gatway-proxy-response-when-using-exclusivestartkey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!