aws-sdk-js icon indicating copy to clipboard operation
aws-sdk-js copied to clipboard

Could not load credentials from SharedIniFileCredentials

Open mblag opened this issue 7 years ago • 3 comments

version: [email protected], reproduced once with latest or close to latest 2.392.0 platform: docker(regardless os)

Issue: I've assume role to connect to a dynamodb. I have setup it up and the awscli works, but cannot get the nodejs application to work. I have read the differences between cli and sdk and frankly tried all of the solutions or workarounds in the threads, but still cannot get my head around the error below.

Error:

Unable to create table. Error JSON: {
  "message": "Missing credentials in config",
  "code": "CredentialsError",
  "time": "2019-01-24T14:31:13.924Z",
  "requestId": "REMOVED",
  "statusCode": 404,
  "retryable": false,
  "retryDelay": 65.28812722576298,
  "originalError": {
    "message": "Could not load credentials from SharedIniFileCredentials",
    "code": "CredentialsError",
    "time": "2019-01-24T14:31:13.924Z",
    "requestId": "REMOVED",
    "statusCode": 404,
    "retryable": false,
    "retryDelay": 65.28812722576298
  }
}

The setup:

export AWS_PROFILE=my_profile export AWS_SDK_LOAD_CONFIG=1

tried also with AWS_SHARED_CREDENTIALS_FILE=$HOME/.aws/credentials, but the same error.

.aws/config
[profile my_profile]
region = us-west-2
output = json
role_arn = arn:aws:iam::my_profile:role/Operator
source_profile = master_profile
.aws/credentials
[master_profile]
aws_access_key_id = DEDACTED
aws_secret_access_key = DEDACTED
SharedIniFileCredentials {
  expired: false,
  expireTime: null,
  accessKeyId: undefined,
  sessionToken: undefined,
  filename: undefined,
  profile: 'my_profile',
  disableAssumeRole: false,
  preferStaticCredentials: false,
  roleArn: 'arn:aws:iam::my_profile:role/Operator' }

and the cred part of the code:

var cred = AWS.config.credentials = new AWS.SharedIniFileCredentials( {
     expired: false,
     disableAssumeRole: false })

Any help appreciated. Thanks.

mblag avatar Jan 24 '19 14:01 mblag

@mblag

How are you setting up the DynamoDB client?

srchase avatar Jan 24 '19 23:01 srchase

thanks for the reply, the issue turned out to be pre-deployed older version of aws-sdk along the docker image that somehow messed up the setup. making sure the modules are the current version solves the issue.

mblag avatar Jan 25 '19 04:01 mblag

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

lock[bot] avatar Sep 26 '19 19:09 lock[bot]