ReallySmallSoftware / cordova-plugin-firestore

A Google Firebase Firestore plugin to enable realtime synchronisation between app and cloud and automatically handle limited connectivity.
Other
22 stars 10 forks source link

Problems with DocumentReference.onSnapshot #41

Open Jeroen2006 opened 2 years ago

Jeroen2006 commented 2 years ago

Expected Behavior

Function returns document and returns the document again when there is a change.

Actual Behavior

Function doesn't run at all and gives the following error: Uncaught (in promise) Value null at 3 of type org.json.JSONObject$1 cannot be converted to JSONObject

Specifications

My code

document.addEventListener("deviceready", onDeviceReady, false); var firebaseOptions = { datePrefix: "__DATE:", fieldValueDelete: "__DELETE", fieldValueServerTimestamp: "__SERVERTIMESTAMP", persist: true, }; function onDeviceReady() { Firestore.initialise(firebaseOptions).then(function (db) { const userRef = db.doc("/users/user_1"); userRef.onSnapshot( async () => { var doc = await userRef.get(); console.log(doc.data()); }, (err) => { console.log(err); }, (err) => { throw err; } ); }); } -> https://hastebin.com/uyidoguzef.js

Because I'm not an Java expert I won't be able to fix this on my own. If you need more of my code/config, please let me know.

Jeroen2006