2012-10-26 45 views
1

我正在使用Dragonfly(https://github.com/markevans/dragonfly)對項目進行一些圖像處理,並且使用霧作爲數據存儲引擎。我最近開始在請求中出現奇怪的亞馬遜錯誤。主要錯誤是在軌道上使用aws s3的奇怪時間戳問題

AWS authentication requires a valid Date or x-amz-date header 

The difference between the request time and the current time is too large. 

這個工作對我的所有其他計算機沒事,只是一個開發機器上。它的運行Mac OSX的Ruby 1.9和Rails 3.0.10,時間戳在機器上很好。頭似乎將作爲劃時代的時間由於某種原因...

完全錯誤:

Excon::Errors::Forbidden (Expected(200) <=> Actual(403 Forbidden) 
 request => {:connect_timeout=>60, 
    :headers=>{"Date"=>"Wed, 31 Dec 1969 23:59:59 +0000", "Authorization"=>"AWS AUTHKEY", "Host"=>"my-development.s3.amazonaws.com:443"}, :instrumentor_name=>"excon", :mock=>false, :nonblock=>true, :read_timeout=>60, :retry_limit=>4, :ssl_ca_file=>"/Users/temp/.rvm/gems/ruby-1.9.2-p180/gems/excon-0.16.2/data/cacert.pem", :ssl_verify_peer=>true, :write_timeout=>60, :host=>"my-development.s3.amazonaws.com", :path=>"/", :port=>"443", :query=>{}, :scheme=>"https", :expects=>200, :idempotent=>true, :method=>"GET", :response_block=>#<Proc:[email protected]/Users/temp/.rvm/gems/ruby-1.9.2-p180/gems/fog-1.5.0/lib/fog/core/connection.rb:16 (lambda)>} 
 response => #<Excon::Response:0x007fe4c3c77a18 @body="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>AccessDenied</Code><Message>AWS authentication requires a valid Date or x-amz-date header</Message><RequestId>AF3S5E9BAA514F1</RequestId><HostId>SOMETHING</HostId></Error>", @headers={"x-amz-request-id"=>"AF3S5E9BAA514F1", "x-amz-id-2"=>"SOMETHING", "Content-Type"=>"application/xml", "Transfer-Encoding"=>"chunked", "Date"=>"Thu, 25 Oct 2012 19:03:39 GMT", "Server"=>"AmazonS3"}, @status=403>): 


ERROR Excon::Errors::Forbidden: Expected([200, 206]) <=> Actual(403 Forbidden)  request => {:connect_timeout=>60, 
:headers=>{"Date"=>"Thu, 01 Jan 1970 00:00:01 +0000", "Authorization"=>"AWS AUTHKEY", "Host"=>"my-development.s3.amazonaws.com:443"}, :instrumentor_name=>"excon", :mock=>false, :nonblock=>true, :read_timeout=>60, :retry_limit=>4, :ssl_ca_file=>"/Users/temp/.rvm/gems/ruby-1.9.2-p180/gems/excon-0.16.2/data/cacert.pem", :ssl_verify_peer=>true, :write_timeout=>60, :host=>"my-development.s3.amazonaws.com", :path=>"/2012%2F10%2F18%2F19%2F32%2F28%2F836%2Fdragonfly20121018_47202_2lm4t0", :port=>"443", :query=>nil, :scheme=>"https", :expects=>[200, 206], :idempotent=>true, :method=>"GET"}  response => 
#<Excon::Response:0x007fd11e048ea8 @body="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>RequestTimeTooSkewed</Code><Message>The difference between the request time and the current time is too large.</Message><MaxAllowedSkewMilliseconds>900000</MaxAllowedSkewMilliseconds><RequestId>85D12B885D8B4DBE</RequestId><HostId></HostId><RequestTime>Thu, 01 Jan 1970 00:00:01 
+0000</RequestTime><ServerTime>2012-10-26T21:19:18Z</ServerTime></Error>", @headers={"x-amz-request-id"=>"85D12B885D8B4DBE", "x-amz-id-2"=>"SOMETHING", "Content-Type"=>"application/xml", "Transfer-Encoding"=>"chunked", "Date"=>"Fri, 26 Oct 2012 21:19:16 GMT", "Server"=>"AmazonS3"}, @status=403> 

回答

0

不知道爲什麼,我沒有在我的最終改變什麼,我甚而沒有重新啓動我的應用程序,但它今天開始工作。

+1

夏令時也許? – Roman

+0

nope,檢查,檢查當地時間,一切似乎都很好...... – hb922