firebase functions:secrets:set is not a Firebase command - firebase

I am using cloud functions and would like to use Secret Manager to protect api keys for some services. Following the official documentation here , I tried using the command:
firebase functions:secrets:set STRIPE_TEST
but I received the following error:
Error: functions:secrets:set is not a Firebase command. Did you mean functions:config:set?
I want use secrets, not config that is not recommended

I was having the same problem on firebase-tools version 10.1.2. There's currently a newer version 11.1.0 available but I was having trouble upgrading or even uninstalling:
$ firebase --version
10.1.2
$ npm i -g firebase-tools
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
...
$ firebase --version
10.1.2
$ npm uninstall --location=global firebase-tools
up to date, audited 1 package in 52ms
$ firebase --version
10.1.2
I figured out I could successfully uninstall firebase-tools with curl -sL firebase.tools | uninstall=true bash then I reinstalled it with npm i --location=global firebase-tools
That finally upgraded firebase --version to 11.1.0 which fixed firebase functions:secrets:set SECRET_NAME for me.

Related

Multiple Versions of Firebase Installed - Which Do I Use?

I'm trying to build an app with Firebase and ran a few commands to see which version I have. To follow along with a 2021 instruction video, I was hoping to have Firebase v9. Depending on the command that I run, I somehow have versions 8 and 11. If I have these two versions, which one is actually being used? What is the difference between seemingly having an npm firebase and non-npm firebase installed?
armadillo#armadillo-MacBook-Air my-app % npm firebase --version
8.11.0
armadillo#armadillo-MacBook-Air my-app % firebase -V
11.2.2
If you're trying to work with the Firebase CLI, you should be looking at the firebase-tools npm package, not firebase. They are definitely not the same thing.
npm firebase-tools --version
I suggest reviewing the documentation as well.
As covered by #Doug's answer, the firebase command is defined by the firebase-tools npm package (or by https://firebase.tools if installed that way) not the firebase package, which does not define any command line utilities.
Additionally, npm --version returns the version of npm you have installed. This includes if you add the name of a package there. (i.e. npm thisCouldBeAnythingNotANPMCommand --version will return the same result)
If you want to view the version of a deployed package, you would use one of the following commands to query NPM's database:
npm view firebase version (view package's "version" field)
npm v firebase version (view package's "version" field, using shorthand)
npm view firebase (get all available package information)
If you want to view the version of a package installed in your project or globally, you would use:
npm ls firebase (local install)
npm ls -g firebase-tools (global install)
If you want to view the where the npm-installed commands are, you would use:
npm bin (local install)
npm bin -g (global install)
For the firebase command, the firebase/firebase.cmd/firebase.ps1 files all point to <global bin directory>/node_modules/firebase-tools/lib/bin/firebase.js.
Compare the results of:
> npm v firebase version
9.9.0
> npm ls firebase
`-- firebase#9.0.0-beta.6 (an old project directory for another SO answer)
> npm v firebase-tools version
11.2.2
> npm ls -g firebase-tools
`-- firebase-tools#9.21.0 (updated since :D)
> npm --version
6.4.12
> npm firebase --version
6.4.12
> npm v npm version
8.14.0 (updated since :D)

Firebase broken on M1 Mac

I have a new MacBook Air M1. Firebase had been working up until I did an upgrade of firebase-tools from 9.7.0 to 9.8.0 last week. After the upgrade, I get this error every time I try to run any "firebase " statement.
There is no source code directly involved in this question, for the person who closed the original question. To replicate this issue you'd have to have an M1 mac and be using firebase.
How can I fix this problem?
(Note for others who have this problem, the answer was provided in comments by #RandomDude below: just downgrade firebase-tools to 9.7.0)
steve#steves-air functions % firebase
dyld: lazy symbol binding failed: Symbol not found: __Z18sse42_is_availablev
Referenced from: /opt/homebrew/lib/node_modules/firebase-tools/node_modules/sse4_crc32/build/Release/crc32c.node
Expected in: flat namespace
dyld: Symbol not found: __Z18sse42_is_availablev
Referenced from: /opt/homebrew/lib/node_modules/firebase-tools/node_modules/sse4_crc32/build/Release/crc32c.node
Expected in: flat namespace
zsh: abort firebase
Update on April 7, 2021
Updating to firebase-tools#9.9.0 fixed the issue.
$ npm install -g firebase-tools
$ firebase --version
9.9.0
Temporal Solution
As it mentioned in the above comment by RandomDude, downgrading to 9.7.0 made it work for me.
$ firebase --version
# This will give you the same error.
# So, look at the directory where firebase-tools are installed.
$ cat /opt/homebrew/lib/node_modules/firebase-tools/package.json
{
"name": "firebase-tools",
"version": "9.8.0",
--- snip ---
Reinstall firebase-tools
$ npm uninstall -g firebase-tools
$ npm install -g firebase-tools#9.7.0
$ firebase --version
9.7.0
This is a temporal solution for me. Thanks to RandomDude.

Unable to login Firebase with cli command

I'm trying to login to my Firebase account with cli command firebase login. I believe it should open browser and prompt me to login with my google account, but that doesn't seem to happen.
Instead, it's asking me to enter my email and password in the terminal. Once I enter my credentials, it throws the following error:
/usr/lib/node_modules/firebase-cli/node_modules/source-map-support/source-map-support.js:223
return '\n at ' + wrapCallSite(frame);
^ TypeError: CallSite method toString expects CallSite as receiver
How do I fix this as I want to deploy my app to Firebase?
I've had the same issue.
You're probably using firebase-cli instead of firebase-tools.
https://firebase.google.com/docs/cli#update-cli
firebase-cli has been deprecated years ago.
#mikeonline did you ever installed the Firebase tools/cli before on
your machine (before we launched v3 at Google IO) basically did you
have v2.2 previously installed perhaps?
firebase-cli has been deprecated a year ago and only installs v1. NPM
should have printed this message"
npm WARN deprecated firebase-cli#1.2.0: Use firebase-tools instead.
Both v2 and v3 can be installed with npm install -g firebase-tools but
by default the latest version (3.0.0) gets installed.
https://github.com/firebase/codelab-friendlychat-web/issues/22#issuecomment-220695413
Execute the below command
npm uninstall firebase-cli
npm uninstall firebase-tools
npm install -g firebase-tools --force

firebase version is not updating through <npm install -g firebase-tools>

i am windows user and trying to update firebase version using
npm install -g firebase-tools but when i run firebase --version
it shows the same version.
I also run npm uninstall firebase --save and check firebase --version it shows same.
what should i do to update my firebase version?
npm update -g firebase-tools
or
npm install -g firebase-tools#3.12.0 to install a specific version
And make sure to restart your terminal/IDE otherwise, it won't take effect.
Have you tried npm update -g firebase-tools? This worked for me.
These days if you're on an older version, and you check the version of firebase-tools, by running:
firebase -V
along with the version of firebase-tools that you're on, it also gives you a messages, something like this:
So you can basically run npm i -g firebase-tools to update the version of your firebase-tools installation to the latest version.
Hope this helps :)
For other like me stumbling in with a weird version mismatch:
When I did firebase -V in my terminal I would get a different version (5.1.1) than when I ran firebase through a npm run script (3.19.3)
The problem was that I had previously installed firebase locally into that project. In other words, I was getting the global version in the terminal, but npm was using the node_modules version
To confirm this, I added a simple test called test-foo to my package.json (firebase -V && which firebase) and ran it:
kuzyn(λ)matebox‡ npm run test-foo
kuzyn-project#1.1.0 test-foo /home/kuzyn/code/kuzyn-project/firebase
firebase -V && which firebase
3.19.3
/home/kuzyn/code/kuzyn-project/firebase/node_modules/.bin/firebase
Then I removed the (uneeded in my case) local firebase package from the package.json and from node_modules
Try the 2 steps bellow
1. yarn/npm cache clean
2. npm install -g firebase firebase-tools or yarn add -g firebase firebase-tools
in a new terminal, firebse --version
works for me
it works to me...
standalone binary: Download the new version, then replace it on your system
if you are using the standalone.Download the new version
In my case I was using an old node version (v10) and had to switch to a newer one (v12). After that I ran npm install -g firebase-tools again and it was updated to the latest version.
You can check the current node version by running node -v. And I use nvm to switch to a different node version.
That might happen in case you've installed the firebase-cli using a so called automatic install script.
Try to call curl -sL https://firebase.tools | upgrade=true bash as described in the official documentation

Get Error Invalid CLI version provided. - Please update to at least v2.0.0 when running firebase deploy

I am running the command firebase deploy and I see the following error:
Invalid CLI version provided. - Please update to at least v2.0.0 by
running npm update -g firebase-tools
Running the command firebase -v I see I have the following version info:
Firebase Command Line Tools
Version 1.2.0
https://www.firebase.com
Now, running the command npm update -g firebase-tools does nada from what I can tell.
I have tried to remove and reinstall firebase-tools via the following commands:
npm remove -g firebase-tools
npm install -g firebase-tools
When I run firebase -v I continue to see version 1.2.0 and my firebase deploy continues to not work. How do I upgrade firebase-tools to version 2?
For background info the Node version on the server is v4.3.1 and the OS is Ubuntu 14.04.4 LTS.
Thanks in advance for any assistance.
I had the same issue.
I've previously installed firebase-cli globally (CLI, not tools), so to fix it:
npm remove -g firebase-cli
npm install -g firebase-tools

Resources