{"record":{"id":"c591d30a9f369d86","repo":"paperclipai/paperclip","slug":"authenticated-public-deployments-require-database","errorCode":null,"errorMessage":"authenticated public deployments require DATABASE_URL or config.database.connectionString; refusing embedded PostgreSQL fallback","messagePattern":"authenticated public deployments require DATABASE_URL or config\\.database\\.connectionString; refusing embedded PostgreSQL fallback","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/src/index.ts","lineNumber":321,"sourceCode":"      throw migrationRefusalError(\n        state,\n        `${label} has pending migrations (${formatPendingMigrationSummary(state.pendingMigrations)}). ` +\n          \"Refusing to start against a stale schema. Run pnpm db:migrate or set PAPERCLIP_MIGRATION_AUTO_APPLY=true.\",\n      );\n    }\n\n    logger.info({ pendingMigrations: state.pendingMigrations }, `Applying ${state.pendingMigrations.length} pending migrations for ${label}`);\n    await applyPendingMigrations(connectionString);\n    return \"applied (pending migrations)\";\n  }\n  \n  function isPostgresConnectionString(connectionString: string): boolean {\n    try {\n      const parsed = new URL(connectionString);\n      return parsed.protocol === \"postgres:\" || parsed.protocol === \"postgresql:\";\n    } catch {\n      return false;\n    }\n  }\n\n  function assertCloudDatabaseContract(): void {\n    if (config.deploymentMode !== \"authenticated\" || config.deploymentExposure !== \"public\") {\n      return;\n    }\n    if (!config.databaseUrl) {\n      // Under a managed-cloud supervisor a missing DATABASE_URL on boot\n      // is the config-application race (the container can start before\n      // the staged variables land), not operator error — the supervisor\n      // restarts once the config holds. A malformed value below is a\n      // real misconfiguration and stays an always-reported Error.\n      throw new StartupRefusalError(\n        \"database-contract-unmet\",\n        \"authenticated public deployments require DATABASE_URL or config.database.connectionString; refusing embedded PostgreSQL fallback\",\n      );\n    }\n    if (!isPostgresConnectionString(config.databaseUrl)) {","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/index.ts#L303-L339","documentation":"Deployment contract guard in assertCloudDatabaseContract: the server runs in authenticated mode with public exposure, but no DATABASE_URL / config.database.connectionString is configured. Refusing to fall back to embedded PostgreSQL, since an internet-exposed authenticated deployment must not run on an unsecured embedded database.","triggerScenarios":"Thrown at server/src/index.ts:255 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set DATABASE_URL (or config.database.connectionString) to an external Postgres database for authenticated public deployments.","Use a non-public exposure mode if you want the embedded PostgreSQL fallback."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}