我在使用回形针和 AWS gem 的 LocationsController#create 中收到以下错误AWS::Errors::MissingCredentialsError
有关异常的更多详细信息:
Missing Credentials. Unable to find AWS credentials.
You can configure your AWS credentials a few different ways:
* Call AWS.config with :access_key_id and :secret_access_key
* Export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to ENV *
Run Code Online (Sandbox Code Playgroud)
我目前正在我的机器上的开发环境中运行此代码这是development.rb
Gmaps::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# …Run Code Online (Sandbox Code Playgroud) 我有一个非常简单的模型和附件
has_attached_file :upload,
:storage => :s3,
:bucket => 'bestofbauer',
:s3_credentials => {
:access_key_id => ENV['MyAccessKEY'],
:secret_access_key => ENV['MySecretKey']
}
Run Code Online (Sandbox Code Playgroud)
我有一个名为bestofbauer的s3桶设置.
我知道我可以将凭证重构为初始化程序,但我还没有得到这个来保存附件,所以我并不担心它.
当我运行对象及其附件的保存时,我得到:
RuntimeError in RecommendationsController#create
Missing credentials
Run Code Online (Sandbox Code Playgroud)
我已经倾倒了:使用Paperclip和Amazon s3上传照片时缺少证书,但这并没有解决我的问题.
我使用以下宝石:
gem "paperclip"
gem "sws-sdk"
gem 'aws-s3'
Run Code Online (Sandbox Code Playgroud)
还有其他想法吗?