Rails s fails due to database_tasks: false

I am doing rails upgrade from 6.1 to 7.1(specifically 7.1.2). I am using only database replicas in my database.yml file. I have added database_tasks: false in the configs. Due to this, when I run bundle exec rails s it fails giving out following error:

Exiting
/Users/pjartarkar/.rvm/gems/ruby-3.2.2/gems/activerecord-7.1.1/lib/active_record/railtie.rb:151:in `block (3 levels) in <class:Railtie>': undefined method `name' for nil:NilClass (NoMethodError)

              db_config.name,

This is happening because at this line it returns false and db_config is returned as nil value.

Can anybody please help me?

That’s a big jump in versions. I’d recommend going to 6.2 first, fixing deprecation warnings, and then going to 7.0

Yeah, I did go step by step. I facing this in rails 7.x. My understanding is that if you have database_tasks: false in any of the config, then that config is not loaded. But, if all the configs have this database_tasks: false in them, then none of the config will be loaded and will get nil as db_config value. Hence, I wonder if the scenario was considered in rails 7.x, where an app exists where all db configs have this database_tasks: false in them.

No. I don’t think we considered that. Can you open an issue?

Hi! @rafaelfranca , I have opened up an issue Command rails server fails if all db configs have database_tasks: false. Thanks! Let me know.