gpt4 book ai didi

javascript - AWS Dynamodb 配置中缺少凭证,如果使用 AWS_CONFIG_FILE,则设置 AWS_SDK_LOAD_CONFIG=1

转载 作者:行者123 更新时间:2023-12-03 07:08:08 26 4
gpt4 key购买 nike

我正在尝试 添加元素 动态数据库 就像下面的例子,但是当我运行它时,我得到这个错误信息: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);

});
我想可能我错过了 accessKeyIdaccessSecretKey但老实说,我不明白如何设置它们

最佳答案

您似乎在查询本地凭据,因为 SDK 会检查它们,这是 raised as an issue它似乎。
您可以通过指定任何字符串来解决。试试下面的代码片段。

aws.config.update({
region: "eu-west-1",
endpoint: "http://localhost:8080",
accessKeyId: “xxxxxx”,
secretAccessKey: “xxxxxx”
});

关于javascript - AWS Dynamodb 配置中缺少凭证,如果使用 AWS_CONFIG_FILE,则设置 AWS_SDK_LOAD_CONFIG=1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62722507/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com