I have rails 7 with the Ruby 3.1.1 application, It's using Amazon S3 for storing images, I have added AWS credentials as well on the app. I have deployed the app to Heroku, ran the migration, and added all the environment variables on Heroku, but when I try to access the Heroku link, I get this error:
"missing credentials, provide credentials with one of the following options: (Aws::Sigv4::Errors::MissingCredentialsError)
- :access_key_id and :secret_access_key
- :credentials
- :credentials_provider"
Has anyone ever had this kind of a problem? How did you correct it?
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: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
region: <%= Rails.application.credentials.dig(:aws, :region) %>
bucket: <%= Rails.application.credentials.dig(:aws, :bucket) %>
development.rb/production.rb
config.active_storage.service = :amazon
EDITOR="code --wait" rails credentials:edit
aws:
access_key_id: ******
secret_access_key: *******
region: *******
bucket: *******
I have added also a RAILS_MASTER_KEY env var on Heroku but still I get an error.