Skip to content

Conversation

@rkistner
Copy link
Contributor

@rkistner rkistner commented Dec 3, 2025

Currently, when there is any temporary error during initial replication, the error persists until replication completed. This ends up with the dashboard (or anything using the diagnostics API) displaying an error such as this:

[Processing Sync Rules] Unable to do postgres query on ended connection

This is confusing for users - it leads them to believe there is an issue with the replication, often leading to re-deploying, or even stopping and restarting the instance, which then further delays sync rule processing.

This changes the logic to clear the replication error on any flush that made progress, instead of only on the final commit. As background, we used to only clear on commit to make sure we don't clear errors when replication consistently runs into the same error when retrying. However, since the change to skip existing rows during snapshots (#150), any successful flush does indicate progress, making it safe to clear the error.

While this primarily affects initial replication of new sync rules, it could also affect replication of the active sync rules in some edge cases with large replication delays. If the delay is enough that it is an actual issue, we have different checks that would report that.

Additionally, this adds the timestamp of when an error occurred to the diagnostics API. For anything other than these replication errors, it would be the current time. For replication errors, it is the time the error last occurred. We only record the time with MongoDB storage currently. Postgres storage would require a migration to add this, so we can do that in the next minor release.

@changeset-bot
Copy link

changeset-bot bot commented Dec 3, 2025

🦋 Changeset detected

Latest commit: d6979f6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@powersync/service-module-postgres-storage Patch
@powersync/service-module-mongodb-storage Patch
@powersync/service-core Patch
@powersync/service-types Patch
@powersync/service-image Patch
@powersync/service-schema Patch
@powersync/service-module-mongodb Patch
@powersync/service-module-mysql Patch
@powersync/service-module-postgres Patch
@powersync/service-core-tests Patch
@powersync/service-module-core Patch
test-client Patch
@powersync/lib-service-postgres Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rkistner rkistner merged commit dc696b1 into main Dec 4, 2025
22 checks passed
@rkistner rkistner deleted the improve-replication-error-handling branch December 4, 2025 10:53
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.

3 participants