我正在將我的應用程序從Rails 3.0.9遷移到3.2.3和ruby 1.9.3。我用aws-s3 gem使用回形針(2.3.11)來存儲我的照片。Errors :: SignatureDoesNotMatch,適用於回形針3.0.1和rails 3.2的S3支持的AWS-SDK gem
現在我想使用最後一個版本的回形針(3.0.1),然後我必須使用aws-sdk gem。
我已經把我的aws.yml文件:
development: &development
bucket: bucket_name_for_dev
access_key_id: *****
secret_access_key: *******
staging:
<<: *development
bucket: bucket_name_for_staging
production:
<<: *development
bucket: bucket_name_for_prod
我的模型包括:
has_attached_file :picture, :styles => { :medium => "300x300>", :thumb => "50x50>" }, :default_url => 'picture_missing.png',
:storage => :s3,
:bucket => "bucket_name_for_dev",
:s3_credentials => Rails.root.join("config/aws.yml"),
:path => "/presentation_pictures/:id/:style/:filename",
:url => ":s3_eu_url"
attr_accessible :picture
attr_accessor :picture_url
當試圖上傳文件,我得到的錯誤:
AWS::S3::Errors::SignatureDoesNotMatch
The request signature we calculated does not match the signature you provided. Check your key and signing method.
我驗證過在我的鑰匙可以訪問和設置爲正確的價值。
這裏也是我從控制檯中看到:
[paperclip] Saving attachments.
[paperclip] saving /presentation_pictures/43/original/Image_1.png
[AWS S3 200 0.813272 0 retries] put_object(:acl=>:public_read,:bucket_name=>"*******_dev",:content_type=>"image/png",:data=>#<Paperclip::UploadedFileAdapter:0x2e144b4 @target=#<ActionDispatch::Http::UploadedFile:0x2dbb1fc @original_filename="Image 1.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"presentation_picture[picture]\"; filename=\"Image 1.png\"\r\nContent-Type: image/png\r\n", @tempfile=#<File:/var/folders/tb/tbmv4LE9EwGNPr1QqU2S0E+++TI/-Tmp-/RackMultipart20120407-33502-1gajfe9>>, @tempfile=#<File:/var/folders/tb/tbmv4LE9EwGNPr1QqU2S0E+++TI/-Tmp-/Image 1.png20120407-33502-an4dcy>>,:key=>"presentation_pictures/43/original/Image_1.png")
你有沒有從那裏可以來這個問題的任何想法? Thx
我沒有答案,但可以發佈您的aws-sdk和aws-s3 Gemfile.lock的版本?我試圖弄清楚爲什麼這也開始發生在我身上。 – 2012-04-19 18:06:12