1

I have a vanilla Solidus installation (ruby 3.0 | rails 6.1.5)

I'm using the edge guide to test a deployment on Heroku. I get the following error on my local machine if I configure active storage to use :amazon in my storage.yml file.

screenshot on localhost:3000

The remote deployment also results in an error. Running heroku logs --tail gives the following error in my Terminal:

from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.11.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
2022-03-24T21:23:47.656577+00:00 app[web.1]: from bin/rails:5:in `<main>'
2022-03-24T21:23:47.825835+00:00 heroku[web.1]: Process exited with status 1
2022-03-24T21:23:47.876809+00:00 heroku[web.1]: State changed from starting to crashed
2022-03-24T21:23:47.885875+00:00 heroku[web.1]: State changed from crashed to starting
2022-03-24T21:23:54.753814+00:00 heroku[web.1]: Starting process with command `bin/rails server -p ${PORT:-5000} -e production`
2022-03-24T21:23:59.021982+00:00 app[web.1]: => Booting Puma
2022-03-24T21:23:59.022013+00:00 app[web.1]: => Rails 6.1.5 application starting in production
2022-03-24T21:23:59.022013+00:00 app[web.1]: => Run `bin/rails server --help` for more startup options
2022-03-24T21:24:00.921589+00:00 app[web.1]: Exiting
2022-03-24T21:24:00.922353+00:00 app[web.1]: /app/vendor/bundle/ruby/3.0.0/gems/activestorage-6.1.5/lib/active_storage/service/configurator.rb:17:in `build': undefined method `fetch' for nil:NilClass (NoMethodError)
2022-03-24T21:24:00.922355+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activestorage-6.1.5/lib/active_storage/service/registry.rb:13:in `block in fetch'

There are no errors if I configure active storage to use the local disk. Appreciate any assistance or insight.

Update:

Storage.yml

test: service: Disk root: <%= Rails.root.join("tmp/storage") %>
local: service: Disk root: <%= Rails.root.join("storage") %>
amazon: service:S3 access_key_id: "" secret_access_key: region: bucket:

Config/environment/production.rb

require "active_support/core_ext/integer/time"
Rails.application.configure do
config.cache_classes = true
config.active_storage.service = :amazon
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?    
config.assets.compile = false
config.log_level = :info
config.log_tags = [ :request_id ]
config.action_mailer.perform_caching = false
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.active_support.disallowed_deprecation = :log
config.active_support.disallowed_deprecation_warnings = []
config.log_formatter = ::Logger::Formatter.new
ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter=config.log_formatter
config.logger=ActiveSupport::TaggedLogging.new(logger)
end
config.active_record.dump_schema_after_migration = false   
catcon
  • 50
  • 9
  • can you show your `config/storage.yml` and `config/environment/production.rb` – Alex Apr 03 '22 at 18:59
  • @Alex I've updated the original post. – catcon Apr 04 '22 at 21:18
  • 1
    the error you're getting can only happen if in `storage.yml` there is `amazon:` key but nothing in it. can you make sure your `storage.yml` is properly formated; indentation is important. https://edgeguides.rubyonrails.org/active_storage_overview.html#s3-service-amazon-s3-and-s3-compatible-apis – Alex Apr 04 '22 at 21:43
  • I had removed the amazon credentials before posting it here on SO. However, I have previously tried using ENV variables, and even tried putting the credentials directly in the code. I'll go over the edge guides to review potential formatting errors, just in case. Thanks. – catcon Apr 05 '22 at 20:01

0 Answers0