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

db-migrate command timing out when called from Docker #814

Open
1 task done
dschinkel opened this issue Apr 16, 2023 · 2 comments
Open
1 task done

db-migrate command timing out when called from Docker #814

dschinkel opened this issue Apr 16, 2023 · 2 comments

Comments

@dschinkel
Copy link

dschinkel commented Apr 16, 2023

I'm submitting a...

  • Question

Current behavior

I am running the following in my Docker Container:

Expected behavior

After container runs my db-migrate command, it's able to connect to the database without timing out.

Dockerfile

...some stuff and then:
CMD [ "node_modules/db-migrate/bin/db-migrate", "up:production", "-e", "production" ]

Minimal reproduction of the problem with instructions

When I push my container up to Google Cloud, and Cloud Run tries to run my container, and I get this error in Google Cloud logs when db-migrate is run from my container

2023-04-16 00:14:51.027 CDT
at /app/node_modules/db-migrate/lib/commands/up.js:19:14
2023-04-16 00:14:51.027 CDT
at /app/node_modules/db-migrate/connect.js:17:7
2023-04-16 00:14:51.027 CDT
at /app/node_modules/db-migrate/lib/driver/index.js:95:9
2023-04-16 00:14:51.027 CDT
at Client._connectionCallback (/app/node_modules/db-migrate-pg/index.js:710:7)
2023-04-16 00:14:51.027 CDT
at Client._handleErrorWhileConnecting (/app/node_modules/pg/lib/client.js:318:19)
2023-04-16 00:14:51.027 CDT
at Client._handleErrorEvent (/app/node_modules/pg/lib/client.js:328:19)
2023-04-16 00:14:51.027 CDT
at Connection.emit (node:events:527:28)
2023-04-16 00:14:51.027 CDT
at Socket.reportStreamError (/app/node_modules/pg/lib/connection.js:57:12)
2023-04-16 00:14:51.027 CDT
at Socket.emit (node:events:527:28)
2023-04-16 00:14:51.027 CDT
at emitErrorNT (node:internal/streams/destroy:151:8)
2023-04-16 00:14:51.027 CDT
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
2023-04-16 00:14:51.027 CDT
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
2023-04-16 00:14:51.027 CDT
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1195:16)
2023-04-16 00:14:51.089 CDT
Container called exit(1).
2023-04-16 00:14:51.126 CDT
Cloud Runv1database-migrations-00094-quw {@type: type.googleapis.com/google.cloud.audit.AuditLog, methodName: v1, resourceName: namespaces/wedotdd-1349/revisions/database-migrations-00094-quw, response: {…}, serviceName: run.googleapis.com, status: {…}}
2023-04-16 00:14:51.224 CDT
Cloud Runv1database-migrations {@type: type.googleapis.com/google.cloud.audit.AuditLog, methodName: v1, resourceName: namespaces/wedotdd-1349/services/database-migrations, response: {…}, serviceName: run.googleapis.com, status: {…}}
2023-04-16 00:24:18.453 CDT
Cloud RunReplaceServicedatabase-migrationswedotdd-graphql@wedotdd-1349.iam.gserviceaccount.com {@type: type.googleapis.com/google.cloud.audit.AuditLog, authenticationInfo: {…}, authorizationInfo: […], methodName: google.cloud.run.v1.Services.ReplaceService, request: {…}, requestMetadata: {…}, resourceLocation: {…}, resourceName: namespaces/wedotdd-1349/services/database-migrations, response: …
2023-04-16 00:26:36.602 CDT
[ERROR] AssertionError [ERR_ASSERTION]: ifError got unwanted exception: connect ETIMEDOUT XX.XXX.XXX.XXX:5432

(NOTE: I replaced the real IP for the DB with X's for this post to hide it here)

I saw that there was in the past in one of the issues a acquireTimeout database prop the creator of db-migrate suggested but I tried that and I don't see that in the docs so I don't know that it's a thing anymore. If not a thing I'm not sure how to add a timeout for db-migrate.

Environment

db-migrate version: ^0.11.13
plugins with versions: "^1.2.2"
db-migrate driver with versions: PostgreSQL 12.12

Additional information:

  • Node version: 18.x
  • Platform: Linux via node:18.1.0-alpine docker image
@oleghind
Copy link

oleghind commented Jun 6, 2023

Did you find a solution? I can't locate acquireTimeout anywhere in the code

@oleghind
Copy link

oleghind commented Jun 6, 2023

I think this helped me:

"acquireTimeout": 1000000,
"connectTimeout": 1000000

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

2 participants