Aws-sdk-ruby: Aws::S3::Errors::RequestTimeTooSkewed

Created on 13 Mar 2018  路  2Comments  路  Source: aws/aws-sdk-ruby

Issue description

Aws::S3::Errors::RequestTimeTooSkewed: 
The difference between the request time and the current time is too large.

Encounter this error -sometimes- while working in development and testing.
The uploaded files are small _(< 1 MB)_.

I tried setting the timezone to Ireland Dublin to match my bucket zone eu-west-1 but it didn't work.

I found some helpful configuration that can[be set in other SDKs (.NET, JS):

  • correctClockSkew
  • systemClockOffset

I didn't found them in ruby aws sdk or the repository.
Trying to set them in AWS.config raises not known configuration exception.

Gem name and its version

gem 'aws-sdk', and version: 2.10.125

Version of Ruby, OS environment

Ruby 2.4.1, Mac OS X 10.11.6

Code snippets / steps to reproduce

Upload file to AWS S3 bucket in development environment.
Happens for me in new Rails application with default time zone unchanged:

Aws::S3::Resource.new(client: @client).bucket(@bucket_name)
obj = get_bucket.object("my object")
obj.put({ body: content, acl: 'public-read' })
obj.public_url
guidance

Most helpful comment

My case was in the test context.
I was stubbing Time in other test cases without returning it back to current.

@juanignaciosl Ensure you're not using time stubbing helpers.

If you didn't encounter this tests, then:

  • This is in most cases a system, clock, issue.
  • Some SDKs have extra options to handle it (e.g: correctClockSkew), but not ruby unfortunately.
  • Delayed Request in S3 queue that caused request time to increase.

All 2 comments

@abarrak how did you fix this? 馃槄

My case was in the test context.
I was stubbing Time in other test cases without returning it back to current.

@juanignaciosl Ensure you're not using time stubbing helpers.

If you didn't encounter this tests, then:

  • This is in most cases a system, clock, issue.
  • Some SDKs have extra options to handle it (e.g: correctClockSkew), but not ruby unfortunately.
  • Delayed Request in S3 queue that caused request time to increase.
Was this page helpful?
0 / 5 - 0 ratings