Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aws::Errors::MissingCredentialsError: unable to sign request without credentials set #1301

Closed
rayway30419 opened this issue Sep 23, 2016 · 15 comments
Labels
response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@rayway30419
Copy link

Hi

I use IAM-role to assign policy to my EC2 instance, but sometimes it raise missing credential error.

Aws::Errors::MissingCredentialsError: unable to sign request without credentials set

Does anyone have same problem?

@awood45
Copy link
Member

awood45 commented Sep 27, 2016

So you're saying that on an EC2 instance, you're seeing this periodically? How is your environment set up?

@awood45 awood45 added Version 2 service-api General API label for AWS Services. labels Sep 27, 2016
@rayway30419
Copy link
Author

Hi @awood45

It happens randomly,

What kind of enviroment setting?

Ruby 2.3.0
Rails 5.0.0.1
aws-sdk 2.6.3
Ubuntu 14.04 Trusty (3.13.0-63-generic)

@awood45
Copy link
Member

awood45 commented Sep 29, 2016

Is the Ubuntu version you listed your development environment, or an EC2 AMI? How are you configuring your clients in code?

@rayway30419
Copy link
Author

It's on the EC2 AMI.

# region in configuration file
client = Aws::DynamoDB::Client.new(
  region: Aws.config[:region]
)
# do sth.
client.put_item params

@rayway30419
Copy link
Author

BTW, I found a clue.....it's running on my sidekiq worker, it may happen to mult-ithreading?

@rayway30419
Copy link
Author

Another error message when initialize DynamoDB client
NameError: uninitialized constant Aws::CredentialProviderChain::InstanceProfileCredentials

@awood45
Copy link
Member

awood45 commented Oct 17, 2016

Okay, it looks like this may be related to how Sidekiq initializes - you might need to do eager_autoload within your Sidekiq workers, rather than only in the Rails initialization. Can you try that?

@awood45 awood45 added third-party and removed service-api General API label for AWS Services. labels Oct 17, 2016
@awood45
Copy link
Member

awood45 commented Oct 17, 2016

For what it's worth, we're working on an overhaul of the SDK which should reduce or eliminate these autoload issues - message definitely received that they cause problems when threading.

@rayway30419
Copy link
Author

rayway30419 commented Oct 18, 2016

@awood45
With my understand, the sidekiq process will execute the procedures within rails initializer, too.

I am glad to hear this news.

@glennpratt
Copy link

@trevorrowe
Copy link
Member

Just chiming in here. The preview release of the modularized SDK is coming shortly. With modularization, we have eliminated the use of autoload.

@trevorrowe
Copy link
Member

@rayway30419 Are you still experiencing the intermittent missing credential errors? Commonly this is caused by the aggressive defaults in attempting to load credentials from the instance metadata service. Once credentials expire, they must be refreshed, but if the metadata service fails to respond, a missing credentials error is raised. I've just push a small change that will go out with the next release where you can configure expanded retries and timeouts:

client = Aws::DynamoDB::Client.new(
  region: Aws.config[:region],
  instance_profile_credentials_timeout: 5, # defaults to 1 second
  instance_profile_credentials_retries: 5, # defaults to 0 retries
)

This change will be available in the next release.

@rayway30419
Copy link
Author

hi @trevorrowe,
It still happens, I am looking forward to it!

@awood45
Copy link
Member

awood45 commented Dec 15, 2016

It looks like this went out with a previous release. Let me know/reopen if you see this again after looking at configured retries/timeouts. Thanks!

@awood45 awood45 closed this as completed Dec 15, 2016
@jammerful
Copy link

jammerful commented Sep 1, 2017

@trevorrowe I'm still seeing this issue on (actually coming from fluentd which uses the SDK):

Ruby 2.3.4
AWS SDK 2.7.0
Linux Kernel 4.9.41

Is this expected? Could this be eventual consistency, instead of code?

monfresh added a commit to 18F/identity-idp that referenced this issue Dec 28, 2017
**Why**: The same AWS error has happened 22 times over the past 7 days
in production. According to this issue:
aws/aws-sdk-ruby#1301, other people are
seeing this intermittently as well. One recommended solution is to
allow the client to retry fetching the credentials.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

6 participants