Rails credentials gone bad
It’d be boring if you didn’t start you day with a nice error message,
no matter what I tried, even editing the credentials gave an error.
Here’s the one I got today, and some quick look into
showed me that something was wrong with the credentials.
rescue in _decrypt': ActiveSupport::MessageEncryptor::InvalidMessage
The credentials.yml.enc had been modified in the repo just slightly during a merge conflict and though they were now the same again, it didn’t play along. Maybe a newline or something?
Anyways, I went straight for a solution by resetting the repo to before the change to
credentials.yml.enc file, run
to copy its contents into a temporary file, back to the terminal, reset to
rails credentials:edit again and paste in the contents from the temporary file.