[英]Aws dynamodb Error Error [UnknownError]: Not Found (aws-sdk)
I'm trying to add elements in a table in dynamodb like in the example below but when I run it I get this error message:我正在尝试在 dynamodb 中的表中添加元素,如下例所示,但是当我运行它时,我收到以下错误消息:
Error Error [UnknownError]: Not Found
at Request.extractError (C:\Users\caval\Documents\GitRepos\express-es6-rest-api\node_modules\aws-sdk\lib\protocol\json.js:51:27)
at Request.callListeners (C:\Users\caval\Documents\GitRepos\express-es6-rest-api\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
at Request.emit (C:\Users\caval\Documents\GitRepos\express-es6-rest-api\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
at Request.emit (C:\Users\caval\Documents\GitRepos\express-es6-rest-api\node_modules\aws-sdk\lib\request.js:688:14)
at Request.transition (C:\Users\caval\Documents\GitRepos\express-es6-rest-api\node_modules\aws-sdk\lib\request.js:22:10)
at AcceptorStateMachine.runTo (C:\Users\caval\Documents\GitRepos\express-es6-rest-api\node_modules\aws-sdk\lib\state_machine.js:14:12)
at C:\Users\caval\Documents\GitRepos\express-es6-rest-api\node_modules\aws-sdk\lib\state_machine.js:26:10
at Request.<anonymous> (C:\Users\caval\Documents\GitRepos\express-es6-rest-api\node_modules\aws-sdk\lib\request.js:38:9)
at Request.<anonymous> (C:\Users\caval\Documents\GitRepos\express-es6-rest-api\node_modules\aws-sdk\lib\request.js:690:12)
at Request.callListeners (C:\Users\caval\Documents\GitRepos\express-es6-rest-api\node_modules\aws-sdk\lib\sequential_executor.js:116:18) {
message: 'Not Found',
code: 'UnknownError',
statusCode: 404,
time: 2020-07-05T08:21:43.936Z,
requestId: undefined,
retryable: false,
retryDelay: 38.04958058577693
}
I tried also with getItems , delteItems ... and I get the same error .我也尝试了getItems 、 delteItems ......我得到了同样的错误。 Removing it I don't get any error, so the error come from these methods for sure.
删除它我没有收到任何错误,因此错误肯定来自这些方法。
let ddb = new AWS.DynamoDB({
apiVersion: "2012-08-10",
endpoint: "http://localhost:8080",
region: "eu-west-1",
accessKeyId: AWS.config.credentials.accessKeyId,
secretAccessKey: AWS.config.credentials.secretAccessKey,
});
let params = {
TableName: "namOfTheTable",
Item: {
uuid: { N: "123" },
name: { S: JSON.stringify(req.query.mod) },
},
};
const addMod = ddb.putItem(params, function (err, data) {
if (err) {
console.log("Error", err);
} else {
console.log("Success", data);
}
});
Edit: the problem was that I was not using the local version so I needed to remove the property endpoint
编辑:问题是我没有使用本地版本,所以我需要删除属性
endpoint
This 404 not found error is being returned from http://localhost:8080
.这个 404 not found 错误正在从
http://localhost:8080
返回。
Are you sure that DynamoDB local is running, and if so have you set it to run on port 8080
?您确定 DynamoDB local 正在运行,如果是,您是否将其设置为在端口
8080
上运行?
By default DynamoDB local runs on port 8000
according to the documentation on local DynamoDB usage .根据有关本地 DynamoDB 使用的文档,默认情况下 DynamoDB 本地在端口
8000
上运行。
Additional Note附加说明
After discussing with OP, DynamoDB local was not setup on their host machine which is what caused the 404 issues.在与 OP 讨论后,DynamoDB local 没有在他们的主机上设置,这就是导致 404 问题的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.