Can't migrate or seed postgres database upon deploy

Hello

Using Ruby on Rails and postgresql on the free subscription. When I uncomment the bundle exec rails db:migrate in bin/render-build.sh, its causing the following error:

bin/rails aborted!
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?
Caused by:
PG::ConnectionBad: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory (PG::ConnectionBad)
	Is the server running locally and accepting connections on that socket?
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
==> Build failed 😞
==> Common ways to troubleshoot your deploy: https://render.com/docs/troubleshooting-deploys

Prior to this, everything appeared to be working. This is the setup for my render.yml and database.yml respectively

databases:
- name: my_app
  databaseName: my_app_production_xxxx
  user: my_app
  plan: free
  region: my region
  ipAllowList:
  - source: 0.0.0.0/0
    description: everywhere
  postgresMajorVersion: "16"

version: "1"

services:
  - type: web
    name: my_app
    runtime: ruby
    plan: free
    buildCommand: "./bin/render-build.sh"
    startCommand: "bundle exec rails server"
    envVars:
      - key: DATABASE_URL
        fromDatabase:
          name: my_app
          property: connectionString
      - key: RAILS_MASTER_KEY
        sync: false
      - key: WEB_CONCURRENCY
        value: 2 # sensible default
production:
  primary: &primary_production
    <<: *default
    database: my_app_production
    username: my_app
    password: <%= ENV["MY_APP_DATABASE_PASSWORD"] %>
  cache:
    <<: *primary_production
    database: my_app_production_cache
    migrations_paths: db/cache_migrate
  queue:
    <<: *primary_production
    database: my_app_production_queue
    migrations_paths: db/queue_migrate
  cable:
    <<: *primary_production
    database: my_app_production_cable
    migrations_paths: db/cable_migrate

Any ideas? I’ve tried copying over the internal URL and getting it connect that way but not luck so I’m a bit at a loss as it was working before trying to migrate.

Hi,

That error looks like something is misconfigured with the database connection.

I see you have also opened a ticket, so I’ve responded there.