marceljuenemann / rxdb-supabase

Offline support for Supabase using RxDB
MIT License
133 stars 4 forks source link

Error when trying to sync #18

Open TBenTiCon opened 2 months ago

TBenTiCon commented 2 months ago

Hi =) it seems that resyncing is currently broken.

The initial Pull works flawlessly, but as soon something is changed in the Supabase DB, this error comes up.

chunk-HONSTT2W.js?v=e7920512:246 Uncaught (in promise) Error: malformatted revision: 1-rxdbreplicationundefined-channels
    at parseRevision (chunk-HONSTT2W.js?v=e7920512:246:11)
    at createRevision (chunk-HONSTT2W.js?v=e7920512:259:51)
    at setCheckpoint (chunk-3B2ZC7DF.js?v=e7920512:256:21)
    at chunk-3B2ZC7DF.js?v=e7920512:587:66
Syncing from local to supabase, doesnt work at all.

Is there a Problem with my code, or is the a bug?
mbeckenbach commented 2 months ago

I'm facing the same issue. It seams to have some relation to the channel supscription

mbeckenbach commented 2 months ago

@TBenTiCon Looks like there is a related PR: https://github.com/marceljuenemann/rxdb-supabase/pull/8

mbeckenbach commented 2 months ago

@TBenTiCon as written in that PR's comments the issue is that you might have a hyphen (-) in your replicationIdentifier. Replace it by something else. I did so and used an underscore. Works like a charm now.

TBenTiCon commented 2 months ago

Oh, I forgot to post my solution 😅 I've already figured out that the hyphen was the problem.

The hyphen causes rxdb to split the string wrongly and then it receives 3 (or more) instead of 2 entries in its identifier array.

The hyphen is the separator in rxdb, I don't think that this can be easily patched in rxdb-supabase.