Michael Bach
Michael Bach

Reputation: 93

Rails configuration failed on Heroku deploy

I have read through all the comments and issues I can find here, but none of them seem to apply to my situation. I have a Ruby on Rails back-end, with React front-end that was deploying fine until I added the ability for an admin to update databases via a CSV file using ActiveRecord.

When I push to Heroku, I now get two warnings:

###### WARNING: Detecting rails configuration failed
##### WARNING: We detected that some binary dependencies required to use all the preview features of Active Storage are not present on this system.

I have gone through the provided Heroku articles on active storage on Heroku, but I am still not able to solve the problem.

Trying to trouble shoot on the Rails console, I get the following error that might be the culprit:

/app/vendor/bundle/ruby/2.5.0/gems/aws-partitions-1.144.0/lib/aws-partitions/endpoint_provider.rb:82:in block in partition_matching_region: Cannot load Rails.config.active_storage.service: (NoMethodError) undefined method match for nil:NilClass

Does anybody have any insight into this problem? I am running into the same stuff that others are discovering: some of these error messages are not the most insightful for me. Thank you!

Upvotes: 9

Views: 4320

Answers (3)

olivrg
olivrg

Reputation: 6443

Another way to resolve this issue is to first get a detailed error log with this command:

heroku run rails console

If there are no errors, you will enter the interactive Ruby shell otherwise you should see the cannot load active storage service error.

If you're using S3, you'll have to set the access key, secret access key, bucket name and bucket region:

SECRET_KEY_BASE:xxx-xxx-xxxxxx-xxx-xxxxxx-xxx-xxx

AWS_ACCESS_KEY_ID: xxx-xxx-xxx

AWS_SECRET_ACCESS_KEY: xxx-xxx-xxxxxx-xxx-xxx

S3_BUCKET_NAME: xxx-xxx-xxx

AWS_BUCKET_REGION: us-east-1

Then load your environment variables to Heroku with: figaro heroku:set -e production

Upvotes: 0

infused
infused

Reputation: 24337

You need to install Heroku's ActiveStorage Previews Buildpack:

heroku buildpacks:add -i 1 https://github.com/heroku/heroku-buildpack-activestorage-preview

This will install the binary tools necessary to generate the asset previews. More information is available here:

Upvotes: 4

Mark
Mark

Reputation: 6445

https://github.com/aws/aws-sdk-ruby/issues/1240 looks like your issue:

This means you haven't configured a region. To configure a region, set the AWS_REGION environment variable, or pass it in as a parameter. For example:

key = OpenSSL::PKey::RSA.new(1024)
s3 = Aws::S3::Encryption::Client.new(encryption_key: key, region: "us-east-1") # or the region you are using

Upvotes: 0

Related Questions