Help me please, I\'ve finished 11 chapters of the rails tutorial, deployed my app to heroku (locally it worked perfectly) and it crashing all time. I\'m using rails 5.2.2 Af
I had this issue when working on a Rails 6 application in Ubuntu 20.04.
The issue was that I was setting/specifying a wrong RAILS_MASTER_KEY
environment variable in my .env
files in development (.env
, .env.development
). I just wanted to use it as a placeholder temporarily since I did not need it in my development environment.
This was then throwing the error below when I run a rails command, say rails generate uploader ProductImage
:
`rescue in _decrypt': ActiveSupport::MessageEncry ptor::InvalidMessage (ActiveSupport::MessageEncryptor::InvalidMessage)
And even when I try generating a new master.key
and the credentials.yml.enc
files using rails credentials:edit
or EDITOR="code --wait" bin/rails credentials:edit
it throws the error below:
key=': key must be 16 bytes (ArgumentError)
Here's how to fix it:
What you have to do is to either provide the correct RAILS_MASTER_KEY
environment variable in the .env
file(s) or comment out the RAILS_MASTER_KEY
environment variable if you are not using it.
That's it.
I hope this helps