lundi 12 février 2018

Firebase Storage Web - creating reference does not work

I have tried the exact same thing given in the firebase documentation. But this is the error I get.

 functions: Failed to load functions source code. Ensure that you have
 the latest SDK by running **npm i --save firebase-functions** inside the
 functions directory.

 functions: Error from emulator. FirebaseError: Error occurred while
 parsing your function triggers.

TypeError: storage.ref is not a function
    at Object.<anonymous> (/Users/user1/projects/newproj/functions/index.js:15:26)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at /usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js:18:11
    at Object.<anonymous> (/usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js:32:3)

CODE:

let firebaseApp = firebase.initializeApp(functions.config().firebase);
const storage = firebaseApp.storage();
let storageRef = storage.ref('.../abc.pdf');

IDE throws error at .ref stating that property ref does not exist on storage.

Functions Dependencies:

"dependencies": {
    "@google-cloud/functions-emulator": "^1.0.0-alpha.29",
    "express": "^4.16.1",
    "firebase": "^4.6.2",
    "firebase-admin": "^5.8.2",
    "firebase-functions": "^0.8.1",
    "grpc": "^1.9.0"
  }




Aucun commentaire:

Enregistrer un commentaire