问题
i am working to get with Rails 4 / Ruby 2 fog / carrierwave integration. Basically I have in my app after around a day of the unicorn servers running it is returning: [HTTP 401] Fog::Storage::Rackspace::ServiceError I then query the server, and check if I can manually hit the server, and have no issues. So I am very lost and what to do.
F, [2013-06-17T00:47:58.519007 #31200] FATAL -- :
ActionView::Template::Error ([HTTP 401] Fog::Storage::Rackspace::ServiceError):
21: <li class="span4">
22: <div class="thumbnail">
23: <div style="height: 270px">
24: <%= image_tag(website.logo_url(:web), :class => 'img-rounded') if website.logo? %>
25: </div>
Today I saw that they updated FOG to 1.12.1 and am trying to upgrade, but I really don't know what the issue is. It almost seems as though the connection to Rackspace goes bad.... Any thoughts? Thanks!!
回答1:
Thanks to Henning's observations, I was able to find that Fog's Rackspace CDN service was not re-authenticating after the authentication token expired. I have submitted the following pull request to fog => https://github.com/fog/fog/pull/1899.
I expect a new version of Fog to be released in early July with this fix. In the interim, I have created a patch to be applied to the current Fog gem -> https://gist.github.com/krames/5817816
This file should be saved in the initializer's directory of your rails application and named 01_cdn_patch.rb in order for it to be properly applied. It will only work for Fog 1.12.1.
回答2:
we ran into the same issue. The AuthToken expires after 24 hours. When this happens fog raises this error and did not try to reauthenticate. If you restart the server Fog reauthenticates. But that's doesn't count as a solution.
Hope you will figure out some solution. I added the relevant stack trace. We use fog 1.12.1.
Cheers
[GEM_ROOT]/gems/excon-0.23.0/lib/excon/middlewares/expects.rb:10:in `'
[GEM_ROOT]/gems/excon-0.23.0/lib/excon/connection.rb:353:in `'
[GEM_ROOT]/gems/excon-0.23.0/lib/excon/connection.rb:247:in `'
[GEM_ROOT]/gems/fog-1.12.1/lib/fog/core/connection.rb:25:in `'
[GEM_ROOT]/gems/fog-1.12.1/lib/fog/rackspace/cdn.rb:157:in `'
[GEM_ROOT]/gems/fog-1.12.1/lib/fog/rackspace/requests/cdn/head_container.rb:30:in `'
[GEM_ROOT]/gems/fog-1.12.1/lib/fog/rackspace/cdn.rb:62:in `'
[GEM_ROOT]/gems/fog-1.12.1/lib/fog/rackspace/models/storage/directory.rb:183:in `'
[GEM_ROOT]/gems/fog-1.12.1/lib/fog/rackspace/models/storage/directory.rb:131:in `'
[GEM_ROOT]/gems/fog-1.12.1/lib/fog/rackspace/models/storage/file.rb:177:in `'
[GEM_ROOT]/gems/carrierwave-0.8.0/lib/carrierwave/storage/fog.rb:304:in `'
[GEM_ROOT]/gems/carrierwave-0.8.0/lib/carrierwave/storage/fog.rb:322:in `'
[GEM_ROOT]/gems/carrierwave-0.8.0/lib/carrierwave/uploader/url.rb:19:in `'
[GEM_ROOT]/gems/carrierwave-0.8.0/lib/carrierwave/uploader/versions.rb:160:in `'
[GEM_ROOT]/gems/carrierwave-0.8.0/lib/carrierwave/uploader/default_url.rb:8:in `'
[GEM_ROOT]/gems/carrierwave-0.8.0/lib/carrierwave/uploader/versions.rb:156:in `'
[GEM_ROOT]/gems/carrierwave-0.8.0/lib/carrierwave/uploader/default_url.rb:8:in `'
[GEM_ROOT]/gems/carrierwave-0.8.0/lib/carrierwave/mount.rb:377:in `'
[GEM_ROOT]/gems/carrierwave-0.8.0/lib/carrierwave/mount.rb:187:in `'
回答3:
I had the same problem and resolved it using gem "fog", "~> 1.14.0"in the Gemfile rather than gem "fog", "~> 1.10.1" as this page recommends https://github.com/carrierwaveuploader/carrierwave#using-rackspace-cloud-files
回答4:
I am a member of the developer relations team at Rackspace and I am responsible for working on Fog. Sorry to hear that you are experiencing issues.
Can you share your configuration information with me (obfuscating your username and api key of course). Feel free to share it here or email me at https://developer.rackspace.com/support/
Also, can you tell me what data center your container is in?
Thanks!
Kyle
来源:https://stackoverflow.com/questions/17139148/http-401-fogstoragerackspaceserviceerror