ankane/pghero

ConnectionNotEstablished with Rails 7.1

miharekar opened this issue · 3 comments

First, thanks for the great gem! I rely on it daily!

Now, Rails 7.1 is not released yet, so very low prio, but maybe something that needs looking into.

❯ bin/rails credentials:edit --environment=development
DEPRECATION WARNING: DeprecatedConstantAccessor.deprecate_constant without a deprecator is deprecated (called from <module:Authenticatable> at /Users/miharekar/.gem/ruby/3.2.2/gems/devise-4.9.2/lib/devise/models/authenticatable.rb:65)
/Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/activerecord/lib/active_record/connection_handling.rb:284:in `connection_pool': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/activerecord/lib/active_record/connection_handling.rb:280:in `connection_db_config'
	from /Users/miharekar/.gem/ruby/3.2.2/gems/pghero-3.3.3/lib/pghero.rb:241:in `connection_config'
	from /Users/miharekar/.gem/ruby/3.2.2/gems/pghero-3.3.3/lib/pghero.rb:154:in `default_config'
	from /Users/miharekar/.gem/ruby/3.2.2/gems/pghero-3.3.3/lib/pghero.rb:111:in `config'
	from /Users/miharekar/.gem/ruby/3.2.2/gems/pghero-3.3.3/lib/pghero/engine.rb:20:in `block in <class:Engine>'
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/railties/lib/rails/initializable.rb:32:in `instance_exec'
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/railties/lib/rails/initializable.rb:32:in `run'
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/railties/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /Users/miharekar/.rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:228:in `block in tsort_each'
	from /Users/miharekar/.rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /Users/miharekar/.rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /Users/miharekar/.rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /Users/miharekar/.rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:347:in `each'
	from /Users/miharekar/.rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:347:in `call'
	from /Users/miharekar/.rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:347:in `each_strongly_connected_component'
	from /Users/miharekar/.rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:226:in `tsort_each'
	from /Users/miharekar/.rubies/ruby-3.2.2/lib/ruby/3.2.0/tsort.rb:205:in `tsort_each'
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/railties/lib/rails/initializable.rb:60:in `run_initializers'
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/railties/lib/rails/application.rb:420:in `initialize!'
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/railties/lib/rails/command/actions.rb:27:in `load_environment_config!'
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/railties/lib/rails/commands/credentials/credentials_command.rb:19:in `edit'
	from /Users/miharekar/.gem/ruby/3.2.2/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
	from /Users/miharekar/.gem/ruby/3.2.2/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/railties/lib/rails/command/base.rb:179:in `invoke_command'
	from /Users/miharekar/.gem/ruby/3.2.2/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/railties/lib/rails/command/base.rb:74:in `perform'
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/railties/lib/rails/command.rb:71:in `block in invoke'
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/railties/lib/rails/command.rb:149:in `with_argv'
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/railties/lib/rails/command.rb:69:in `invoke'
	from /Users/miharekar/.gem/ruby/3.2.2/bundler/gems/rails-ae02cd6539d4/railties/lib/rails/commands.rb:18:in `<main>'
	from <internal:/Users/miharekar/.rubies/ruby-3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from <internal:/Users/miharekar/.rubies/ruby-3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from /Users/miharekar/.gem/ruby/3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from bin/rails:6:in `<main>'

It doesn't work if I point gem to current master either. If I remove pghero from the Gemfile it all works well.

rails c and rails s seem to work fine and the /pghero endpoint loads as well.

ankane commented

Hi @miharekar, check out #456.

@ankane I searched for similar issues but apparently not well enough 🤦‍♂️

Thanks!

ankane commented

No worries - pushed a fix in the commit above.