Skip to content

Commit 6bb7436

Browse files
committed
small edits
1 parent 07ccde7 commit 6bb7436

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

posts/2025-08-01-watch-out-for-this-one-deprecation-warning-when-upgrading-from-rails-7-dot-1-to-7-dot-2-on-heroku.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,17 @@ The deprecation warning was:
2525
[DEPRECATION] DEPRECATION WARNING: `Rails.application.secrets` is deprecated
2626
in favor of `Rails.application.credentials` and will be removed in Rails 7.2.
2727
```
28+
We moved all the secrets and encrypted secrets to the credentials file.
29+
30+
We also moved the `secret_key_base` to credentials because it's the default place for this secret since introduction of the credentials feature in Rails 5.2.
2831

2932
We removed values from `ENV["SECRET_KEY_BASE"]` to credentials and checked that the value was correct by calling
3033
`Rails.application.credentials.secret_key_base`.
3134

3235
It turned out that you can also get the secret_key_base by calling `Rails.application.secret_key_base`.
3336

3437

35-
Let's take a look at this code:
38+
Let's take a look at this code:
3639

3740
```ruby
3841
def secret_key_base
@@ -52,11 +55,11 @@ Ok so to sum it up, until now:
5255

5356
Right? But instead...
5457

55-
Instead it failed silently. So where’s the poop?
58+
Instead it failed silently. **All the cookies become invalid**. So where’s the poop?
5659

5760
<img src="<%= src_original("deprecation_warning_rails_7-1_to_7-2/himym-wheres.gif") %>" width="100%">
5861

59-
The poop is in Heroku trying to be smarter than developers. Unfortunately. It turned out that removing `SECRET_KEY_BASE` env leads to.. regenerating it with new **random** value.
62+
The poop is in Heroku trying to be smarter than developers. Unfortunately. It turned out that removing `SECRET_KEY_BASE` env leads to... regenerating it with new **random** value.
6063

6164
So our external devices depending on it couldn’t work because of new, randomly generated key.
6265

@@ -65,5 +68,5 @@ To sum it up:
6568
- If you’re getting rid of the `Rails.application.secrets` is deprecated in favor of `Rails.application.credentials` and will be removed in Rails 7.2
6669
- And you’re on Heroku
6770
- And you’re using Heroku Buildpacks
68-
- Make sure you keep `SECRET_KEY_BASE` in both credentials and in Heroku ENV variable
71+
- Make sure you keep `SECRET_KEY_BASE` in both credentials and in Heroku config variable. Or at least in the latter.
6972
- Either way... you may end up in nasty silent error. Which is not good.

0 commit comments

Comments
 (0)