Rails not able to decrypt credentials with master.key

Viewed 18

I just generated a new config/master.key by running EDITOR="code --wait" bin/rails credentials:edit yesterday.

Today I started trying to run other commands like, a basic example bundle exec rails and I am getting this.

message_encryptor.rb:206:in `rescue in _decrypt': ActiveSupport::MessageEncryptor::InvalidMessage (ActiveSupport::MessageEncryptor::InvalidMessage)

&

/activesupport-5.2.4/lib/active_support/message_encryptor.rb:201:in `final': OpenSSL::Cipher::CipherError

These were the errors that prompted me to run EDITOR="code --wait" bin/rails credentials:edit to begin with, but now I have the config/master.key.

I've also added RAILS_MASTER_KEY=*** to my .env (as a troubleshooting step). That hasn't helped.

When I attempt to decrypt it with EDITOR="code --wait" bin/rails credentials:edit, I get the same error.

Not sure what the issue could be since I have the key, I just made it and I am not doing operations that actually involve decrypting & I am still getting the same error. It feels like a broken process.

0 Answers
Related