Realm Sync delay

Creating entries in the mobile app I can see these changes in the adjacent test mobile, so Realm is synchronising. However looking at MongoDB App Services the last sync event was yesterday evening:

Latest Sync Event
02/05/2023 19:52:53

Last Cluster Event Processed
02/05/2023 19:52:51

Lag
2 sec

I can see sync working in the logs this morning:

OK Sync ->Write Feb 06 9:18:02+00:00
[
“Upload message contains 1 changesets (total size 50 bytes) to be integrated”,
“Integrated 1 of 1 remaining changesets (total size 50 bytes) (0 required conflict resolution) in 1 attempts to bring server version to 2929”
]

However I cannot see the changes I make in the app in Data Services whilst browsing the collection. Additionally my desktop application (accessing data via an API) does not show the new entities. This implies the server does not have the data but the mobiles are synchronised? I’m lost…

This is odd what’s going on?

Resolved by turning sync off and on again.

This error featured in the logs recurrently:

failed to validate upload changesets: field “forms.1” in table “Project” should have link type “objectId” but payload type is “Null” (ProtocolErrorCode=212)

How in future might I fix this without “aggressively” resetting sync

Based on the error, it seems like your writes failed upload validation because of a type mismatch between your schemas. Your schema expects the field “forms.1” to contain type "objectId” but it’s null. Having your writes conform to the schema should avoid hitting this error.

In the future, you can pause and resume sync instead of terminating and re-enabling sync completely. This will preserve your sync configuration / client metadata and clients will not have to client reset.

2 Likes

Hi, I had the same issue with the error ending session with error: failed to validate upload changesets: field "field_name" in table "table_name" should have link type "objectId" but payload type is "Null" (ProtocolErrorCode=212).

Context: The field specified is a relationship field, which makes the field not required, but I still have the error coming in. Is that correct or am I missing something?