"firebase deploy" with CLI 3.17.0 tools gives "Error: Firebase configuration variables are not available"

Complete error failed:

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) 
+5
source share
2 answers

Using firebase-tools (Firebase CLI) version 3.17.0, it should use the latest versions of firebase-functions (version 0.8.1) and firebase-admin (version 5.8.1) SDK. Update them by running this command from the functions folder:

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

After that, the deployment should complete successfully.

EDIT: This bug was fixed in version 3.17.1 of the CLI. A similar error also appears when starting the emulator with the CLI, and this was fixed in 3.17.3.

+7
source

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

 npm update -g firebase-functions; 

run it again.

 npm update -g firebase-functions; 

Then update the node_modules in your function directory according to the tip above

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

Note. Interestingly, NPM complained that the installation of both packages was invalid even after starting the installation again. However, running firebase deploy --only functions worked fine.

By the way, my simple script deployment shortcut can come in handy for those who don't like working in one large 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"; 
0
source

Source: https://habr.com/ru/post/1274796/


All Articles