firebase-tools: Unable to deploy behind a proxy
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
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 53
- Comments: 166 (8 by maintainers)
Links to this issue
Commits related to this issue
- Use firebase-admin as dependency when initializing a project for functions (#155) — committed to firebase/firebase-tools by laurenzlong 7 years ago
- Revert "Use firebase-admin as dependency when initializing a project for functions (#155)" This reverts commit b33629156fb01cf423f356562026eb3e60ffe8ac. — committed to firebase/firebase-tools by mbleigh 7 years ago
Hope this will help you: firebase-tools@7.15.1 it works on both win and mac with ssr
find your proxy address
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
find the code below, about line 276
change it to
Firebase devs please solve this issue, it a serious dev delay up to date.
It still happens and keeps bothering me… Maybe I will give up firebase because I am in China…
One year and still no fix?
Come on, evil googol…
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.
##############
SOLUTION
#############
This Works!!!
Why is it not solved until now?
export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;export NO_PROXY=localhost,127.0.0.1
@chen86860 No, you don’t modify the source code now, just export proxy in your environment:
It’s 2018, still no fix to it, look likes they don’t maintain it.
Update. Just made login working.
export HTTP_PROXY=“http://proxy.XXXXXXXX.com:80/” export HTTPS_PROXY=“http://proxy.XXXXXXXX.com:80/”
firebase login --interactive
https://github.com/firebase/firebase-tools/issues/36#issuecomment-66696746 https://www.npmjs.com/package/request#controlling-proxy-behaviour-using-environment-variables
confirmed working solution:
http_proxy
since is still needed (and being respected) byrequest
faye-websocket/lib/faye/websocket/client.js
:NODE_TLS_REJECT_UNAUTHORIZED=0
p2
Same problem…
Same problem
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”
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”
Firebase login failed
https://github.com/firebase/firebase-tools/issues/250
https://github.com/firebase/firebase-tools/issues/240
https://github.com/firebase/firebase-tools/issues/249
in Powershell on Windows 10 powered by shadowsocks.
We have made some additional updates in
v4.1.2
that might fixfirebase deploy
proxy issues. Please give it a try and let me know if it’s not working!It is unacceptable, after two years, this problem is still not fixed? wth?
waiting for official solution… this issue has CRITICAL PRIORITY
One solution could be, to move to another country 💃
It is always like this if you are an android developer who is living in China.
I just hope that Google Play will come back one day.
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
in Powershell
In VSCODE, you can add a settings file (.vscodesettings.json) to specify the environment variable that opens the terminal.
this works for firebase login, but it doesn’t work for firebase init , I cannot list all projects from my google account.
Works for me! Thx.
Mad it work on Mac using this trick
Go the the network proxy setting on Mac and change Proxy Server and port from CNTL local host to actual enterprise server and port.
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.
now I was able to login normally on firebase & deploy cloud functions. Hope it works
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 😃
In the firebase
v4.2.0
, you can add a proxy server to connent server.edit the
request.js
which locate in$NODE_PATH/node_modules/request/request.js:290
Therefore, Login is success! 😃
Don’t forget delete proxy server setting after login success.
Ok i manage to do something like @namiwang explained before.
Here are some informations about versions i use. node: 7.5.0 npm: 4.1.2 firebase: 3.13.1
firebase-tools is installed globally, so I have to modify the proxy settings where firebase-tools is installed. In my case it is at ~/.nvm/versions/node/v7.5.0/lib/node_modules/firebase-tools
Open file ~/.nvm/versions/node/v7.5.0/lib/node_modules/firebase-tools/node_modules/firebase/node_modules/faye-websocket/lib/faye/websocket/client.js
Modify lines
to
For people who use v2ray for proxy on mac:
Hope this will help: The main logic here is to tell the faye there is a proxy on my local machine
I work around it via SSH.
I have a VPS so I cloned my project in it and login Firebase. Once I need to deploy new functions, just invoke a remote script via SSH.
Here is some scripts:
deployFunctionsRemote.sh in local
deployFunctions.sh in remote
Hasta cuando la solución señores de Firebase
I figured out one possible solution that works for those Shadowsocks proxy users(Windows 10 Pro).
1, run “firebase logout” under Shadowsocks PAC Mode;
2, run “firebase login” under Shadowsocks PAC Mode;
3, switch to Shadowsocks Global Mode(which redirects all your request to the remote serve);
4, try “firebase list” to see if the Authentication Error appears or not.
This works for me, but I am not sure whether it helps or not for you. Worth a try.
one year
In win10,this works for me, 1080 is my proxy port
Hello guys! Here is another solution which is pretty simple and you don’t need to edit any file. Instead of using Shadowsocks/ShadowsocksR, try SSTap. SSTap creates a virtual network card. I don’t know how to explain, but it works just like that you run Shadowsocks® on your router. Worked for me.
I’m living in China, so it’s really difficult to use Google’s products thanks to GFW. Currently I’m using Shadowsocks listening at 1080 port for accessing Google service.
Here is another problem, if you want to run
firebase serve
to serve dynamic functions, you cannot usehttp_proxy=socks5://127.0.0.1:1080
, because the localhost request will also be proxied in this way.I solved this by use only
https_proxy=socks5://127.0.0.1:1080
,Summary
Login
Serve
Deploy
Add the follwowing code between
BEGIN_PROXY
andAFTER_PROXY
to yourfunctions/node_modules/faye-websocket/lib/faye/websocket/client.js
Click to see my log
Alternative solution
If you are always using home WiFi network, you can config Shadowsocks proxy on your router. See this repo for more information.
I hope to have some good news on this front when some infrastructure work we’re doing now comes through. I don’t have a specific timeline to provide, however.
Sorry for the long delay in addressing this issue, it has been much more complicated than you’d think.
On Fri, Jun 29, 2018, 1:12 AM noobhui notifications@github.com wrote:
Confirming that this works
This worked for me!
set “NODE_TLS_REJECT_UNAUTHORIZED=0”
Hey,upstairs brother,can you speak English ?
Same problem…
Still unable to solve the issue(in China), tried most of the answers.
!!!!! 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
Hope this will help you:
steps are the same as before. The new file location: …/firebase-tools/lib/api.js
find the code below, around line 297
reqOptions.headers = options.headers; reqOptions.timeout = options.timeout;
append
reqOptions.proxy = "http://127.0.0.1:10818";
run
firebase login --no-localhost
Same issue.
still experiencing this issue, can’t believe it is still around in 2020 …
Great!!!
Alright, I add another issue #883 for socks proxy support.
I know some applications also support environment variables for socks proxy, like:
export http_proxy=socks5://127.0.0.1:1080 https_proxy=socks5://127.0.0.1:1080
Hope firebase command support it too.
share my solution for who work inside and wanna live outside the GFW.
Env: MacOS with shadowsocks-ng
Thanks @namiwang it works.
because firebase sdk 2.x.x is minified, so… polyfill faye-websocket is easier than fix sdk.
Actually, newer firebase sdk already fixed the bug. Waiting firebase-tools up deps to date…
we need a proxy option in firebase tools when
firebase login
I am not running behind a proxy but i am seeing this issue. I am getting the following error while deploying the code. ** Error: Server Error. connect ETIMEDOUT 172.217.31.202:443
So i did “firebase login --reauth” and provided correct credentials, but when i executed “firebase list” I got the following error even though I was logged in successfully. **Error: Authentication Error: Your credentials are no longer valid. Please run firebase login --reauth
Then i followed the following steps to resolve the issue. firebase logout firebase login -> Successful login firebase list -> I can see my apps firebase deploy -> I can deploy the code successfully.
As about “firebase deploy” - still have this issue. No errors, it just hangs.
I have the same problem, the firebase team just write me this:
“Not possible at the moment, tracking here: https://github.com/firebase/firebase-tools/issues/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
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.
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
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
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!
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.
Thank you.
firebase login
, Success!still experiencing this issue, can’t believe it is still around in 2022 …
FINALLY WORKS!!! Thanks a ton!!!🌷🌷🌷
Hello, I just found the solution. Please follow the link https://qiita.com/tanoc/items/ac92464de473ae483d50
failed, not work
@yqx1110 Thanks very much, this is the most powerful tool I have ever seen.
Worked for me behind shadowsocks in China. Thanks!
All right folks, it’s time to fix this bug once and for all! With the release of
v4.1.0
, the Firebase CLI no longer depends on a websocket connection for Hosting deploys. That means that everything is done through standard HTTP requests, which should be able to be easily made to work with proxies.I am going to try to get a test proxy running locally to work on this myself, but for those affected:
v4.1.0
“just work” or are you still having errors?HTTPS_PROXY
environment variable work for you?I know it’s been a long road, but (I hope) it will be coming to an end very soon. Please report back with your experience with 4.1.0, and we’ll start working through any remaining problems!
很难受 还没解决- -?
Cool. Could we do something like this though?
same here i solved this by sharing my mobile network…
Same problem 😦
Same for me, pretty sad deploy is not working behind a proxy 😦. Firebase tools are still awesome though
This P2 bug lives for one and half years.
I can only count on Good luck when debugging, tired of retrying login again and again, it has seriously delayed my project, I have to build my own server now.