0

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.

Lawris
  • 965
  • 2
  • 9
  • 21
  • Please edit the question and copy the text of the error into it rather than showing a screenshot. It will be easier to search and read. – Doug Stevenson Feb 17 '19 at 12:26
  • Here you go :-) @DougStevenson – Lawris Feb 17 '19 at 12:27
  • some assertion fails, are you sure you use correct db credentials and the like? maybe sth like this is the cause.. – Nikos M. Feb 17 '19 at 12:52
  • @NikosM. yes the credentials are correct, if I don't use the apple-icloud module, the firebase works normally. – Lawris Feb 17 '19 at 12:53
  • then it seems these two are incompatible, try opening an issue on the github repository of icloud module, maybe they can help – Nikos M. Feb 17 '19 at 12:55
  • I find out that if I require the module after firebase has been initialised, it does work, any idea why ? @NikosM. – Lawris Feb 17 '19 at 12:59
  • I suppose some functions are common which nevertheless are not compatible with each other, maybe using different versions or sth else. Then if initialised firebase uses the correct functions and then requiring icloud has no effect on these common functions – Nikos M. Feb 17 '19 at 14:25

0 Answers0