Blob Error with Active Storage Rails 5.2

时光毁灭记忆、已成空白 提交于 2019-12-05 09:13:12

I've got exactly same error. For me it was because credentials for AWS S3 were missing (it was missing from credentials.yml.enc)

Resolved

Whilst I already had gem 'aws-sdk-s3', '~>1' I didn't have require: false

I had this exception but the cause of my issues was that active storage was silently failing to load its configurations from storage.yml:

Loading the file in a rails console shows the exception (whereas rails swallows the exception when loading active storage config):

YAML.load(ERB.new(File.read("#{Rails.root}/config/storage.yml")).result)
NoMethodError: undefined method `[]' for nil:NilClass

I had a comment with an ERB interpolation that was invalid. Fixing this fixed my issue.

Launch rails active_storage:install and rails db:migrate

Add this gem gem 'aws-sdk-s3', '~>1' and bundle

Delete your credential.yml.enc and your master.key if exists

Launch EDITOR=vim rails credentials:edit and puts your credentials

And normally rails s it should work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!