Skip to content

Fix Deno compatibility issues with PouchDB and trystero#37

Open
echthesia wants to merge 4 commits intovrtmrz:mainfrom
echthesia:main
Open

Fix Deno compatibility issues with PouchDB and trystero#37
echthesia wants to merge 4 commits intovrtmrz:mainfrom
echthesia:main

Conversation

@echthesia
Copy link

Summary

  • Fix process crash caused by PouchDB's node:http shim failing with request body stream errored / resource closed when the live changes feed reconnects — override $$createPouchDBInstance to use Deno's native fetch() instead of the node:http compatibility layer
  • Switch trystero dependency from GitHub fork URL to npm:trystero@^0.22.0 since the fork was upstreamed and Deno doesn't support the previous URL syntax

Test plan

  • Run livesync-bridge with CouchDB and verify the changes feed no longer crashes on reconnection
  • Verify file sync works end-to-end (both directions)
  • Verify E2EE encryption/decryption still works correctly
  • Verify trystero resolves correctly from npm

🤖 Generated with Claude Code

echthesia and others added 2 commits February 10, 2026 16:55
Override $$createPouchDBInstance to use Deno's native fetch instead of
the node:http compatibility layer, which fails with "request body stream
errored / resource closed" when the live changes feed reconnects through
a reverse proxy (e.g. Traefik).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The vrtmrz fork has been upstreamed and Deno doesn't support the
GitHub URL dependency syntax used previously.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@echthesia echthesia marked this pull request as ready for review February 11, 2026 01:10
echthesia and others added 2 commits February 16, 2026 21:26
Await DirectFileManipulator's ready promise in put/delete/get/getMeta
to prevent Hub.dispatch() from calling these methods before
initializeDatabase() completes on container restart.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous fix (7b626a2) awaited `this.man.ready.promise` in put/get/delete/getMeta,
but that promise resolves after the first initializeDatabase() call. When start()
applies remote tweaks and calls initializeDatabase() a second time, the old PouchDB
instance is closed while in-flight operations are still using it.

Replace with a custom `_started` deferred promise that only resolves after start()
fully completes, ensuring DB operations wait for any re-initialization from tweaks.

Co-Authored-By: Claude Opus 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.

1 participant