轨道3 Carrierwave雾灯-S3的错误:应为(200)LT; =>实际(404未找​​到)雾灯、轨道、实际、错误

2023-09-11 09:50:45 作者:经典的昵称

我使用Carrerwave 0.5.3和我在我的画面控制器的创建方法调用Picture.save得到一个404错误。

I'm using Carrerwave 0.5.3 and getting a 404 error on my call to Picture.save in the Create method of my picture controller. Per the instructions in lib/carrierwave/storage/s3.rb I have the following in my initialization file (config/initializers/carrierwave_fog.rb):

CarrierWave.configure do |config|
     config.s3_access_key_id = "xxxxx"
     config.s3_secret_access_key = "xxxxx"
     config.s3_bucket = "mybucket"  #already created in my S3 account
end

在photo_uploader.rb我有:

In photo_uploader.rb I have:

class PhotoUploader < CarrierWave::Uploader::Base
  include CarrierWave::RMagick
  storage :s3
  def store_dir
    "uploads"  # already created in my s3 account
  end
  def cache_dir
    "uploads/cache"  #already created in my s3 account
  end
end

确切的错误:

The exact error:

Excon::Errors::NotFound in PicturesController#create
Expected(200) <=> Actual(404 Not Found)
  request => {:expects=>200}
  response => #<Excon::Response:0x00000104a72448 @body="", @headers={}, @status=404>

我找到了一个稍微类似的问题在这里Carrierwave和S3与Heroku的错误未定义的方法`fog_credentials ='。但是,设置东西的方式,我把它现在在这种情况下,显然奏效。遗憾的是它并没有给我。

I found a slightly similar question here Carrierwave and s3 with heroku error undefined method `fog_credentials=' . But setting things up the way I have it now apparently worked in that case. Unfortunately it didn't for me.

我已经把照片在我的水桶,并设置权限为公共的,可以通过浏览器访问图片。因此,在AWS S3侧的东西似乎工作。

I've put a picture in my bucket and set the permissions to public and can access the picture via a browser. So things on the AWS S3 side seem to be working.

不知道下一步去哪里。任何想法?

Not sure where to go next. Any ideas?

推荐答案

嗯,我睡在这一个晚上回来的第二天,一切都很好。不知道为什么突然开始工作。

Well, I slept on this for a night came back the next day and all was good. Not sure why it suddenly started working.