docClient.query(params, function(err, data) {
if (err) {
console.error("Unable to query. Error:", JSON.stringify(err, null, 2));
} else {
console.log("Query succeeded.");
}
});
得到类似这样的错误。我已正确设置lambda的角色以允许dynamodbaccess。我有适当的表和密钥配置来获取详细信息。
{
"message": "Missing credentials in config",
"code": "CredentialsError",
"time": "2017-11-29T22:27:08.406Z",
"requestId": "6f897dab-d554-11e7-8215-01d4f4e39dee",
"statusCode": 400,
"retryable": false,
"retryDelay": 25.21987048923635,
"originalError": {
"message": "Could not load credentials from CognitoIdentityCredentials",
"code": "CredentialsError",
"time": "2017-11-29T22:27:08.406Z",
"requestId": "6f897dab-d554-11e7-8215-01d4f4e39dee",
"statusCode": 400,
"retryable": false,
"retryDelay": 25.21987048923635,
"originalError": {
"message": "Invalid login token. Token expired: 1511994128 >= 1511993457",
"code": "NotAuthorizedException",
"time": "2017-11-29T22:27:08.392Z",
"requestId": "6f897dab-d554-11e7-8215-01d4f4e39dee",
"statusCode": 400,
"retryable": false,
"retryDelay": 25.21987048923635
}
}
}