WatermelonDB icon indicating copy to clipboard operation
WatermelonDB copied to clipboard

Will update existing record instead but still fails.

Open CDBridger opened this issue 9 months ago • 3 comments

Currently experiencing an error in the backend which means its sending updated records as created, that's on us. My question is, the error it throws implies it will still update the database

[Diagnostic error: [Sync] Server wants client to create record projectMarkers#vbb9k2j6vksl7vgf, but it already exists locally. This may suggest last sync partially executed, and then failed; or it could be a serious bug. Will update existing record instead.]

but then at the end it doesn't updated/create the record to at all and throws

 Failed to execute db update - sqlite error 1555 (UNIQUE constraint failed: projectMarkers.id)

which means A bunch of the records which are created are never added to the database (that came in the same payload)

"react-native": "0.72.3", "@nozbe/watermelondb": "^0.26.0",

CDBridger avatar Sep 20 '23 05:09 CDBridger

As a note we have fixed the issue in our backend but I'm still curious to get an answer to this question.

CDBridger avatar Sep 20 '23 23:09 CDBridger

@CDBridger how did you fix this ?

@radex facing this issue, any idea on why this is happening ?

hrahul2605 avatar Nov 22 '23 17:11 hrahul2605

We had a timestamp issue which was causing updated records to be sent, it didn't fix the created entries not being created (but we are no longer hitting this bug because of the aforementioned bug fix).

CDBridger avatar Dec 14 '23 03:12 CDBridger