qm icon indicating copy to clipboard operation
qm copied to clipboard

Fresh install on Fly Managed Postgres fails: `REVOKE ALL ON FUNCTION … FROM PUBLIC` is rejected ("MPG system roles cannot be modified")

Open conq0110 opened this issue 4 days ago • 0 comments

Summary

A fresh qm up on the Fly target with Fly Managed Postgres cannot start core. Database initialization runs REVOKE ALL ON FUNCTION qm_self_serve_tenant(text, text, text), qm_self_serve_provisioned(uuid, text) FROM PUBLIC, and Fly Managed Postgres rejects it:

error: MPG system roles cannot be modified

Core exits on boot and the deploy is rolled back.

docs/upgrading-runtime.md already notes that Fly Managed Postgres rejects grants to PUBLIC, and the boot and serving tenant functions were changed to avoid them. The self-serve tenant functions still revoke from PUBLIC. On main (3f5a322), db/schema.sql lines 5489–5495 contain the same pattern for four functions (qm_external_org_account_check, qm_external_org_account_differs, qm_self_serve_provisioned, qm_self_serve_tenant), so I expect a fresh install from main to fail the same way (I have not run main itself).

Steps to reproduce

  1. npm i @yc-software/[email protected], qm init --target fly (region nrt), qm setup, qm secrets push
  2. qm up — creates a new Fly Managed Postgres cluster (Basic) and stages its direct_uri as DATABASE_URL
  3. Core logs error: MPG system roles cannot be modified during initialization and never passes health checks

Environment

  • QM 0.1.20 (next), Fly target, region nrt, fresh database
  • Fly Managed Postgres, Basic plan, new cluster created by qm up
  • 0.1.18 fails earlier on the same database with the migration-ownership check (#3379, fixed on main)

Workaround

Pointing DATABASE_URL at an unmanaged Fly Postgres app (full superuser) works.

conq0110 avatar Dec 01 '26 07:12 conq0110