Error deploying with Kamal 2

Hi. Im getting an error when deploying using kamal2 and a Rails 8 app, I’ve been deploying all day (ok about 3 times) without an issue and then I get the errors below.

Running up to this error I added postmark as my Mailer. I ran EDITOR="nvim" rails credentials:edit --environment production and added the postmark api key there.

I think my main train of thought at the moment is that its a environment variable and i messed something up with the credentials.

So first question: Am i correct in thinking that the credentials are the issue here and that ive messed that up?

Second question: How do i fix that! The app itself is technically in a production environment but not public to the world so no big deal on that end.

Third question: Wheres the best resource to find out how the credentials work in detail in Rails 8. I’ve been looking around trying to find answers but i seem to get older posts/articles about env files and so on but nothing on the latest rails and kamal.

Cheers

  Finished all in 258.5 seconds
  ERROR (SSHKit::Command::Failed): Exception while executing on host 64.227.37.17: docker exit status: 1
docker stdout: Nothing written
docker stderr: bash: warning: setlocale: LC_ALL: cannot change locale (en_GB.UTF-8)
Error: target failed to become healthy within configured timeout (30s)

Further up the list theres this error:

 ERROR 2025-08-12T17:09:55.149051062Z bin/rails aborted!
2025-08-12T17:09:55.149390063Z ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
2025-08-12T17:09:55.149812668Z /usr/local/bundle/ruby/3.4.0/gems/activesupport-8.0.2/lib/active_support/messages/codec.rb:57:in 'ActiveSupport::Messages::Codec#catch_and_raise'
2025-08-12T17:09:55.149847180Z /usr/local/bundle/ruby/3.4.0/gems/activesupport-8.0.2/lib/active_support/message_encryptor.rb:242:in 'ActiveSupport::MessageEncryptor#decrypt_and_verify'
2025-08-12T17:09:55.149852634Z /usr/local/bundle/ruby/3.4.0/gems/activesupport-8.0.2/lib/active_support/encrypted_file.rb:109:in 'ActiveSupport::EncryptedFile#decrypt'
2025-08-12T17:09:55.149857381Z /usr/local/bundle/ruby/3.4.0/gems/activesupport-8.0.2/lib/active_support/encrypted_file.rb:72:in 'ActiveSupport::EncryptedFile#read'
2025-08-12T17:09:55.149862129Z /usr/local/bundle/ruby/3.4.0/gems/activesupport-8.0.2/lib/active_support/encrypted_configuration.rb:63:in 'ActiveSupport::EncryptedConfiguration#read'
2025-08-12T17:09:55.149867208Z /usr/local/bundle/ruby/3.4.0/gems/activesupport-8.0.2/lib/active_support/encrypted_configuration.rb:86:in 'ActiveSupport::EncryptedConfiguration#config'
2025-08-12T17:09:55.149872301Z /usr/local/bundle/ruby/3.4.0/gems/activesupport-8.0.2/lib/active_support/encrypted_configuration.rb:113:in 'ActiveSupport::EncryptedConfiguration#options'
2025-08-12T17:09:55.149877357Z /usr/local/bundle/ruby/3.4.0/gems/activesupport-8.0.2/lib/active_support/delegation.rb:186:in 'ActiveSupport::EncryptedConfiguration#method_missing'
2025-08-12T17:09:55.149882062Z /rails/config/application.rb:22:in '<class:Application>'
2025-08-12T17:09:55.149887341Z /rails/config/application.rb:10:in '<module:ExpostWebsite>'
2025-08-12T17:09:55.149891826Z /rails/config/application.rb:9:in '<main>'
2025-08-12T17:09:55.149896304Z /rails/Rakefile:4:in 'Kernel#require_relative'
2025-08-12T17:09:55.149900802Z /rails/Rakefile:4:in '<main>'

Key/value pairs in Rails credentials are available to the app, but aren’t available to Kamal unless you specifically make them available via the .kamal/secrets (.kamal/secrets.production if you’re using different deploy targets).

Kamal secrets are a bit convoluted, and extracting from Rails credentials is maybe the least pleasant. Kamal — Environment variables might explain what you need to get that value available to Kamal during deployment.