Error: Cannot write to class Task when no flexible sync subscription has been created

Hello friends. As I am currently working on a app and using realm/react context within react native. Everything is set it up user information is synced with atlas user documents. but some how I can’t write any data I am receiving this error in particular “Error: Cannot write to class Task when no flexible sync subscription has been created.”. There are no limitations set in the “Device sync” section on “realm.mongodb” and I am receiving the pre-built schema from my locally defined objects. But some how it is saying that the subscription has not been created. By the way I am using flex sync.

Thank you for your time.

Hi, I think that the error is pretty descriptive but we can work on that perhaps. The error is telling you that you are trying to make modifications but you have no open subscriptions. Because this is “sync” we dont let you write things that you are not currently subscribed to, otherwise if you were to write that object we wouldnt know if you want updates made to that object. I would suggest looking at the following links:

https://www.mongodb.com/docs/realm/sdk/react-native/examples/flexible-sync/#bootstrap-the-realm-with-initial-subscriptions
https://www.mongodb.com/docs/realm/sdk/react-native/examples/flexible-sync/#add-a-query-to-the-list-of-subscriptions

1 Like

Thank you that helped a lot

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.