In trying to implement firebase-admin in my aurelia project, I've ran into some issues, I was wondering if someone could try to help me out.
I first installed firebase-admin through the console with:
npm install --save firebase-admin
Then on main.js, I imported it as admin and declared the serviceAccount.
import * as admin from 'firebase-admin';
serviceAccount: './serviceAccountKey.json';
On the same page, inside export funciont configure(aurelia) I put this:
admin.initializeApp({
credential: './serviceAccountKey.json',
databaseURL: 'https://contactmanager-be4d3.firebaseio.com'
});
I also made sure to reference firebase-admin on the aurelia.json file:
{
"name": "firebase-admin",
"path": "../node_modules/firebase-admin/lib",
"main": "index"
},
But when running, I get this error:
{ Error: ENOENT: no such file or directory, open 'C:\Users\vasco.bento\chapter-3\app\src\fs.js'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object.exports.readFileSync (C:\Users\vasco.bento\chapter-3\app\node_modules\aurelia-cli\lib\file-system.js:49:13)
at fileRead (C:\Users\vasco.bento\chapter-3\app\node_modules\aurelia-cli\lib\build\bundled-source.js:83:31)
at Object.context.fileRead (C:\Users\vasco.bento\chapter-3\app\node_modules\aurelia-cli\lib\build\amodro-trace\lib\loader\Loader.js:176:18)
at Object.context.load (C:\Users\vasco.bento\chapter-3\app\node_modules\aurelia-cli\lib\build\amodro-trace\lib\loader\Loader.js:357:30)
at Module.load (eval at <anonymous> (C:\Users\vasco.bento\chapter-3\app\node_modules\aurelia-cli\lib\build\amodro-trace\lib\loader\Loader.js:14:1), <anonymous>:832:29)
at Module.fetch (eval at <anonymous> (C:\Users\vasco.bento\chapter-3\app\node_modules\aurelia-cli\lib\build\amodro-trace\lib\loader\Loader.js:14:1), <anonymous>:822:66)
at Module.check (eval at <anonymous> (C:\Users\vasco.bento\chapter-3\app\node_modules\aurelia-cli\lib\build\amodro-trace\lib\loader\Loader.js:14:1), <anonymous>:854:30)
at Module.enable (eval at <anonymous> (C:\Users\vasco.bento\chapter-3\app\node_modules\aurelia-cli\lib\build\amodro-trace\lib\loader\Loader.js:14:1), <anonymous>:1173:22)
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\Users\\vasco.bento\\chapter-3\\app\\src\\fs.js',
moduleTree: [ 'firebase-admin/firebase-namespace' ],
fileName: 'C:/Users/vasco.bento/chapter-3/app/node_modules/firebase-admin/lib/firebase-namespace.js' }
Which makes sense, given fs isn't inside the lib folder, or any folder inside node_modules/firebase-admin.
I was wondering how I could be able to solve this issue, and the best way to set up firebase-admin with Aurelia.