-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ArgumentError: no time information in "Expiration" when establishing a connection to DynamoDB #880
Comments
Could you try applying the following patch to your code? That error would only happen if the value received from the instance metadata service for the "expiration" was the value "Expiration", i.e. Time.parse('Expiration') produces the error you are describing. class Aws::InstanceProfileCredentials
def refresh
retry_count = 0
begin
json = get_credentials
c = Json.load(json)
@credentials = Credentials.new(
c['AccessKeyId'],
c['SecretAccessKey'],
c['Token']
)
@expiration = c['Expiration'] ? Time.parse(c['Expiration']) : nil
rescue ArgumentError => error
puts "NO TIME INFORMATION: #{c.inspect} - #{json.inspect}"
if retry_count < 3
retry_count += 1
retry
else
raise(error)
end
end
end
end You should replace the
EDIT: Modified the snippet |
The patch is online. I'll provide you with some information once the error occurs again. |
Any update on this? Has the error reoccured yet? |
Nope, I'm sorry. Still waiting for information on this. |
Finally I can provide some feedback. My current patch looks like that: module Aws
class InstanceProfileCredentials
def refresh
retry_count = 0
begin
credentials = MultiJson.load(get_credentials)
@access_key_id = credentials['AccessKeyId']
@secret_access_key = credentials['SecretAccessKey']
@session_token = credentials['Token']
if expires = credentials['Expiration']
@expiration = Time.parse(expires)
else
@expiration = nil
end
rescue ArgumentError, MultiJson::ParseError => e
airbrake_params = { get_credentials: get_credentials }
Airbrake.notify(e, parameters: airbrake_params, cgi_data: ENV.to_hash)
retry_count += 1
retry if retry_count < 3
end
end
end
end In an error case the notification parameters were (the actual value returned from the Method
|
Hmm.. unfortunately, that error is unrelated to the other one. Without your patch applied, the current release of the SDK currently handles json parsing errors. There have been a few other changes to make parsing responses from the instance metadata service more robust. I'll be pushing another change shortly that will capture and retry the errors related to extracting the expiration time. Thanks for collecting the information. |
The described exception happens occasionally (very few times in the last four weeks in a busy production environment) when a connection to DynamoDB is being established.
The connection is established like that:
Here's the relevant (gem specific) stacktrace of the exception:
I'm using version 2.0.48 of the aws-sdk gem. For about 99.9% of the time, the connection can be established and everything works like it should.
The code is executed on an EC2 instance, authorization to DynamoDB is realised with an IAM Role linked to the EC2 instance. I think the whole progress of obtaining security credentials is described in the docs if I'm not mistaken.
The text was updated successfully, but these errors were encountered: