7

Full error dump:

Error: Error occurred while parsing your function triggers. Please ensure you have the latest firebase-functions SDK by running "npm i --save firebase-functions@latest" inside your functions folder.

Error: Firebase config variables are not available. Please use the latest version of the Firebase CLI to deploy this function.
    at init (/Users/dougstevenson/work/google/firebase/functions/tmp/functions/node_modules/firebase-functions/lib/config.js:51:15)
    at Object.config (/Users/dougstevenson/work/google/firebase/functions/tmp/functions/node_modules/firebase-functions/lib/config.js:29:9)
    at Object.ref (/Users/dougstevenson/work/google/firebase/functions/tmp/functions/node_modules/firebase-functions/lib/providers/database.js:75:33)
    at Object.<anonymous> (/Users/dougstevenson/work/google/firebase/functions/tmp/functions/lib/index.js:9:32)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Module.require (module.js:604:17)
Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441

2 Answers2

11

With firebase-tools (the Firebase CLI) version 3.17.0, it's required to use the latest firebase-functions (version 0.8.1) and firebase-admin (version 5.8.1) SDKs. Update them by running this command from the functions folder:

npm install firebase-functions@latest firebase-admin@latest

After this, a deploy should succeed.

EDIT: This bug was fixed in CLI version 3.17.1. A similar bug appears also when running the emulator with the CLI, and that was fixed in 3.17.3.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • I'm having the same problem, and I am using the absolute latest of firebase-anything: `firebase-admin@5.8.1`, `firebase-functions@0.8.1`, and `firebase-tools@3.17.1`. – Douglas Manley Jan 19 '18 at 01:02
  • 1
    Rolling back to `firebase-tools@3.16.0` (but leaving `firebase-admin@5.8.1` and `firebase-functions@0.8.1`) fixed it for me, so something's up with the new version of `firebase-tools`. – Douglas Manley Jan 19 '18 at 01:16
  • 1
    Neither of those solutions are working for me. Is there anything else that could be causing the problem? – Sam Jan 24 '18 at 01:14
  • @Sam are you getting the *exact* same form of error message, or something similar but different? It the form of the error is different (even though the message is the same), it might be a different problem that you should ask in a different question. – Doug Stevenson Jan 24 '18 at 01:19
  • Thanks @DougStevenson. Rolling back to 3.16.0 fixed it for now. – beluga Feb 04 '18 at 14:49
0

To fix this I needed to run from the root path of your firebase functions folder:

npm update -g firebase-functions;

run it again..

npm update -g firebase-functions;

Then update the node_modules within your functions directory per above advice

cd functions;
npm install firebase-functions@latest firebase-admin@latest;

Note: Interestingly NPM complained the install of both packages was invalid, even after running install again. However executing a firebase deploy --only functions worked perfectly.

Incidentally, my simple deploy shortcut script may come in handy for those who don't like working in one big index.js file:

#!/bin/bash

(cd functions/; cat header.js get*.js process*.js set* > index.js; );

firebase deploy --only functions

say "fire base deploy done";
Mark Terrill
  • 316
  • 3
  • 5