PG::ConnectionBad: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory (PG::ConnectionBad)

I have a Rails 8 app running on render, which was working well since today. I have further development, but deployment was aborted with following error:

ActiveRecord::ConnectionNotEstablished: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory 

(ActiveRecord::ConnectionNotEstablished)Is the server running locally and accepting connections on that socket?connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory

I haven’t change my config.
database.yml:

production:
  primary:
    <<: *default
    url: <%= ENV["DATABASE_URL"] %>

In the environment of my app on render I have the Internal Database URL:

 DATABASE_URL = postgresql://<username>:<pw>@dpg-d283eum3jp1c73ftvarg-a/<dbname>

Web Service and Database are running in the same region (frankfurt)
In the “Build Command” field: bin/render-build.sh

And render-build.sh (as recommended by render):

#!/usr/bin/env bash

set -o errexit

bundle install
bin/rails assets:precompile
bin/rails assets:clean

bin/rails db:migrate

The app is running good - but in a previous version -, connection to the database is working very well.
But only if I deploy the new version or - for example - the latest commit from github, it is aborting with a build failure and the message I quoted above. Even If I do “Clear build cache & deploy”.

Also restarting the service does not change anything.

I am a little bit confused and don’t know what to do next.

Has anyone an idea? I really would appreciate it.
Kind regards
Jens

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.