Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to deploy behind a proxy #155

Closed
ymainier opened this issue May 26, 2016 · 166 comments
Closed

Unable to deploy behind a proxy #155

ymainier opened this issue May 26, 2016 · 166 comments

Comments

@ymainier
Copy link

Hi,

I'm following the firebase web tutorial (https://codelabs.developers.google.com/codelabs/firebase-web/).
Everything works fine for the 8 first steps, but in step 9 I have a problem : the command firebase deploy hangs indefinitely.
I have this behavior while being behind a proxy (http_proxy and https_proxy are set in the env).

Is there a way to deploy behind a proxy ?
This seems related to issue #36

Yann


Here is the output of firebase deploy --debug

----------------------------------------------------------------------
Command:      node /Users/ymainier/.nvm/versions/node/v0.12.1/bin/firebase deploy --debug
CLI Version:  3.0.0
Platform:     darwin
Node Version: v0.12.1
Time:         Wed May 25 2016 16:46:59 GMT+0200 (CEST)
----------------------------------------------------------------------

> command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"]
>>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/friendlychat-dd6a6 
<<< HTTP RESPONSE 200 server=nginx, date=Wed, 25 May 2016 14:47:57 GMT, content-type=application/json; charset=utf-8, content-length=124, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
>>> HTTP REQUEST GET https://admin.firebase.com/v1/database/friendlychat-dd6a6/tokens 
<<< HTTP RESPONSE 200 server=nginx, date=Wed, 25 May 2016 14:47:57 GMT, content-type=application/json; charset=utf-8, content-length=433, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
@mbleigh
Copy link
Contributor

mbleigh commented May 27, 2016

This is a known issue. We'd like to figure out a workaround, but it may take some time. I'll leave the issue open to track.

@summers173
Copy link

I have the same problem, the firebase team just write me this:

"Not possible at the moment, tracking here: #155 but no timeline on a fix."

Actually referring me to this page XP

Hope this will be fix soon, since many of us developers use this tools at work

@aprice2704
Copy link

