nocobase/nocobase · error

multi-app-share-collection plugin only support postgres

Error message

multi-app-share-collection plugin only support postgres

What it means

multi-app-share-collection shares collections across sub-applications using PostgreSQL schemas (schema-per-app). beforeEnable checks db.inDialect('postgres') and throws if the database is MySQL, SQLite, MariaDB, etc., because the sharing mechanism depends on Postgres-only features. It then also verifies multi-app-manager is enabled.

Source

Thrown at packages/plugins/@nocobase/plugin-multi-app-share-collection/src/server/plugin.ts:131

      await subApp.db.sequelize.query(`
        SELECT setval('${
          sequenceName[0]['pg_get_serial_sequence']
        }', (SELECT max("id") FROM ${subAppPluginsCollection.quotedTableName()}));
      `);

      await subApp.reload();

      console.log(`sync plugins from ${mainApp.name} app to sub app ${subApp.name}`);
    });
  }
}

export class MultiAppShareCollectionPlugin extends Plugin {
  afterAdd() {}

  async beforeEnable() {
    if (!this.db.inDialect('postgres')) {
      throw new Error('multi-app-share-collection plugin only support postgres');
    }
    const plugin = this.pm.get('multi-app-manager');
    if (!plugin?.enabled) {
      throw new Error(`${this.name} plugin need multi-app-manager plugin enabled`);
    }
  }

  async beforeLoad() {
    if (!this.db.inDialect('postgres')) {
      throw new Error('multi-app-share-collection plugin only support postgres');
    }

    const traverseSubApps = async (
      callback: (subApp: Application) => void,
      options?: {
        loadFromDatabase: boolean;
      },
    ) => {

View on GitHub (pinned to fa42722fef)

Solutions

  1. Switch the NocoBase deployment to PostgreSQL (set DB_DIALECT/DB_* env vars, migrate data) before enabling the plugin.
  2. If Postgres is not an option, do not use multi-app-share-collection; keep per-app databases.
  3. Confirm DB_DIALECT in the environment matches the actually running database server.

Example fix

// before (docker env)
DB_DIALECT=mysql
// after
DB_DIALECT=postgres
DB_HOST=postgres
DB_PORT=5432
Defensive patterns

Strategy: validation

Validate before calling

if (app.db.inDialect('postgres')) {
  await app.pm.enable('multi-app-share-collection');
} else {
  console.warn('multi-app-share-collection requires PostgreSQL; not enabled');
}

Type guard

function supportsShareCollection(db: { inDialect(d: string): boolean }): boolean {
  return db.inDialect('postgres');
}

Try / catch

try {
  await app.pm.enable('multi-app-share-collection');
} catch (e) {
  if (String(e.message).includes('only support postgres')) {
    console.error('Switch to PostgreSQL before enabling this plugin');
  } else throw e;
}

Prevention

When it happens

Trigger: Enabling @nocobase/plugin-multi-app-share-collection on a deployment whose DB dialect is not postgres (e.g. MySQL or SQLite), via the plugin manager or install flow.

Common situations: Dev environments running SQLite while production uses Postgres, migrations from MySQL deployments trying to adopt multi-app sharing, docker images configured with the wrong DB_* env vars.

Related errors


AI-assisted analysis of nocobase/nocobase@fa42722fef (2026-09-01). Data as JSON: /api/errors/8ea8158d6c1045ce. Report an issue: GitHub.