Gia*_*rco 3 javascript database amazon-web-services node.js amazon-dynamodb
我正在尝试在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);
});
Run Code Online (Sandbox Code Playgroud)
我想可能我错过了accessKeyId
,accessSecretKey
但老实说,我不明白如何设置它们
似乎您查询本地凭据是因为 SDK 会检查它们,这似乎已被视为一个问题。
您可以通过指定任何字符串来绕过。试试下面的代码片段。
aws.config.update({
region: "eu-west-1",
endpoint: "http://localhost:8080",
accessKeyId: “xxxxxx”,
secretAccessKey: “xxxxxx”
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3979 次 |
最近记录: |