Documenso does not come up after update to 1.6.0
-
==> Create / Migrate db Jul 28 21:46:07 ==> Setting up OIDC Jul 28 21:46:07 => Update site config Jul 28 21:46:09 2025-07-28T19:46:09Z Jul 28 21:46:09 2025-07-28T19:46:09Z Jul 28 21:46:09 2025-07-28T19:46:09Z Jul 28 21:46:09 2025-07-28T19:46:09Z Jul 28 21:46:09 \ Jul 28 21:46:09 \Prisma schema loaded from packages/prisma/schema.prisma Jul 28 21:46:09 Error: P3009 Jul 28 21:46:09 Datasource "db": PostgreSQL database "db831ce9e36aaa4dsab586a1c87917sa89", schema "public" at "postgresql:5432" Jul 28 21:46:09 Jul 28 21:46:09 migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve Jul 28 21:46:09 132 migrations found in prisma/migrations Jul 28 21:46:09 The `20250522054050_add_organisations` migration started at 2025-07-28 19:45:58.163673 UTC failed Jul 28 21:46:11 ==> Create / Migrate db Jul 28 21:46:11 ==> Setting up OIDC Jul 28 21:46:11 => Update site config Jul 28 21:46:13 => Healtheck error: Error: connect ECONNREFUSED 172.18.16.133:3000 -
Seems to be a problem with other apps, too.
WARNING: don't restart your apps if they are mission critical, until we have an answer here.
-
I just tried to reproduce this error and got the following log:
Jul 29 10:31:49 ==> Create / Migrate db Jul 29 10:31:50 => Healthcheck error: Error: connect ECONNREFUSED 172.18.19.52:3000 Jul 29 10:31:51 \Prisma schema loaded from packages/prisma/schema.prisma Jul 29 10:31:51 Datasource "db": PostgreSQL database "db806162892d894b9f84f2eafb933ba9d4", schema "public" at "postgresql:5432" Jul 29 10:31:51 2025-07-29T08:31:51Z Jul 29 10:31:51 132 migrations found in prisma/migrations Jul 29 10:31:51 2025-07-29T08:31:51Z Jul 29 10:31:51 Applying migration `20250522054049_add_id_generator` Jul 29 10:31:51 Applying migration `20250522054050_add_organisations` Jul 29 10:31:51 Applying migration `20250611052525_add_session_revoke_enum` Jul 29 10:31:51 2025-07-29T08:31:51Z Jul 29 10:31:51 The following migration(s) have been applied: Jul 29 10:31:51 2025-07-29T08:31:51Z Jul 29 10:31:51 migrations/ Jul 29 10:31:51 └─ 20250522054049_add_id_generator/ Jul 29 10:31:51 └─ migration.sql Jul 29 10:31:51 └─ 20250522054050_add_organisations/ Jul 29 10:31:51 └─ migration.sql Jul 29 10:31:51 └─ 20250611052525_add_session_revoke_enum/ Jul 29 10:31:51 └─ migration.sql Jul 29 10:31:51 2025-07-29T08:31:51Z Jul 29 10:31:51 All migrations have been successfully applied.The app update was successful, and the app is in a healthy state.
@pepicrft a restore to the previous backup did not work? Did I get this right?
@marcusquinn said in Documenso does not come up after update to 1.6.0:
Seems to be a problem with other apps, too.
What other apps are you experiencing this issue with?
-
Please follow these steps:
While the app is installed and in an error state for version 1.6.0:
- enable the recovery mode in the app settings
- open the web terminal
- insert the following
export DATABASE_URL=postgres://${CLOUDRON_POSTGRESQL_USERNAME}:${CLOUDRON_POSTGRESQL_PASSWORD}@${CLOUDRON_POSTGRESQL_HOST}:${CLOUDRON_POSTGRESQL_PORT}/${CLOUDRON_POSTGRESQL_DATABASE} export NEXT_PRIVATE_DATABASE_URL=postgres://${CLOUDRON_POSTGRESQL_USERNAME}:${CLOUDRON_POSTGRESQL_PASSWORD}@${CLOUDRON_POSTGRESQL_HOST}:${CLOUDRON_POSTGRESQL_PORT}/${CLOUDRON_POSTGRESQL_DATABASE} export NEXT_PRIVATE_DIRECT_DATABASE_URL=postgres://${CLOUDRON_POSTGRESQL_USERNAME}:${CLOUDRON_POSTGRESQL_PASSWORD}@${CLOUDRON_POSTGRESQL_HOST}:${CLOUDRON_POSTGRESQL_PORT}/${CLOUDRON_POSTGRESQL_DATABASE} npx prisma migrate status --schema ./packages/prisma/schema.prisma
Post the output of this command here.
Since each migration in the
_prisma_migrationstable has a logs column that stores the error we can also inspect that with:PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -c "SELECT id,migration_name,started_at,rolled_back_at,logs FROM _prisma_migrations;"and see what migration failed and has logs for further analysis.
For @CaeruleusAqua since the log provided the migration failed is
20250522054050_add_organisationswe can attempt the following while the app is in recovery mode:export DATABASE_URL=postgres://${CLOUDRON_POSTGRESQL_USERNAME}:${CLOUDRON_POSTGRESQL_PASSWORD}@${CLOUDRON_POSTGRESQL_HOST}:${CLOUDRON_POSTGRESQL_PORT}/${CLOUDRON_POSTGRESQL_DATABASE} export NEXT_PRIVATE_DATABASE_URL=postgres://${CLOUDRON_POSTGRESQL_USERNAME}:${CLOUDRON_POSTGRESQL_PASSWORD}@${CLOUDRON_POSTGRESQL_HOST}:${CLOUDRON_POSTGRESQL_PORT}/${CLOUDRON_POSTGRESQL_DATABASE} export NEXT_PRIVATE_DIRECT_DATABASE_URL=postgres://${CLOUDRON_POSTGRESQL_USERNAME}:${CLOUDRON_POSTGRESQL_PASSWORD}@${CLOUDRON_POSTGRESQL_HOST}:${CLOUDRON_POSTGRESQL_PORT}/${CLOUDRON_POSTGRESQL_DATABASE} # Mark the migration as rolled back - this updates the migration record in the _prisma_migrations table to register it as rolled back, allowing it to be applied again: npx prisma migrate resolve --rolled-back 20250522054050_add_organisations --schema ./packages/prisma/schema.prisma # Try to re-deploy the migration npx prisma migrate deploy --schema ./packages/prisma/schema.prisma -
I just tried to reproduce this error and got the following log:
Jul 29 10:31:49 ==> Create / Migrate db Jul 29 10:31:50 => Healthcheck error: Error: connect ECONNREFUSED 172.18.19.52:3000 Jul 29 10:31:51 \Prisma schema loaded from packages/prisma/schema.prisma Jul 29 10:31:51 Datasource "db": PostgreSQL database "db806162892d894b9f84f2eafb933ba9d4", schema "public" at "postgresql:5432" Jul 29 10:31:51 2025-07-29T08:31:51Z Jul 29 10:31:51 132 migrations found in prisma/migrations Jul 29 10:31:51 2025-07-29T08:31:51Z Jul 29 10:31:51 Applying migration `20250522054049_add_id_generator` Jul 29 10:31:51 Applying migration `20250522054050_add_organisations` Jul 29 10:31:51 Applying migration `20250611052525_add_session_revoke_enum` Jul 29 10:31:51 2025-07-29T08:31:51Z Jul 29 10:31:51 The following migration(s) have been applied: Jul 29 10:31:51 2025-07-29T08:31:51Z Jul 29 10:31:51 migrations/ Jul 29 10:31:51 └─ 20250522054049_add_id_generator/ Jul 29 10:31:51 └─ migration.sql Jul 29 10:31:51 └─ 20250522054050_add_organisations/ Jul 29 10:31:51 └─ migration.sql Jul 29 10:31:51 └─ 20250611052525_add_session_revoke_enum/ Jul 29 10:31:51 └─ migration.sql Jul 29 10:31:51 2025-07-29T08:31:51Z Jul 29 10:31:51 All migrations have been successfully applied.The app update was successful, and the app is in a healthy state.
@pepicrft a restore to the previous backup did not work? Did I get this right?
@marcusquinn said in Documenso does not come up after update to 1.6.0:
Seems to be a problem with other apps, too.
What other apps are you experiencing this issue with?
@james All apps that have updated recently now experiencing this issue:
- Docuseal
- Librechat
- n8n
- Postiz
- Privatebin
- StirlingPDF
- Vaultwarden
- Ghost
I just increased the PostGreSQL DB Memory from 1GB to 2GB, and still no joy on app restarts.
-
@james in my case the same migration failed, and when I tried to migrate, I got the following migration error:
Error: P3018 A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve Migration name: 20250522054050_add_organisations Database error code: 23502 Database error: ERROR: null value in column "organisationId" of relation "OrganisationGroup" violates not-null constraint DETAIL: Failing row contains (org_group_wxiansskyyehhuuo, null, INTERNAL_TEAM, MEMBER, null, 1, ADMIN). DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E23502), message: "null value in column \"organisationId\" of relation \"OrganisationGroup\" violates not-null constraint", detail: Some("Failing row contains (org_group_wxiansskyyehhuuo, null, INTERNAL_TEAM, MEMBER, null, 1, ADMIN)."), hint: None, position: None, where_: None, schema: Some("public"), table: Some("OrganisationGroup"), column: Some("organisationId"), datatype: None, constraint: None, file: Some("execMain.c"), line: Some(2006), routine: Some("ExecConstraints") }So it seems the migration is making assumptions on the state of some tables.
-
For anyone running into this, it seems the migration assumes that all teams have a subscription. Until the migration is fixed, you can workaround it by faking a subscription.
-
Prisma schema loaded from packages/prisma/schema.prisma Datasource "db": PostgreSQL database "db831ce9e36aaa4dc1b586a1c879179689", schema "public" at "postgresql:5432" 132 migrations found in prisma/migrations Following migration have not yet been applied: 20250611052525_add_session_revoke_enum To apply migrations in development run prisma migrate dev. To apply migrations in production run prisma migrate deploy. npm notice npm notice New major version of npm available! 10.9.2 -> 11.5.2 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.5.2 npm notice To update run: npm install -g npm@11.5.2 npm notice npx prisma migrate deploy --schema ./packages/prisma/schema.prisma Prisma schema loaded from packages/prisma/schema.prisma Datasource "db": PostgreSQL database "db831ce9e36aaa4dc1b586a1c879179689", schema "public" at "postgresql:5432" Migration 20250522054050_add_organisations marked as rolled back. ┌─────────────────────────────────────────────────────────┐ │ Update available 6.8.2 -> 6.13.0 │ │ Run the following to update │ │ npm i --save-dev prisma@latest │ │ npm i @prisma/client@latest │ └─────────────────────────────────────────────────────────┘ Prisma schema loaded from packages/prisma/schema.prisma Datasource "db": PostgreSQL database "db831ce9e36aaa4dc1b586a1c879179689", schema "public" at "postgresql:5432" 132 migrations found in prisma/migrations Applying migration `20250522054050_add_organisations` Error: P3018 A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve Migration name: 20250522054050_add_organisations Database error code: 23502 Database error: ERROR: null value in column "organisationId" of relation "OrganisationGroup" violates not-null constraint DETAIL: Failing row contains (org_group_dyzbocwtyozutncz, null, INTERNAL_TEAM, MEMBER, null, 1, ADMIN). DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E23502), message: "null value in column \"organisationId\" of relation \"OrganisationGroup\" violates not-null constraint", detail: Some("Failing row contains (org_group_dyzbocwtyozutncz, null, INTERNAL_TEAM, MEMBER, null, 1, ADMIN)."), hint: None, position: None, where_: None, schema: Some("public"), table: Some("OrganisationGroup"), column: Some("organisationId"), datatype: None, constraint: None, file: Some("execMain.c"), line: Some(2006), routine: Some("ExecConstraints") } -
Hello @CaeruleusAqua
@pepicrft linked the workaround here@pepicrft said in Documenso does not come up after update to 1.6.0:
For anyone running into this, it seems the migration assumes that all teams have a subscription. Until the migration is fixed, you can workaround it by faking a subscription.
Either you can apply this yourself or you will have to wait until Documenso releases a new Update fixing this issue.
-
I ran into the same 20250522054050_add_organisations migration failure on a self-hosted Docker instance and spent some time digging into the root cause. The "fake subscription" workaround that's been floating around doesn't fully solve it — the issue goes deeper than a missing Subscription record.
I was able to fully resolve it and migrate from v1.8.1 → v2.6.0 with all 17 pending migrations applied and data intact. Posted details on the GitHub issue here: https://github.com/documenso/documenso/issues/1880
If anyone's still stuck on this and wants help getting unstuck, feel free to reach out. -
Hello @giniw88 and welcome to the Cloudron Forum
I have removed your mail address self-promotion since you are new to the forum due to missing reputation.
If you want to provide help with this issue, do it here in the forum publicly, so everyone can benefit from it.
Also, please keep in mind this is the Cloudron Forum and not a generic 'self-hosted Docker' support forum. -
The root cause is that self-hosted Teams have no customerId (Stripe ID). The migration copies it onto the Subscription, gets NULL, then deletes the Subscription. Run these before upgrading:
sqlUPDATE "Team" SET "customerId" = 'cus_selfhosted_' || id WHERE "customerId" IS NULL;Then create Subscription records for any Teams missing them. If you've already attempted the upgrade and it failed, you'll also need to clean up 10 partially-created tables before retrying.