Got deprecation warning secrets is deprecated while I do not use secrets at all

I’m getting the following deprecation warning:

DEPRECATION WARNING: `Rails.application.secrets` is deprecated in favor of `Rails.application.credentials` and will be removed in Rails 7.2. (called from <top (required)> at /.../config/environment.rb:7)

However, I stopped using secrets or encrypted credentials long ago. Now everything is passed at runtime and I do not store anything secret in the repository. The offending line in config/environment.rb:7 is just loading the rails app:

# frozen_string_literal: true

# Load the Rails application.
require_relative 'application'

# Initialize the Rails application.
Rails.application.initialize! # <-- this is line 7

So, Rails.application.initialize! is producing the warning. Is there something I should look at that will stop working in Rails 7.2 or should I ignore this warning?

1 Like

Would you be able to run your app with BACKTRACE=1 and/or share the rest of the backtrace? That should help make it clear what is trying to use secrets

I’m having the same issue only when running rspec. In the config/environments/test.rb file there is nothing related to secrets and BACTRACE=1 didn’t show anything.

Thoughts? rails-rspec is up to date

Another way to find the full backtrace would be changing the deprecation configuration to raise instead of log in config/environments/test.rb:

config.active_support.deprecation = :raise
2 Likes

See Deprecation - Rails.application.secrets · Issue #5644 · heartcombo/devise · GitHub

1 Like