Connecting to Managed Postgres externally

How can I connect to a Fly.io managed PostgreSQL database externally in a CI/CD pipeline for database migrations? I’m encountering an ENOTFOUND error, and even when using fly mpg proxy locally as an intermediate, I receive “error: permission denied for database {db}” despite the dedicated user having schema admin or writer access

What is the URL you’re using after you setup the proxy? It should be a localhost URL with a port. It’s in the output of the proxy command.

One thing you could do for CI/CD is to use the release_command which runs an ephemeral machine in your app specifically for things like migrations: App configuration (fly.toml) · Fly Docs

What is the URL you’re using after you setup the proxy?

localhost:16380

One thing you could do for CI/CD is to use the release_command which runs an ephemeral machine in your app specifically for things like migrations

Thank you, this simplifies my pipelines, but I’m still encountering the same error

2025-07-24T20:31:26Z   query: 'CREATE SCHEMA IF NOT EXISTS "drizzle"',
2025-07-24T20:31:26Z   params: [],
2025-07-24T20:31:26Z   cause: error: permission denied for database fly-db

If this is just a permission problem, what’s my approach to debugging it? The DATABASE_URL I’ve got has writer access, and the postgres user, the only one with superuser privileges to manage permissions, is totally out of reach in the Fly dashboard

Okay, I’ve figured that it is indeed a permission issue since Drizzle ORM forces you to create a schema. Is there a way to get schema access for Managed clusters?

I have the same issue since the introduction of the option to create/manage users and databases directly on the Fly Managed Postgres dashboard

Sorry for the delay here, I missed the notifications; you should be able to create schema now.

If you have issues still, you might have to navigate to your MPG cluster in the dashboard to enable this since your clusters may have existed prior to the change.

If it’s not a huge issue to recreate you could also do that.

If you Still have issues (first of all sorry), feel free to drop a note here, otherwise MPG clusters come with support too and you can should see a Support button on the dashboard under your organization.

1 Like

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