Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1 #4271
-
I am trying to the secret values using below code snippet but i am getting Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1 const AWS = require("aws-sdk");
const region = 'ap-southeast-1';
// set the default config object
var creds = new AWS.CognitoIdentityCredentials({
IdentityPoolId: 'ap-southeast-1:***********'
});
AWS.config.credentials = creds;
console.log('credentials', AWS.config.credentials)
const client = new AWS.SecretsManager({
region: region,
credentials : creds
});
export const getSecrets = (SecretId) => {
client.getSecretValue({ SecretId }, (err, result) => {
if (err) console.log(err);
if (result) {
console.log(result);
console.log(result.SecretString);
}
});
}; ### getSecrets('dev/api/backend-auth');` |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
What do you see when you try to print the client? |
Beta Was this translation helpful? Give feedback.
-
AccessDeniedException: User: arn:aws:sts::359890608932:assumed-role/Cognito_shtbotdevuiidentitypoolUnauth_Role/CognitoIdentityCredentials is not authorized to perform: secretsmanager:GetSecretValue on resource: dev/api/backend-auth because no session policy allows the secretsmanager:GetSecretValue action |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
AccessDeniedException: User: arn:aws:sts::359890608932:assumed-role/Cognito_shtbotdevuiidentitypoolUnauth_Role/CognitoIdentityCredentials is not authorized to perform: secretsmanager:GetSecretValue on resource: dev/api/backend-auth because no session policy allows the secretsmanager:GetSecretValue action