2

Trying to develop and deploy to Firebase Hosting but getting the following error message when I run firebase init from PowerShell:

Server Error. unable to get local issuer certificate

Does anybody know about this? Here's the log file contents:

[debug] [2017-06-09T10:45:14.977Z] ----------------------------------------------------------------------
[debug] [2017-06-09T10:45:14.979Z] Command:      C:\nodejs\node.exe C:\nodejs\node_modules\firebase-tools\bin\firebase init
[debug] [2017-06-09T10:45:14.979Z] CLI Version:  3.9.1
[debug] [2017-06-09T10:45:14.980Z] Platform:     win32
[debug] [2017-06-09T10:45:14.980Z] Node Version: v7.9.0
[debug] [2017-06-09T10:45:14.980Z] Time:         Fri Jun 09 2017 11:45:14 GMT+0100 (GMT Daylight Time)
[debug] [2017-06-09T10:45:14.980Z] ----------------------------------------------------------------------
[debug] 
[debug] [2017-06-09T10:45:14.993Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"]
[debug] [2017-06-09T10:45:14.993Z] > authorizing via signed-in user
[info] 
     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  U:\firebase

[info] 
=== Project Setup
[info] 
[info] First, let's associate this project directory with a Firebase project.
[info] You can create multiple project aliases by running firebase use --add, 
[info] but for now we'll just set up a default project.
[info] 
[debug] [2017-06-09T10:45:29.107Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects  
 Fri Jun 09 2017 11:45:29 GMT+0100 (GMT Daylight Time)
[debug] [2017-06-09T10:45:29.692Z] Error: unable to get local issuer certificate
[error] 
[error] Error: Server Error. unable to get local issuer certificate

Many thanks

Marcos
  • 194
  • 1
  • 13
  • Hello @Marcos and welcome to StackOverflow. [Here you have a guide of how to ask a question here](http://www.wikihow.com/Ask-a-Question-on-Stack-Overflow). You have to post some code in order to get help, what have you tried, etc. Question is too ambiguous. Also, I suggest you to try to find an answer in StackOverflow, maybe someone had your same problem. – Foo Bar Jun 09 '17 at 11:15
  • [And here is something that maybe helps you](https://stackoverflow.com/questions/35692158/cannot-install-firebase-using-cocoapods-it-says-unable-to-get-local-issuer-cer) a post in StackOverflow that can be related to your question. – Foo Bar Jun 09 '17 at 11:19
  • Hi @FooBar thanks for the guide. I had searched for a similar question but there's none about firebase hosting AND the error message. I have added the error log, hope it makes it unambiguous. – Marcos Jun 09 '17 at 13:30

2 Answers2

4

I finally managed to solve this same exact problem. Simply set the following environtment variable:

set NODE_TLS_REJECT_UNAUTHORIZED=0

and the firebase project should initialize correctly. However, I believe that this solution is more similar to a hack rather than to a solution.

Rob
  • 57
  • 2
  • 7
1

Use this certificate root:

https://curl.haxx.se/ca/cacert.pem

Copy this certificate bundle on your disk. And use this on php.ini:

curl.cainfo = "path_to_cert\cacert.pem"

remember to do

php --ini

This will tell you exactly which php.ini file is being loaded, so you know which one to modify, also, don't forget to restart server.

ALSO:

If this doesn´t work for you, two more solutions:

this guide with another certificate

this master.zip file with another pem

Remember ==> curl.cainfo = "C:/somewhere/cacert.pem"

Hope this solves your problem!

Foo Bar
  • 165
  • 2
  • 14
  • Hi @Foo Bar thanks for the reply but I'm not accessing Firebase from a server, I'm accessing from a terminal window. – Marcos Jun 23 '17 at 15:53