I have the same problem. Makes it hard to eval firebase in many work environments. :( Also, I have a problem via my satellite inet at home (opening separate issue for that) :(_

@rohitsuratekar
Copy link

rohitsuratekar commented Jul 24, 2016

Same Problem here ! Also this problem is there with all firebase functions on android except authentication.

@cskiwi
Copy link

cskiwi commented Aug 1, 2016

Wel I managed to get it working on my work, but I just can't login,

I also tried doing the ``firebase login --no-localhostbut that gave just aError: Authentication Error.`

@yuxizhe
Copy link

yuxizhe commented Sep 7, 2016

same problem ..

@echopi
Copy link

echopi commented Oct 4, 2016

I've came to this problem twice ..

@sel
Copy link

sel commented Oct 12, 2016

The timeout occurs when the Firebase node module makes a connection using faye-websockets, which does not make use of http_proxy and associated environment variables.

There is a comment on StackOverflow that describes how to hard-code the proxy config in faye-websockets as a work-around.

Not elegant, but at least I can deploy now :)

@xgqfrms-GitHub
Copy link

Firebase login failed
#250
#240
#249

@tolgabalci
Copy link

tolgabalci commented Jan 25, 2017

Same issue here. All the other firebase commands seem to work just fine. "firebase deploy" is the only one getting stuck. At the very least a proper error message would be nice.

T:\ng\firebaseutil>firebase deploy --debug
----------------------------------------------------------------------
Command:      C:\Program Files\nodejs\node.exe C:\Users\myusername\AppData\Roaming\npm\node_modules\firebase-tools\bin\firebase deploy --debug
CLI Version:  3.2.1
Platform:     win32
Node Version: v7.3.0
Time:         Wed Jan 25 2017 11:04:37 GMT-0500 (Eastern Standard Time)
----------------------------------------------------------------------

> command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"]
>>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/myprojectname-b5558
<<< HTTP RESPONSE 200 via=IG Proxy, date=Wed, 25 Jan 2017 16:04:38 GMT, server=nginx, connection=Close, content-type=application/json; charset=utf-8, cache-control=no-cache, no-store, content-length=103, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains
>>> HTTP REQUEST GET https://admin.firebase.com/v1/database/myprojectname-b5558/tokens
<<< HTTP RESPONSE 200 via=IG Proxy, date=Wed, 25 Jan 2017 16:04:38 GMT, server=nginx, connection=Close, content-type=application/json; charset=utf-8, cache-control=no-cache, no-store, content-length=423, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains```
<<stuck right here>>

@yunfengsa
Copy link

when I "firebase login" ,there is the problem..I solved by "firebase login --no-localhost" for now. But "firebase init"and "firebase deploy" I can't fix it. Always "Authentication Error"

@chinsyo
Copy link

chinsyo commented Mar 24, 2017

same problem..

@henriquedesousa
Copy link

One year and still no fix?

Come on, evil googol..

@Ernesto-Valdes
Copy link

Ernesto-Valdes commented Mar 28, 2017

Same issue here. Here is the command I'm calling and get same error:

firebase database:set /object_name

@tingxins
Copy link

tingxins commented Apr 10, 2017

Same issue here!!!!

"Error: Authentication Error: Your credentials are no longer valid. Please run firebase login --reauth
For CI servers and headless environments, generate a new token with firebase login:ci"

@enif-lee
Copy link

enif-lee commented Apr 17, 2017

is there no way to deploy behind proxy?

it is my log

[debug] ----------------------------------------------------------------------
[debug] Command:      C:\Program Files\nodejs\node.exe C:\Users\SDS\AppData\Roaming\npm\node_modules\firebase-tools\bin\firebase deploy
[debug] CLI Version:  3.6.1
[debug] Platform:     win32
[debug] Node Version: v7.8.0
[debug] Time:         Mon Apr 17 2017 13:35:27 GMT+0900 (대한민국 표준시)
[debug] ----------------------------------------------------------------------
[debug] 
[debug] > 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] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token { refresh_token: '1/cLqub4wdfbPJfm6Rswlzb8L2uA7zXG1SrmTLx17kZ1w',
  client_id: '563584335869-fgrhgmd47bqne........................apps.googleusercontent.com',
  client_secret: 'j9iVZfS8kkCEFU.........',
  grant_type: 'refresh_token',
  scope: 'email https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase openid' } 
 Mon Apr 17 2017 13:35:27 GMT+0900 (대한민국 표준시)
[debug] <<< HTTP RESPONSE 200
[debug] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/sample-b36e9  
 Mon Apr 17 2017 13:35:29 GMT+0900 (대한민국 표준시)
[debug] <<< HTTP RESPONSE 200
[debug] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/sample-b36e9/tokens  
 Mon Apr 17 2017 13:35:30 GMT+0900 (대한민국 표준시)
[debug] <<< HTTP RESPONSE 200

@tingxins hi, did you tried after below command?

set "NODE_TLS_REJECT_UNAUTHORIZED=0"

@ChampIsMe
Copy link

ChampIsMe commented May 28, 2017

Firebase devs please solve this issue, it a serious dev delay up to date.

@zakali22
Copy link

zakali22 commented Jun 4, 2017

Why is it not solved until now?

@oneingfw
Copy link

one year

@Symbolk
Copy link

Symbolk commented Jun 28, 2017

It still happens and keeps bothering me... Maybe I will give up firebase because I am in China...

@jmrosdev
Copy link

jmrosdev commented Jul 4, 2017

Same problem...

@elpagano
Copy link

Same problem

@hardikpthv
Copy link

Same problem...

@peterennis
Copy link

Same problem.
Working with support for 3 months and no help.
Finally got the idea to uninstall CovenantEyes, which must have a proxy,
so login did not work.
I guess there must be a number of apps that cause this issue.

Finally got the Woohoo!

capture120

@cnscorpions
Copy link

it is real pain to use firebase from a proxy :(

@likui911
Copy link

Mad it work on Mac using this trick
Screen Shot 2019-07-19 at 12 45 14

  1. Go the the network proxy setting on Mac and change Proxy Server and port from CNTL local host to actual enterprise server and port.
Screen Shot 2019-07-19 at 13 06 34
  1. No in the terminal temporary authenticate proxy

ProxyPass & ProxyUserName : same as login credentials stored in CNTLM
ProxyServer & ProxyPort: same as what you have set in network settings.

export http_proxy=http://<ProxyUserName>:<ProxyPass>@<ProxyServer>:<ProxyPort>
export https_proxy=http://<ProxyUserName>:<ProxyPass>@<ProxyServer>:<ProxyPort>

now I was able to login normally on firebase & deploy cloud functions. Hope it works

It works for me! Thanks. 😇

work for me! thanks

@Yougigun
Copy link

face the same issue

@way2geek
Copy link

Hope this will help you:
firebase-tools@7.15.1
it works on both win and mac with ssr

  1. find your proxy address
WeChatd29e8b5b594f8cff963da7441b84fbc9
  1. open "request.js" file in your firebase tools folder. for me, the path is
    /usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js
    use "npm root -g" to find your global npm path
  2. find the code below, about line 276
  if (!self.hasOwnProperty('proxy')) {
    self.proxy = getProxyFromURI(self.uri)
  }

change it to

  // if (!self.hasOwnProperty('proxy')) {
  //   self.proxy = getProxyFromURI(self.uri)
  // }
  self.proxy = "http://127.0.0.1:1087";  // this is your proxy address
  1. use firebase login --no-localhost
    IT WORKED

@nickwang0808
Copy link

Hope this will help you:
firebase-tools@7.15.1
it works on both win and mac with ssr

  1. find your proxy address
WeChatd29e8b5b594f8cff963da7441b84fbc9
  1. open "request.js" file in your firebase tools folder. for me, the path is
    /usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js
    use "npm root -g" to find your global npm path
  2. find the code below, about line 276
  if (!self.hasOwnProperty('proxy')) {
    self.proxy = getProxyFromURI(self.uri)
  }

change it to

  // if (!self.hasOwnProperty('proxy')) {
  //   self.proxy = getProxyFromURI(self.uri)
  // }
  self.proxy = "http://127.0.0.1:1087";  // this is your proxy address
  1. use firebase login --no-localhost
    IT WORKED

Just tested on Ubuntu 20.04, it works like a charm. Thank you for sharing!

@noobfromvn
Copy link

Hope this will help you:
firebase-tools@7.15.1
it works on both win and mac with ssr

  1. find your proxy address
WeChatd29e8b5b594f8cff963da7441b84fbc9
  1. open "request.js" file in your firebase tools folder. for me, the path is
    /usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js
    use "npm root -g" to find your global npm path
  2. find the code below, about line 276
  if (!self.hasOwnProperty('proxy')) {
    self.proxy = getProxyFromURI(self.uri)
  }

change it to

  // if (!self.hasOwnProperty('proxy')) {
  //   self.proxy = getProxyFromURI(self.uri)
  // }
  self.proxy = "http://127.0.0.1:1087";  // this is your proxy address
  1. use firebase login --no-localhost
    IT WORKED

Edit the proxy and run this command to auto hack the library:
sed -i '/self.tunnel*/i \ \ self.proxy = "http://192.168.219.7:9090";' /usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js

@Xiangning2020
Copy link

Hope this will help you:
firebase-tools@7.15.1
it works on both win and mac with ssr

  1. find your proxy address
WeChatd29e8b5b594f8cff963da7441b84fbc9
  1. open "request.js" file in your firebase tools folder. for me, the path is
    /usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js
    use "npm root -g" to find your global npm path
  2. find the code below, about line 276
  if (!self.hasOwnProperty('proxy')) {
    self.proxy = getProxyFromURI(self.uri)
  }

change it to

  // if (!self.hasOwnProperty('proxy')) {
  //   self.proxy = getProxyFromURI(self.uri)
  // }
  self.proxy = "http://127.0.0.1:1087";  // this is your proxy address
  1. use firebase login --no-localhost

FINALLY WORKS!!! Thanks a ton!!!!🌷🌷🌷

@wuming2
Copy link

wuming2 commented Dec 19, 2020

In my case
I set http_proxy so I can login success but deploy fail.
error like Firebase Error:Failed to make request https://firebase-public......
So I use Proxifier work with my socks proxy as a Transparent proxy.
user Proxifier with shadowsocksx-ng-r8
Done!

@mohammad-karam
Copy link

Hope this will help you:
firebase-tools@7.15.1
it works on both win and mac with ssr

1. find your proxy address
WeChatd29e8b5b594f8cff963da7441b84fbc9
1. open "request.js" file in your firebase tools folder. for me, the path is
   /usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js
   use "npm root -g" to find your global npm path

2. find the code below, about line 276
  if (!self.hasOwnProperty('proxy')) {
    self.proxy = getProxyFromURI(self.uri)
  }

change it to

  // if (!self.hasOwnProperty('proxy')) {
  //   self.proxy = getProxyFromURI(self.uri)
  // }
  self.proxy = "http://127.0.0.1:1087";  // this is your proxy address
1. use firebase login --no-localhost

this works for firebase login, but it doesn't work for firebase init , I cannot list all projects from my google account.

@Gordon9
Copy link

Gordon9 commented Oct 27, 2021

in Powershell on Windows 10 powered by shadowsocks.

PS> set http_proxy = 'http://127.0.0.1:1080'
PS> set https_proxy = 'http://127.0.0.1:1080'
PS>set NO_PROXY = 'localhost,127.0.0.1'
PS> firebase login

In win10,this works for me, 1080 is my proxy port

it works !!! thank you !!(ps i'm on mac)

@mendax1234
Copy link

Mad it work on Mac using this trick
Screen Shot 2019-07-19 at 12 45 14

  1. Go the the network proxy setting on Mac and change Proxy Server and port from CNTL local host to actual enterprise server and port.
Screen Shot 2019-07-19 at 13 06 34
  1. No in the terminal temporary authenticate proxy

ProxyPass & ProxyUserName : same as login credentials stored in CNTLM
ProxyServer & ProxyPort: same as what you have set in network settings.

export http_proxy=http://<ProxyUserName>:<ProxyPass>@<ProxyServer>:<ProxyPort>
export https_proxy=http://<ProxyUserName>:<ProxyPass>@<ProxyServer>:<ProxyPort>

now I was able to login normally on firebase & deploy cloud functions. Hope it works

Thanks for this, I use "set" instead of "export" in windows, and it works

set http_proxy=http://127.0.0.1:port set https_proxy=http://127.0.0.1:port

20210718011812

Where did you use the set command, l can't use it in Powershell.

@chenqiuxia
Copy link

still experiencing this issue, can't believe it is still around in 2022 ...

@typenoob
Copy link

Move the proxy tool to the router,and it immediately worked.So can we build a local proxy software with the same princinple the router's use?

@algaeReed
Copy link

Thank you.

  1. set proxy
    image
    2 .
    C:\Users\admin\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\request\request.js

  // if (!self.hasOwnProperty('proxy')) {
  //   self.proxy = getProxyFromURI(self.uri)
  // }

  self.proxy = "http://127.0.0.1:4780";  // this is your proxy address

image

  1. use firebase login , Success!

image

@johnystecker
Copy link

Sooo... They just don't care about proxy users? Old way was to downgrade to firebase-tools@8.15.0, but that does not work because of Authentication error the site gives, because of "The version of the app you're using doesn't include the latest security features to keep you protected."

This has to be a joke.

@arfarobs
Copy link

Mad it work on Mac using this trick
Screen Shot 2019-07-19 at 12 45 14

  1. Go the the network proxy setting on Mac and change Proxy Server and port from CNTL local host to actual enterprise server and port.
Screen Shot 2019-07-19 at 13 06 34
  1. No in the terminal temporary authenticate proxy

ProxyPass & ProxyUserName : same as login credentials stored in CNTLM
ProxyServer & ProxyPort: same as what you have set in network settings.

export http_proxy=http://<ProxyUserName>:<ProxyPass>@<ProxyServer>:<ProxyPort>
export https_proxy=http://<ProxyUserName>:<ProxyPass>@<ProxyServer>:<ProxyPort>

now I was able to login normally on firebase & deploy cloud functions. Hope it works

Thanks for this, I use "set" instead of "export" in windows, and it works

set http_proxy=http://127.0.0.1:port set https_proxy=http://127.0.0.1:port

20210718011812

You sir are a genius! Thank you!

This worked for me. I'm in China using clash for windows as a proxy. I ran the command prompt as an administrator and set the proxies. Worked first time.

Legend!

@Gsonovb
Copy link

Gsonovb commented Apr 5, 2023

Looking at the code, the new version can get the proxy from the environment variable,

My situation here is that using localhost or 127.0.0.1 will fail. So use the IP:port of the proxy server in the LAN

Three ways to set environment variables

In CMD

set HTTPS_PROXY=http:// IP:port << don't use localhost or 127.0.0.1
set NODE_TLS_REJECT_UNAUTHORIZED=0

in Powershell

$env:HTTPS_PROXY="http://IP:port" << don't use localhost or 127.0.0.1
$env:NODE_TLS_REJECT_UNAUTHORIZED=0

In VSCODE, you can add a settings file (.vscodesettings.json) to specify the environment variable that opens the terminal.

{
    "terminal.integrated.env.windows": {
        "HTTPS_PROXY":"http://IP:port",
        "NODE_TLS_REJECT_UNAUTHORIZED": "0"
    }
}

@johnson1q
Copy link

Thank you.

  1. set proxy
    image
    2 .
    C:\Users\admin\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\request\request.js

  // if (!self.hasOwnProperty('proxy')) {
  //   self.proxy = getProxyFromURI(self.uri)
  // }

  self.proxy = "http://127.0.0.1:4780";  // this is your proxy address

image

  1. use firebase login , Success!

image

after set proxy. auth failed. my proxy is
ftp=127.0.0.1:9999;gopher=127.0.0.1:9999;http=127.0.0.1:9999;https=127.0.0.1:9999;socks=127.0.0.1:10000;lq=1
image

@paulpacaud
Copy link

in Powershell on Windows 10 powered by shadowsocks.

PS> set http_proxy = 'http://127.0.0.1:1080'
PS> set https_proxy = 'http://127.0.0.1:1080'
PS>set NO_PROXY = 'localhost,127.0.0.1'
PS> firebase login

In win10,this works for me, 1080 is my proxy port

it works !!! thank you !!(ps i'm on mac)

This solution still works as of today. I recommend following these steps to identify YOUR proxy address: https://suitabletech.com/support/helpcenter/errors-full-listing/1895-locating-proxy-server-ip-address-windows

@lulu546
Copy link

lulu546 commented Dec 13, 2023

image
!!!!!
if PowerShell,
PS C:\Users\86205> $env:http_proxy = 'http://127.0.0.1:11199'
PS C:\Users\86205> $env:https_proxy = 'http://127.0.0.1:11199'
PS C:\Users\86205> $env:NO_PROXY = 'localhost,127.0.0.1'
PS C:\Users\86205> firebase login

@flutterdeveloperxyz
Copy link

Still unable to solve the issue(in China), tried most of the answers.

@hcanyz
Copy link

hcanyz commented Mar 12, 2024

image !!!!! if PowerShell,  如果是 PowerShell, PS C:\Users\86205> $env:http_proxy = 'http://127.0.0.1:11199' PS C:\Users\86205> $env:https_proxy = 'http://127.0.0.1:11199' PS C:\Users\86205> $env:NO_PROXY = 'localhost,127.0.0.1' PS C:\Users\86205> firebase loginPS C:\Users\86205> firebase 登录

image

this works for me

In China .

@flutterdeveloperxyz
Copy link

flutterdeveloperxyz commented Mar 25, 2024

Update. Just made login working.

  1. run Git Bash or any Linux-like command line tool
  2. execute these commands, substitute your proxy instead

export HTTP_PROXY="http://proxy.XXXXXXXX.com:80/" export HTTPS_PROXY="http://proxy.XXXXXXXX.com:80/"

  1. after this I was able to login using

firebase login --interactive

  1. useful links

#36 (comment) https://www.npmjs.com/package/request#controlling-proxy-behaviour-using-environment-variables

I'm in China. I tried so many answers from various sources for 3-4 months(day after few days). Nothing worded. Only it works from git-bash. Thanks a million.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests