I have deploy my Rails application on Fly.io with success, everithing work fine except one thing. when i recond one product i have this error on my error monioring
ArgumentError: key must be 32 bytes
happend on this file (Gem)
[GEM_ROOT]/gems/activesupport-7.0.4/lib/active_support/message_encryptor.rb:172:in `key='
cipher = new_cipher
cipher.encrypt
cipher.key = @secret
Everithing work fine on local, but on Fly.io i have this error.
Please, i don’t know what happend
thanks
Using Ruby “3.1.2” and Rails 7.0.4
rubys
December 9, 2022, 7:00pm
2
It looks like your RAILS_MASTER_KEY
is not set correctly. This key is typically in config/master.key
, but may be in config/credentials/production.key
.
That value should be 32 hexadecimal characters. Run the following command:
fly secrets set RAILS_MASTER_KEY=61f544e7e5560326b7d0933e71c9ad08
… replacing the 32 hex characters in the line above with the value from your master key.
Hey folks,
I am having the same issues. Just trying out fly deploy
All env variables are set
RAILS_MASTER_KEY=<16 bytes>
Same is in the credentials.
bin/rails aborted!
ArgumentError: key must be 16 bytes (ArgumentError)
cipher.key = @secret
^^^^^^^
/app/config/environment.rb:8:in `<main>'
/app/bin/rails:6:in `<main>'
I am able to run the build locally, tho.
Ok super accidental but this is what worked for me
bin/rails credentials:edit
You save your 16 byte string there.
then cat config/master.key
copy its value into fly secrets set RAILS_MASTER_KEY=<your key from master.key>