3

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

filipeamoreira
  • 97
  • 1
  • 13
eni41
  • 31
  • 1
  • 5
  • Can you post the contents of the `storage.yml` file? Specifically, make sure the `local` directive points to `Disk`. – filipeamoreira Jul 22 '20 at 18:52
  • Thanks. Just added it – eni41 Jul 22 '20 at 19:06
  • If I comment out the Amazon section altogether I get this error: Missing configuration for the :amazon Active Storage service. Configurations available for [:test, :local] – eni41 Jul 22 '20 at 19:17

2 Answers2

3

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:

[default]
aws_access_key_id = YOUR_ACCESS_KEY
aws_secret_access_key = YOUR_SECRET_ACCESS_KEY

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.

filipeamoreira
  • 97
  • 1
  • 13
1

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

Sergio Flores
  • 439
  • 2
  • 8
  • This means that your files are going to be stored locally, instead of remotely. Big problem as many other people that are not your local machine will need to access these files. – Thomas Jun 22 '23 at 16:18
  • Actually the OP is asking for local storage, so this makes sense. Though for anyone not wanting to restrict their files to a local device, this wouldn't work. – Thomas Jun 22 '23 at 16:20