Firebase configuration options not available when deploying features

When I deploy Firebase features without

admin.initializeApp(functions.config().firebase); 

Firebase Logs

Error. By default, the Firebase application does not exist. Make sure you call initializeApp () before using any of the Firebase services.

But if I add this line, I get a deployment error message.

 >firebase deploy --only functions 

Error:

Error: An error occurred while parsing function triggers. please make sure you have the latest SDK with firebase function by running "npm i --save firebase-functions @latest" inside your functions folder.

Error: Firebase configuration variables are not available. Please use the latest Firebase CLI to deploy this feature.

I have already done npm i --save firebase-functions@latest , which did nothing. I am stuck and can’t do anything right now because of this ... I am for any reinstallations if they can help just tell me a few steps or hints and I will look for the rest.


NPM and NodeJS version:

 node -v v8.9.1 npm -v 5.6.0 

Change Administrative installation:

 npm i --save firebase-functions@latest npm WARN firebase-functions@0.8.1 requires a peer of firebase-admin@ ~5.8.1 but none is installed. You must install peer dependencies yourself. npm ERR! path C:\Users\Telion\firebaseApps\project-name\functions\node_modules\firebase-admin\node_modules\grpc\node_modules\abbrev npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall rename npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Telion\firebaseApps\project-name\functions\node_modules\firebase-admin\node_modules\grpc\node_modules\abbrev' -> 'C:\Users\Telion\firebaseApps\project-name\functions\node_modules\firebase-admin\node_modules\grpc\node_modules\.abbrev.DELETE' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent 

Actually, I appeared on npm version 5.5.1, but even after upgrading to 5.6.0 I got the same error.

+5
source share
1 answer

A change has been made in firebase-tools@3.17.x that requires your project to firebase-functions to the latest version.

However, firebase-functions@latest also requires firebase-admin@latest (at the time of writing firebase-admin@5.11.0 . After updating all packages, this problem should be resolved.

Another alternative is to downgrade the global version of firebase-tools to 3.16.0 , which allows you to use the older firebase-functions and firebase-admin packages.

+2
source

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


All Articles