Firebase-tools: Unable to deploy cloud functions, Firebase config error.

Created on 28 Jan 2018  路  8Comments  路  Source: firebase/firebase-tools

Hi There,

I've been busy updating my existing cloud function but all of a sudden I get this error when I'm trying to deploy!

Version info

3.17.4

Debug info

[2018-01-28T20:28:27.213Z] ----------------------------------------------------------------------
[2018-01-28T20:28:27.218Z] Command: C:\Program Files\nodejs\node.exe C:\Users\RickPC\AppData\Roaming\npmnode_modules\firebase-toolsbin\firebase deploy --debug
[2018-01-28T20:28:27.219Z] CLI Version: 3.17.4
[2018-01-28T20:28:27.219Z] Platform: win32
[2018-01-28T20:28:27.219Z] Node Version: v7.5.0
[2018-01-28T20:28:27.220Z] Time: Sun Jan 28 2018 21:28:27 GMT+0100 (W. Europe Standard Time)
[2018-01-28T20:28:27.220Z] ----------------------------------------------------------------------

[2018-01-28T20:28:27.235Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2018-01-28T20:28:27.236Z] > authorizing via signed-in user
[2018-01-28T20:28:27.239Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/hashtagstats

Sun Jan 28 2018 21:28:27 GMT+0100 (W. Europe Standard Time)
[2018-01-28T20:28:27.894Z] <<< HTTP RESPONSE 200 server=nginx, date=Sun, 28 Jan 2018 20:28:26 GMT, content-type=application/json; charset=utf-8, content-length=111, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
[2018-01-28T20:28:27.897Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/hashtagstats/tokens

Sun Jan 28 2018 21:28:27 GMT+0100 (W. Europe Standard Time)
[2018-01-28T20:28:28.511Z] <<< HTTP RESPONSE 200 server=nginx, date=Sun, 28 Jan 2018 20:28:27 GMT, content-type=application/json; charset=utf-8, content-length=260, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store

=== Deploying to 'hashtagstats'...

i deploying functions
[2018-01-28T20:28:29.152Z] > [functions] package.json contents: {
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase serve --only functions",
"shell": "firebase experimental:functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": {
"firebase-admin": "~5.4.2",
"firebase-functions": "^0.7.1",
"request": "^2.83.0",
"cheerio": "^1.0.0-rc.2"
},
"private": true
}
i functions: ensuring necessary APIs are enabled...
[2018-01-28T20:28:29.154Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/cloudfunctions.googleapis.com/projectSettings/hashtagstats?view=CONSUMER_VIEW

Sun Jan 28 2018 21:28:29 GMT+0100 (W. Europe Standard Time)
[2018-01-28T20:28:29.154Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/runtimeconfig.googleapis.com/projectSettings/hashtagstats?view=CONSUMER_VIEW

Sun Jan 28 2018 21:28:29 GMT+0100 (W. Europe Standard Time)
[2018-01-28T20:28:30.200Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sun, 28 Jan 2018 20:28:28 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35", accept-ranges=none, connection=close
[2018-01-28T20:28:30.211Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sun, 28 Jan 2018 20:28:28 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35", accept-ranges=none, connection=close

Sun Jan 28 2018 21:28:30 GMT+0100 (W. Europe Standard Time)
[2018-01-28T20:28:30.213Z] >>> HTTP REQUEST GET https://apikeys.googleapis.com/v1/projects/hashtagstats/apiKeys

Sun Jan 28 2018 21:28:30 GMT+0100 (W. Europe Standard Time)
[2018-01-28T20:28:30.977Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sun, 28 Jan 2018 20:28:29 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35", accept-ranges=none, connection=close
[2018-01-28T20:28:31.046Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sun, 28 Jan 2018 20:28:29 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35", accept-ranges=none, connection=close
i functions: preparing functions directory for uploading...
[2018-01-28T20:28:31.048Z] >>> HTTP REQUEST GET https://runtimeconfig.googleapis.com/v1beta1/projects/hashtagstats/configs

Sun Jan 28 2018 21:28:31 GMT+0100 (W. Europe Standard Time)
[2018-01-28T20:28:31.289Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sun, 28 Jan 2018 20:28:29 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35", accept-ranges=none, connection=close

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 (C:\Users\RickPC\Documents\GitHub\HashtagStats_CloudFunctions\functionsnode_modules\firebase-functionslibconfig.js:51:15)
at Object.config (C:\Users\RickPC\Documents\GitHub\HashtagStats_CloudFunctions\functionsnode_modules\firebase-functionslibconfig.js:29:9)
at Object. (C:\Users\RickPC\Documents\GitHub\HashtagStats_CloudFunctions\functions\index.js:8:31)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)

Steps to reproduce

Literally deploying a standard cloud function from the tutorial on the docs, already gives this result.

Expected behavior

Not this :stuck_out_tongue_winking_eye:

Most helpful comment

Can you please follow the instructions from the error message and run:

npm i --save firebase-functions@latest

inside your functions folder? If you're still having problems after that, can you paste in your package.json from your functions folder?

All 8 comments

Can you please follow the instructions from the error message and run:

npm i --save firebase-functions@latest

inside your functions folder? If you're still having problems after that, can you paste in your package.json from your functions folder?

@mbleigh Thank you so much!

I already tried running this but in my main folder, not the functions folder!

Thanks for clearing that up :smile: :+1:

@mbleigh Thank you very much, worked for me! 馃憤

tried npm i --save firebase-functions@latest and it doesn't work for me :(
my deps:

[email protected]
[email protected]

@hyzhak unless your error message looks identical to the one above, you probably have a different issue. Please update firebase-tools by running npm i -g firebase-tools and if that doesn't work, file a new issue.

ON WINDOWS

I had a problem. node and npm can give you a real nightmare if they dont much. Make sure that

  • node version is 8.4.0
  • npm version is 5.3.0
    Thats a perfect match for node and npm.
  1. to check your version for node run node --version

  2. to check your npm version run npm --version

if they dont match as above, uninstall node and downgrade your npm version like ave explained above.
when you have set them like above.
From there you can now run your 'npm install -g firebase-tools'

my package.json:
{
"name": "sample-firebase-auth",
"version": "0.0.1",
"dependencies": {
"firebase-admin": "5.9.0",
"firebase-functions": "0.8.1"
}
}

my index.js :
const functions = require('firebase-functions');
const admin = require('firebase-admin');

admin.initializeApp(functions.config().firebase);
exports.helloAuth = functions.auth.user().onCreate(event => {
const user = event.data; // The firebase user
const id = user.uid;
const email = user.email;

return admin.database().ref("/users/"+id+"/info/status").set("ok");

});

My error:
Firebase config variables are not available. Please use the latest version of the Firebase CLI to deploy this function.
please help me!

@Lexuanduy it looks like you have the same issue; do npm i -s firebase-functions in your functions directory as noted above. If you're still having issues with the latest code, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings