Problems with DocumentReference.onSnapshot
Opened this issue · 0 comments
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
- Plugin version: 4.1.1
- Framework: Cordova Android (9.1.0)
- Operating system: Windows 11 (64 bit)
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