![](/img/trans.png)
[英]Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1 (credentials file is present)
[英]AWS Dynamodb Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
我正在尝试在dynamodb中的表中添加元素,如下例所示,但是当我运行它时,我收到以下错误消息: Missing credentials in the config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
aws.config.update({
region: "eu-west-1",
endpoint: "http://localhost:8080",})
let ddb = new aws.DynamoDB.DocumentClient({
apiVersion: "2012-08-10",
});
let params = {
TableName: "NameOfTheTable",
Item: {
uuid: JSON.stringify(132), // random number for testing
name: JSON.stringify(req.query.mod), //data i'm passing in
},
};
const addMod = ddb.put(params, function (err, data) {
if (err) {
console.log("Error", err);
} else {
console.log("Success", data);
}
});
return res.send(addMod);
});
我想我可能错过了accessKeyId
和accessSecretKey
但老实说,我不明白如何设置它们
您似乎在查询本地凭据,因为 SDK 会检查它们,这似乎是一个问题。
您可以通过指定任何字符串来解决。 试试下面的代码片段。
aws.config.update({
region: "eu-west-1",
endpoint: "http://localhost:8080",
accessKeyId: “xxxxxx”,
secretAccessKey: “xxxxxx”
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.