导轨AWS-S3删除文件会抛出AWS :: S3 :: PermanentRedirect错误 - 欧盟斗的问题? [英] rails aws-s3 delete file throws AWS::S3::PermanentRedirect error - EU bucket problem?

查看:649
本文介绍了导轨AWS-S3删除文件会抛出AWS :: S3 :: PermanentRedirect错误 - 欧盟斗的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建在Heroku上一个rails3应用程序,我使用AWS-S3的宝石,以处理存储在Amazon S3的欧盟斗文件。

当我尝试执行 AWS :: S3 :: S3Object.delete文件名,mybucketname命令时,我得到以下错误:

  

AWS :: S3 :: PermanentRedirect(桶您尝试访问   必须使用指定的端点解决。请将所有的未来   要求到这个端点):

我已经加入以下到我的 application.rb中文件:

  AWS :: S3 :: Base.establish_connection!(
   :access_key_id => myAccessKey
   :secret_access_key => mySecretAccessKey
 )
 

和以下code到我的控制器:

  
    

DEF破坏         歌= tape.songs.find(PARAMS [:ID])

  AWS :: S3 :: S3Object.delete song.filename,mybucket

song.destroy


respond_to代码做|格式|
    format.js {渲染:没有=>真正 }
  年底结束
 

  

我发现了一个建议的解决方案的地方加入 AWS_CALLING_FORMAT:SUBDOMAIN 我的 amazon_s3.yml 文件,按说,AWS-S3应该处理不同欧盟桶比我们。 然而,这并不能工作,收到同样的错误。

能否请您提供任何援助? 非常感谢您的帮助。

解决方案

问题是你需要SUBDOMAIN型在配置大写字符串,尝试了这一点

I'm building a rails3 app on heroku, and I'm using aws-s3 gem to manipulate files stored in an Amazon S3 eu bucket.

When I try to perform a AWS::S3::S3Object.delete filename, 'mybucketname' command, I get the following error:

AWS::S3::PermanentRedirect (The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.):

I have added the following to my application.rb file:

 AWS::S3::Base.establish_connection!(  
   :access_key_id     => "myAccessKey",  
   :secret_access_key => "mySecretAccessKey" 
 )

and the following code to my controller:

def destroy song = tape.songs.find(params[:id])

AWS::S3::S3Object.delete song.filename, 'mybucket'

song.destroy


respond_to do |format|  
    format.js   { render :nothing => true } 
  end     end

I found a proposed solution somewhere to add AWS_CALLING_FORMAT: SUBDOMAIN to my amazon_s3.yml file, as supposedly, aws-s3 should handle differently eu buckets than us. However, this did not work, same error is received.

Could you please provide any assistance? Thank you very much for your help.

解决方案

the problem is you need to type SUBDOMAIN as uppercase string in config, try this out

这篇关于导轨AWS-S3删除文件会抛出AWS :: S3 :: PermanentRedirect错误 - 欧盟斗的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