Skip to content

Conversation

simolus3
Copy link
Contributor

The sync service has custom error types used to respond with error descriptions, like:

{"error":{"code":"PSYNC_S2106","status":401,"description":"Authentication required","name":"AuthorizationError"}}

When requesting an endpoint that doesn't exist, the sync service also responds with an error. That response has an incompatible structure though:

{"message":"Route GET:/foo/bar not found","error":"Not Found","statusCode":404}

That response manages to crash the error handler in the Dart SDK, leading to a confusing error message there.

This PR installs a custom 404 handler on fastify to ensure the responses are consistent.

@simolus3 simolus3 requested a review from rkistner July 21, 2025 11:02
Copy link

changeset-bot bot commented Jul 21, 2025

🦋 Changeset detected

Latest commit: d30f7d6

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

This PR includes changesets to release 16 packages
Name Type
@powersync/service-errors Patch
@powersync/service-core Patch
@powersync/lib-services-framework Patch
@powersync/service-core-tests Patch
@powersync/service-module-core Patch
@powersync/service-module-mongodb-storage Patch
@powersync/service-module-mongodb Patch
@powersync/service-module-mysql Patch
@powersync/service-module-postgres-storage Patch
@powersync/service-module-postgres Patch
@powersync/service-image Patch
test-client Patch
@powersync/service-rsocket-router Patch
@powersync/lib-service-mongodb Patch
@powersync/lib-service-postgres Patch
@powersync/service-schema 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

@simolus3 simolus3 changed the title Make 404 errors consistent with other reponses Make 404 errors consistent with other error responses Jul 21, 2025
@simolus3 simolus3 merged commit 1aafdaf into main Jul 21, 2025
35 of 36 checks passed
@simolus3 simolus3 deleted the consistent-404-error branch July 21, 2025 12:11
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.

2 participants