I recently deleted my local project but did a git clone and picked up from where I last committed. As I tried to upload images to AWS, which was already configured, I got this error:
Aws::Sigv4::Errors::MissingCredentialsError in RentalsController#create
Cannot load `Rails.config.active_storage.service`: missing credentials, provide credentials with one of the following options: - :access_key_id and :secret_access_key - :credentials - :credentials_provider
I tried to look at my credentials.yml
file for any error but when I input this command:
EDITOR="code --wait" rails credentials:edit
...I get this error:
Couldn't decrypt config/credentials.yml.enc. Perhaps you passed the wrong key?
What could be the problem?
You are missing the master.key
When you create a new project, rails will setup the credentials.yml.enc
and a matching master.key
file to access the credentials. The master.key
file will also automatically be added to the gitignore, so if you delete your project local and clone it again your master.key
will be lost.
The only way to fix this is by setting up new credentials.yml.enc
and add your AWS credentials to it again.
First you need to remove the existing credentials.yml.enc
and then run:
rails credentials:edit
to create a new one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With