I’m trying out Sharetribe Community Edition on a Debian 10 server (not AWS) following these instructions: https://github.com/sharetribe/sharetribe#installation
I am stuck on step 7 with the following error:
Aws::Sigv4::Errors::MissingCredentialsError: missing credentials,
provide credentials with one of the following options::access_key_id and :secret_access_key :credentials :credentials_provider
However, Rails knows that I am not using Amazon but rather local storage because I have the following two settings:
File: config/environments/development.rb
config.active_storage.service = :local
File: config/environments/production.rb
config.active_storage.service = :local
After changing those settings, I ran the following command:
~/sharetribe$ EDITOR=“sub1 --wait” bin/rails credentials:edit
And got the output below:
Adding config/master.key to store the master encryption key:
[REDACTED]Save this in a password manager your team can access. If you lose the
key, no one, including you, can access anything encrypted with it.create config/master.key
Ignoring config/master.key so it won’t end up in Git history:
append .gitignore
New credentials encrypted and saved.
But after running this:
~/sharetribe$ bundle exec rake db:create db:structure:load
I get the error above.
Edit: Here’s config/storage.yml. Not sure if I should comment out the Amazon section
test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
local:
service: Disk
root: <%= Rails.root.join("storage") %>
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
amazon:
service: S3
access_key_id: <%= APP_CONFIG.aws_access_key_id%>
secret_access_key: <%= APP_CONFIG.aws_secret_access_key %>
region: <%= APP_CONFIG.s3_region %>
bucket: <%= APP_CONFIG.clp_s3_bucket_name %>
upload:
acl: "public-read"
cache_control: 'max-age=3600'
TLDR: I want to store Sharetribe’s database in its own server but Rails keeps asking for AWS/Amazon credentials despite local setting
2
Answers
Sharetribe has the
aws-sdk-ruby
as a dependency (see: https://github.com/sharetribe/sharetribe/blob/master/Gemfile#L34).The
aws-sdk-ruby
needs a configuration file with the AWS credentials set in order to run. This file lives at~/.aws/credentials
and has this format:This has been documented on the README file here (https://github.com/aws/aws-sdk-ruby#configuration) and also on this blog post: https://aws.amazon.com/blogs/security/a-new-and-standardized-way-to-manage-credentials-in-the-aws-sdks.
Initially, I could not replicate your problem because I do have that file present on my local machine. However, as soon as I delete the
~/.aws/credentials
I’m able to replicate the issue.I had this problem, and solved it like so:
In Storage.yml comment out the whole Amazon block, similar to how the google block is commented out.
In production.rb config.active_storage.service = :local