I am working in my index.js file using the firebase-admin
module from Firebase, everything works great until I decide to import the apple-icloud
module (https://github.com/MauriceConrad/iCloud-API) to my index.js file.
I require both like this :
var iCloud = require('apple-icloud');
var admin = require('firebase-admin');
At the line where I use :
var db = admin.database();
The program stops and throws this error :
/home/loris/HHIOT/node_modules/@firebase/util/dist/index.node.cjs.js:64
throw assertionError(message);
^
Error: Firebase Database (${JSCORE_VERSION}) INTERNAL ASSERT FAILED: Missing index implementation for fillDefaults
at assertionError (/home/loris/HHIOT/node_modules/@firebase/util/dist/index.node.cjs.js:73:12)
at Object.assert (/home/loris/HHIOT/node_modules/@firebase/util/dist/index.node.cjs.js:64:15)
at /home/loris/HHIOT/node_modules/@firebase/database/dist/index.node.cjs.js:3347:18
at Object.map (/home/loris/HHIOT/node_modules/@firebase/util/dist/index.node.cjs.js:896:22)
at IndexMap.addToIndexes (/home/loris/HHIOT/node_modules/@firebase/database/dist/index.node.cjs.js:3345:31)
at ChildrenNode.updateImmediateChild (/home/loris/HHIOT/node_modules/@firebase/database/dist/index.node.cjs.js:3545:46)
at ChildrenNode.updateChild (/home/loris/HHIOT/node_modules/@firebase/database/dist/index.node.cjs.js:3560:25)
at ChildrenNode.updateChild (/home/loris/HHIOT/node_modules/@firebase/database/dist/index.node.cjs.js:3559:67)
at SnapshotHolder.updateSnapshot (/home/loris/HHIOT/node_modules/@firebase/database/dist/index.node.cjs.js:9368:41)
at Repo.updateInfo_ (/home/loris/HHIOT/node_modules/@firebase/database/dist/index.node.cjs.js:12882:24)
I tried to import the apple-icloud module in a separate file, it does work. It seems this error only happens when apple-icloud and firebase-admin are both required.
I find out that if I require the module after firebase has been initialised, it does work, any idea why ?
What can be the cause of this ? Thanks.