Rob
Rob

Reputation: 61

Firebase - Error adding a new project: unable to get local issuer certificate

I'm trying to develop and deploy some firebase cloud functions using the firebase cli on Windows 7. I'm trying to set up my development environment from my office where the network is behind a corporate proxy. In the past I have configured node.js and npm to work behind the proxy and I do not have any problems downloading dependencies. Now when I started a firebase project I did not have any problem logging into my Firebase account. However when I tried to:

firebase use --add 

in my project folder I get the following error message:

Error: Server Error. unable to get local issuer certificate

From the firebase-debug.log I get more info:

[debug] [2017-10-16T14:43:42.993Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects Mon Oct 16 2017 16:43:42 GMT+0200 (ora legale Europa occidentale)
[debug] [2017-10-16T14:43:43.587Z] Error: unable to get local issuer certificate at Error (native) at TLSSocket.<anonymous>(_tls_wrap.js:1092:38) at emitNone (events.js:86:13) at TLSSocket.emit (events.js:185:7) at TLSSocket._finishInit (_tls_wrap.js:610:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:440:38)
[error] 
[error] Error: Server Error. unable to get local issuer certificate

I tried to use

npm config set cafile "<path-to-a-cert-extracted-from-cacert.pem>"

with no luck.

I really can't figure out what's going on and I couldn't find any solution on the web. On StackOverflow there's a similar question but the answers seem to point to a different problem.

I would be glad to hear if someone has found a solution to this problem. Thanks.

Upvotes: 1

Views: 799

Answers (1)

Rob
Rob

Reputation: 61

Ok so basically after 2 days of research I finally came up with a (hack)solution by looking at Node.js documentation on TLS. Setting the following environment variable does the trick:

set NODE_TLS_REJECT_UNAUTHORIZED=0

I personally don't like this solution but at least it makes me work. Is this something that has to be fixed? Or am I missing something on the configuration of npm behind a proxy?

Thanks.

Upvotes: 1

Related Questions