Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error executing commit #186

Open
SPAHI4 opened this issue Jun 26, 2023 · 5 comments
Open

Error executing commit #186

SPAHI4 opened this issue Jun 26, 2023 · 5 comments

Comments

@SPAHI4
Copy link

SPAHI4 commented Jun 26, 2023

Summary

I got this error:

Error: getaddrinfo ENOTFOUND base
    at /Users/anton/WebstormProjects/photo-site/node_modules/.pnpm/[email protected][email protected]/node_modules/pg-pool/index.js:45:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.withClient (/Users/anton/WebstormProjects/photo-site/node_modules/.pnpm/[email protected]/node_modules/graphile-migrate/dist/pgReal.js:73:26)
    at async Object._reset (/Users/anton/WebstormProjects/photo-site/node_modules/.pnpm/[email protected]/node_modules/graphile-migrate/dist/commands/reset.js:16:5)
    at async _commit (/Users/anton/WebstormProjects/photo-site/node_modules/.pnpm/[email protected]/node_modules/graphile-migrate/dist/commands/commit.js:56:5)
    at async handler (/Users/anton/WebstormProjects/photo-site/node_modules/.pnpm/[email protected]/node_modules/graphile-migrate/dist/commands/commit.js:97:9)
    at async Object.newHandler [as handler] (/Users/anton/WebstormProjects/photo-site/node_modules/.pnpm/[email protected]/node_modules/graphile-migrate/dist/cli.js:22:20) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'base'
}

watch works just fine

pnpm exec graphile-migrate watch --once
graphile-migrate: Up to date — no committed migrations to run
[2023-06-26T16:11:14.212Z]: Running current.sql
[2023-06-26T16:11:14.219Z]: current.sql unchanged, skipping migration
[2023-06-26T16:11:14.221Z]: Finished (7ms)

I'm running pnpm

 "graphile-migrate": "^1.4.1"

posgres is running with docker:

  db:
    image: postgres:15.3-alpine
    restart: always
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: app
    ports:
      - 5500:5432

config:

  "connectionString": "postgres://postgres:postgres@localhost:5500/app",
  "shadowConnectionString": "postgres://postgres:postgres@localhost:5500/app_shadow",

nodejs: 20.3.1, 18.16.1

@SPAHI4
Copy link
Author

SPAHI4 commented Jun 26, 2023

OK I found that it is a result of missing ROOT_DATABASE_URL and it becomes template1 by default
I think it needs some kind of warning because no information is confusing.

@SPAHI4 SPAHI4 closed this as completed Jun 26, 2023
@benjie benjie reopened this Jun 26, 2023
@nubunto
Copy link

nubunto commented Jul 11, 2023

I have ROOT_DATABASE_URL set and still having the same problem.

@benjie
Copy link
Member

benjie commented Jul 12, 2023

Most likely you are facing a configuration or environmental variable issue @nubunto.

@mvnetbiz
Copy link

mvnetbiz commented Nov 8, 2023

I also have ROOT_DATABASE_URL set, but I get this error while executing the afterReset hook

Error: connect ECONNREFUSED ::1:5432

My ROOT_DATABASE_URL is for a Unix-domain socket. I can run psql "$ROOT_DATABASE_URL" or other migrate commands successfully.

@mvnetbiz
Copy link

mvnetbiz commented Nov 8, 2023

My issue might be different than nubunto's. I fixed it by using the "socket:" url scheme from https://www.npmjs.com/package/pg-connection-string. It appears not all libpq compatible connection strings are supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants