Skip to content

Comments

Fix #1612: Self-hosted deployments break on update due to missing datab#1626

Open
danielalanbates wants to merge 1 commit intoCapSoftware:mainfrom
danielalanbates:fix/issue-1612
Open

Fix #1612: Self-hosted deployments break on update due to missing datab#1626
danielalanbates wants to merge 1 commit intoCapSoftware:mainfrom
danielalanbates:fix/issue-1612

Conversation

@danielalanbates
Copy link

@danielalanbates danielalanbates commented Feb 21, 2026

Fixes #1612

Summary

This PR addresses: Self-hosted deployments break on update due to missing database migrations

Changes

packages/database/migrate.ts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Testing

Please review the changes carefully. The fix was verified against the existing test suite.


This PR was created with the assistance of Claude Sonnet 4.6 by Anthropic | effort: low. Happy to make any adjustments!

Greptile Summary

Fixed critical bug where migrateDb() was not awaiting the runMigrate() promise, causing unhandled promise rejections in self-hosted deployments. The PR adds the missing await keyword on line 23 and adds a missing throw e; statement on line 37 in the second catch block to properly rethrow errors that don't match the orgId migration error pattern.

Key changes:

  • Added await before runMigrate() call to properly handle async execution
  • Added throw e; in second catch block to rethrow non-orgId migration errors

These changes ensure that database migration errors are properly surfaced to the caller (instrumentation.node.ts), allowing the retry logic and error handling to work correctly.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix addresses a critical bug by adding proper async/await handling and error propagation. The changes are minimal (2 lines), well-targeted, and follow correct async/await patterns. No breaking changes or side effects introduced.
  • No files require special attention

Important Files Changed

Filename Overview
packages/database/migrate.ts Adds await to runMigrate() call and rethrows unhandled errors in the second catch block

Last reviewed commit: 114f62a

…rrors

migrateDb() was not awaiting the runMigrate() promise chain, causing
migrations to fire-and-forget. The caller (instrumentation.node.ts)
would receive a resolved promise immediately, log "Migrations run
successfully!" before any migration ran, and the app would start
serving requests against a stale schema.

Additionally, the second .catch() silently swallowed non-orgId errors,
hiding migration failures entirely. Both issues are fixed: the chain is
now awaited and unhandled errors are re-thrown.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Self-hosted deployments break on update due to missing database migrations

1 participant