solid_queue: Database connection error in Solid Queue, but not Rails app
My syslog keeps filling up with errors like:
ActiveRecord::DatabaseConnectionError: There is an issue connecting with your hostname: <<DB SERVER IP>>. (ActiveRecord::DatabaseConnectionError)
Please check your database configuration and ensure there is a valid connection to your database.
...stack trace removed...
PG::ConnectionBad: connection to server at "<<DB SERVER IP>>", port 5432 failed: fe_sendauth: no password supplied (PG::ConnectionBad)
I’m assuming Solid Queue is using the config/database.yml from my Rails app to connect to Postgres:
production:
<<: *default
database: purchasing_production
host: <<DB SERVER IP>>
port: 5432
username: postgres
password: <%= ENV["POSTGRES_PASSWORD"] %>
The Rails app is able to connect fine. I have checked that the POSTGRES_PASSWORD environment variable is set. I’ve also verified there’s only one Solid Queue process running.
Oddly enough, when I send email with the deliver_later method, the emails are properly sent. So it seems that Solid Queue is processing something, but not able to connect to the database? What am I missing here?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 24 (9 by maintainers)
This is related to the environment variable. If I temporarily plug in the actual password in my
config/database.ymlfile, solid queue starts up without issue:But I can’t figure out why it isn’t finding that
ENV["POSTGRES_PASSWORD"]. It is available if I login as the deployer user that is running the solid queue process. And the process itself seems to be running alright:I’m not using a different adapter for action mailer, at least not purposely. I’m just calling the
deliver_latermethod “bare”, without any parameters. And searching through my config files, the only thing I’ve set is the overall queue adapter inconfig/production.rb, per the solid queue instructions.