Hossein Rashno
Hossein Rashno

Reputation: 3469

firebase-tools "Error: certificate has expired"

This morning I tried to deploy my react project to firebase hosting but I received this error:

Error: Server Error. certificate has expired

Then I tried to execute firebase list command to see the list of my projects but again I received the same error! I tried it on other projects with the same result. So I believe this error is not related to a specific project and it has something to do with firebase-tools. Here is the error log:

[debug] 
[debug] [2020-01-07T03:37:57.789Z] > 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"]
[debug] [2020-01-07T03:37:57.789Z] > authorizing via signed-in user
[debug] [2020-01-07T03:37:57.792Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects  

[debug] [2020-01-07T03:37:58.566Z] Error: certificate has expired
    at TLSSocket.<anonymous> (_tls_wrap.js:1116:38)
    at emitNone (events.js:106:13)
    at TLSSocket.emit (events.js:208:7)
    at TLSSocket._finishInit (_tls_wrap.js:643:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38)
[error] 
[error] Error: Server Error. certificate has expired

Upvotes: 24

Views: 9848

Answers (7)

Dustin Patterson
Dustin Patterson

Reputation: 11

I had an old version of firebase installed that was not allowing the new CLI to run correctly. I had to manually delete the old version, reinstall the new version, and then everything worked fine. Here's how I did it:

  1. Run which firebase in your terminal to see where your firebase npm package is saved.
  2. Delete that folder.
  3. Run npm i -g firebase-tools@latest
  4. Run firebase init and you should be up and running again without any errors.

Upvotes: 1

Alex Pavtoulov
Alex Pavtoulov

Reputation: 880

I updated to latest and did logout+login. Only started working after closing the terminal and opening a new one

Upvotes: 3

ThusharaJ
ThusharaJ

Reputation: 419

If issue still exist after updating the CLI then try to logout from firebase and re-login

firebase logout
firebase login

Upvotes: 0

Hossein Rashno
Hossein Rashno

Reputation: 3469

I found the solution. First, do this:

npm i -g firebase-tools@latest

It looks like I'm using an outdated version of Firebase CLI. This error happened because the older versions of CLI are linked to legacy Firebase services that are no longer operational. Upgrading to the latest CLI version is the only solution.

Then you need to use new commands instead of deprecated ones. For example:

firebase projects:list  //instead of firebase list

Upvotes: 28

Jan Kremeň
Jan Kremeň

Reputation: 92

Had the same problem. Change your local clock to before 4th of January 2020

Upvotes: 1

Adedayo
Adedayo

Reputation: 93

run npm install --save firebase-functions@latest and make sure to add

"engines": {
  "node": "8" 
}

in your package.json

Upvotes: 0

Pol Fern&#225;ndez
Pol Fern&#225;ndez

Reputation: 1208

Probably you will need:

sudo npm i -g firebase-tools@latest --force

Upvotes: 4

Related Questions