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 · 134 comments
Closed

Unable to deploy behind a proxy #155

ymainier opened this issue May 26, 2016 · 134 comments

Comments

@ymainier
Copy link

@ymainier ymainier commented May 26, 2016

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

This comment has been minimized.

Copy link
Contributor

@mbleigh 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

This comment has been minimized.

Copy link

@summers173 summers173 commented Jun 1, 2016

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

This comment has been minimized.

Copy link

@aprice2704 aprice2704 commented Jul 8, 2016

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

This comment has been minimized.

Copy link

@rohitsuratekar rohitsuratekar commented Jul 24, 2016

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

@cskiwi

This comment has been minimized.

Copy link

@cskiwi 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

This comment has been minimized.

Copy link

@yuxizhe yuxizhe commented Sep 7, 2016

same problem ..

@echopi

This comment has been minimized.

Copy link

@echopi echopi commented Oct 4, 2016

I've came to this problem twice ..

@sel

This comment has been minimized.

Copy link

@sel 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

This comment has been minimized.

Copy link

@xgqfrms-GitHub xgqfrms-GitHub commented Jan 11, 2017

Firebase login failed
#250
#240
#249

@tolgabalci

This comment has been minimized.

Copy link

@tolgabalci 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

This comment has been minimized.

Copy link

@yunfengsa yunfengsa commented Mar 17, 2017

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

This comment has been minimized.

Copy link

@chinsyo chinsyo commented Mar 24, 2017

same problem..

@henriquedesousa

This comment has been minimized.

Copy link

@henriquedesousa henriquedesousa commented Mar 27, 2017

One year and still no fix?

Come on, evil googol..

@Ernesto-Valdes

This comment has been minimized.

Copy link

@Ernesto-Valdes 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

This comment has been minimized.

Copy link

@tingxins 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

This comment has been minimized.

Copy link

@enif-lee 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

This comment has been minimized.

Copy link

@ChampIsMe ChampIsMe commented May 28, 2017

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

@zakali22

This comment has been minimized.

Copy link

@zakali22 zakali22 commented Jun 4, 2017

Why is it not solved until now?

@TivJsou

This comment has been minimized.

Copy link

@TivJsou TivJsou commented Jun 13, 2017

one year

@Symbolk

This comment has been minimized.

Copy link

@Symbolk Symbolk commented Jun 28, 2017

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

@jmrosdev

This comment has been minimized.

Copy link

@jmrosdev jmrosdev commented Jul 4, 2017

Same problem...

@elpagano

This comment has been minimized.

Copy link

@elpagano elpagano commented Jul 10, 2017

Same problem

@hardikpthv

This comment has been minimized.

Copy link

@hardikpthv hardikpthv commented Jul 17, 2017

Same problem...

@peterennis

This comment has been minimized.

Copy link

@peterennis peterennis commented Jul 24, 2017

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

@Symbolk

This comment has been minimized.

Copy link

@Symbolk Symbolk commented Jul 31, 2017

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.

@Arushi-Jain

This comment has been minimized.

Copy link

@Arushi-Jain Arushi-Jain commented Sep 4, 2018

firebase login --no-localhost

This command fixed it for me behind proxy

@starry

This comment has been minimized.

Copy link

@starry starry commented Sep 15, 2018

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

// line 290 to 298
 // if (!self.hasOwnProperty('proxy')) {
  //   self.proxy = getProxyFromURI(self.uri)
  // }
  self.proxy = 'http://127.0.0.1:1087'    // add proxy server
  self.tunnel = self._tunnel.isEnabled()
  
  if (self.proxy) {
    self._tunnel.setup(options)
  }

Therefore, Login is success! 😃

Don't forget delete proxy server setting after login success.

Great!!!

@yongjiaming

This comment has been minimized.

Copy link

@yongjiaming yongjiaming commented Sep 18, 2018

@chen86860 No, you don't modify the source code now, just export proxy in your environment:

$ export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;

i just run the script in terminal,but still get same error.What's wrong there?
yongjiamingdeMacBook-Pro:firebase yongjiaming$ firebase login --debug
[2018-09-18T03:33:08.860Z] ----------------------------------------------------------------------
[2018-09-18T03:33:08.863Z] Command: /usr/local/Cellar/node/9.6.1/bin/node /usr/local/bin/firebase login --debug
[2018-09-18T03:33:08.864Z] CLI Version: 4.2.1
[2018-09-18T03:33:08.864Z] Platform: darwin
[2018-09-18T03:33:08.864Z] Node Version: v9.6.1
[2018-09-18T03:33:08.864Z] Time: Tue Sep 18 2018 11:33:08 GMT+0800 (CST)
[2018-09-18T03:33:08.864Z] ----------------------------------------------------------------------

? Allow Firebase to collect anonymous CLI usage and error reporting information? Yes

Visit this URL on any device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplatformprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=971322293&redirect_uri=http%3A%2F%2Flocalhost%3A9005

Waiting for authentication...
[2018-09-18T03:33:16.437Z] >>> HTTP REQUEST POST https://accounts.google.com/o/oauth2/token
code=4/XgBxvL5SXC-Wg5vT8CCTdfLIoTPKVkCOFcmVku25RwRlkLUc-inqxg6mPRNX7JKRA8fWufJEm-7e5BKTbfFCmsk, client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com, client_secret=j9iVZfS8kkCEFUPaAeJV0sAi, redirect_uri=http://localhost:9005, grant_type=authorization_code
[2018-09-18T03:33:16.454Z] Token Fetch Error: Error
at new FirebaseError (/usr/local/lib/node_modules/firebase-tools/lib/error.js:11:16)
at Request._callback (/usr/local/lib/node_modules/firebase-tools/lib/api.js:34:11)
at self.callback (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:185:22)
at Request.emit (events.js:127:13)
at Request.emit (domain.js:421:20)
at Request.onRequestError (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:881:8)
at ClientRequest.emit (events.js:127:13)
at ClientRequest.emit (domain.js:421:20)
at ClientRequest.onError (/usr/local/lib/node_modules/firebase-tools/node_modules/tunnel-agent/index.js:179:21)
at Object.onceWrapper (events.js:219:13)
^Z
[1]+ Stopped firebase login --debug

@Schoko19961

This comment has been minimized.

Copy link

@Schoko19961 Schoko19961 commented Sep 20, 2018

I have a problem with deploying my project to firebase behind a proxy as well.
Sign in works without a problem.

http_proxy and https_proxy are set to the cntlm.
The commands I tried are:

firebase deploy -P <projectname> --token <token> --debug
firebase deploy -P <projectname> --debug

This is the output:

firebase deploy -P prod --debug
[2018-09-20T09:42:15.911Z] ----------------------------------------------------------------------
[2018-09-20T09:42:15.926Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\<user>\AppData\Roaming\npm\node_modules\firebase-tools\bin\firebase deploy -P prod --debug
[2018-09-20T09:42:15.942Z] CLI Version:   4.2.1
[2018-09-20T09:42:15.942Z] Platform:      win32
[2018-09-20T09:42:15.942Z] Node Version:  v8.11.3
[2018-09-20T09:42:15.942Z] Time:          Thu Sep 20 2018 11:42:15 GMT+0200 (Mitteleuropäische Sommerzeit)
[2018-09-20T09:42:15.942Z] ----------------------------------------------------------------------

[2018-09-20T09:42:15.973Z] > 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"]
[2018-09-20T09:42:15.975Z] > authorizing via signed-in user
[2018-09-20T09:42:15.978Z] > 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"]
[2018-09-20T09:42:15.979Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
 refresh_token=<token>, client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com, client_secret=j9iVZfS8kkCEFUPaAeJV0sAi, 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
[2018-09-20T09:42:16.321Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=utf-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 20 Sep 2018 09:42:16 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="44,43,39,35", accept-ranges=none, connection=close
[2018-09-20T09:42:16.332Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/<project>


!  Your CLI authentication needs to be updated to take advantage of new features.
!  Please run firebase login --reauth

[2018-09-20T09:42:16.485Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"]
[2018-09-20T09:42:16.485Z] > authorizing via signed-in user
[2018-09-20T09:42:16.485Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[2018-09-20T09:42:16.485Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
 refresh_token=<token>, client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com, client_secret=j9iVZfS8kkCEFUPaAeJV0sAi, grant_type=refresh_token, scope=email https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase openid
[2018-09-20T09:42:16.740Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=utf-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 20 Sep 2018 09:42:16 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="44,43,39,35", accept-ranges=none, connection=close
[2018-09-20T09:42:16.769Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/<project>

[2018-09-20T09:42:16.861Z] Error: tunneling socket could not be established, statusCode=407
    at ClientRequest.onConnect (C:\Users\<user>\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\tunnel-agent\index.js:166:19)
    at Object.onceWrapper (events.js:319:30)
    at emitThree (events.js:136:13)
    at ClientRequest.emit (events.js:217:7)
    at Socket.socketOnData (_http_client.js:474:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)

Error: Server Error. tunneling socket could not be established, statusCode=407
@yongjiaming

This comment has been minimized.

Copy link

@yongjiaming yongjiaming commented Sep 20, 2018

@chen86860 No, you don't modify the source code now, just export proxy in your environment:

$ export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;

i just run the script in terminal,but still get same error.What's wrong there?
yongjiamingdeMacBook-Pro:firebase yongjiaming$ firebase login --debug
[2018-09-18T03:33:08.860Z] ----------------------------------------------------------------------
[2018-09-18T03:33:08.863Z] Command: /usr/local/Cellar/node/9.6.1/bin/node /usr/local/bin/firebase login --debug
[2018-09-18T03:33:08.864Z] CLI Version: 4.2.1
[2018-09-18T03:33:08.864Z] Platform: darwin
[2018-09-18T03:33:08.864Z] Node Version: v9.6.1
[2018-09-18T03:33:08.864Z] Time: Tue Sep 18 2018 11:33:08 GMT+0800 (CST)
[2018-09-18T03:33:08.864Z] ----------------------------------------------------------------------

? Allow Firebase to collect anonymous CLI usage and error reporting information? Yes

Visit this URL on any device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplatformprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=971322293&redirect_uri=http%3A%2F%2Flocalhost%3A9005

Waiting for authentication...
[2018-09-18T03:33:16.437Z] >>> HTTP REQUEST POST https://accounts.google.com/o/oauth2/token
code=4/XgBxvL5SXC-Wg5vT8CCTdfLIoTPKVkCOFcmVku25RwRlkLUc-inqxg6mPRNX7JKRA8fWufJEm-7e5BKTbfFCmsk, client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com, client_secret=j9iVZfS8kkCEFUPaAeJV0sAi, redirect_uri=http://localhost:9005, grant_type=authorization_code
[2018-09-18T03:33:16.454Z] Token Fetch Error: Error
at new FirebaseError (/usr/local/lib/node_modules/firebase-tools/lib/error.js:11:16)
at Request._callback (/usr/local/lib/node_modules/firebase-tools/lib/api.js:34:11)
at self.callback (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:185:22)
at Request.emit (events.js:127:13)
at Request.emit (domain.js:421:20)
at Request.onRequestError (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:881:8)
at ClientRequest.emit (events.js:127:13)
at ClientRequest.emit (domain.js:421:20)
at ClientRequest.onError (/usr/local/lib/node_modules/firebase-tools/node_modules/tunnel-agent/index.js:179:21)
at Object.onceWrapper (events.js:219:13)
^Z
[1]+ Stopped firebase login --debug

just update to the latest shadowscoks ,everything go all right~

@upupming

This comment has been minimized.

Copy link

@upupming upupming commented Nov 8, 2018

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 use http_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

firebase login --no-localhost

Serve

export https_proxy=socks5://127.0.0.1:1080
firebase serve

Deploy

Add the follwowing code between BEGIN_PROXY and AFTER_PROXY to your functions/node_modules/faye-websocket/lib/faye/websocket/client.js

// ...
var Client = function(_url, protocols, options) {
  options = options || {};

  // BEGIN_PROXY
  options.proxy = {
    origin:  'http://localhost:8888',
    headers: {'User-Agent': 'node'},
  }
  // AFTER_PROXY

// ...
firebase deploy
Click to see my log
upupming@DESKTOP-6EB87T6 MINGW64 /e/github/firebase-test
$ firebase login --no-localhost
? Allow Firebase to collect anonymous CLI usage and error reporting
 information? No

Visit this URL on any device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplatformprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=928286882&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob

? Paste authorization code here: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

+  Success! Logged in as upupming@gmail.com

upupming@DESKTOP-6EB87T6 MINGW64 /e/github/firebase-test
$ firebase serve

=== Serving from 'E:\github\firebase-test'...

i  functions: Preparing to emulate functions.
i  hosting: Serving hosting files from: public
+  hosting: Local server: http://localhost:5000
Warning: You're using Node.js v8.11.3 but Google Cloud Functions only supports v6.11.5.
+  functions: app: http://localhost:5001/learning-13a18/us-central1/app
127.0.0.1 - - [08/Nov/2018:04:40:35 +0000] "GET / HTTP/1.1" 200 3505 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
127.0.0.1 - - [08/Nov/2018:04:40:37 +0000] "GET /__/firebase/init.js HTTP/1.1" 200 - "http://localhost:5000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
127.0.0.1 - - [08/Nov/2018:04:40:37 +0000] "GET /__/firebase/5.5.7/firebase-app.js HTTP/1.1" 200 - "http://localhost:5000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
127.0.0.1 - - [08/Nov/2018:04:40:38 +0000] "GET /__/firebase/5.5.7/firebase-auth.js HTTP/1.1" 200 - "http://localhost:5000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
127.0.0.1 - - [08/Nov/2018:04:40:38 +0000] "GET /__/firebase/5.5.7/firebase-messaging.js HTTP/1.1" 200 - "http://localhost:5000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
127.0.0.1 - - [08/Nov/2018:04:40:38 +0000] "GET /__/firebase/5.5.7/firebase-database.js HTTP/1.1" 200 - "http://localhost:5000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/70.0.3538.77 Safari/537.36"
127.0.0.1 - - [08/Nov/2018:04:40:39 +0000] "GET /__/firebase/5.5.7/firebase-storage.js HTTP/1.1" 200 - "http://localhost:5000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
127.0.0.1 - - [08/Nov/2018:04:40:40 +0000] "GET /favicon.ico HTTP/1.1" 404 1808 "http://localhost:5000/" "Mozilla/5.0 (Windows NT 10.0;
Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
[hosting] Rewriting /timestamp to local function app
info: User function triggered, starting execution
info: Execution took 23 ms, user function completed successfully
127.0.0.1 - - [08/Nov/2018:04:40:41 +0000] "GET /timestamp HTTP/1.1" 200 13 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
[hosting] Rewriting /timestamp to local function app
info: User function triggered, starting execution
info: Execution took 2 ms, user function completed successfully
127.0.0.1 - - [08/Nov/2018:04:40:43 +0000] "GET /timestamp HTTP/1.1" 200 13 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
Shutting down...


upupming@DESKTOP-6EB87T6 MINGW64 /e/github/firebase-test
$ export http_proxy=socks5://127.0.0.1:1080

upupming@DESKTOP-6EB87T6 MINGW64 /e/github/firebase-test
$ firebase serve

Error: Server Error. socket hang up

upupming@DESKTOP-6EB87T6 MINGW64 /e/github/firebase-test
$ export http_proxy=

upupming@DESKTOP-6EB87T6 MINGW64 /e/github/firebase-test
$ firebase serve

=== Serving from 'E:\github\firebase-test'...

i  functions: Preparing to emulate functions.
i  hosting: Serving hosting files from: public
+  hosting: Local server: http://localhost:5000
Warning: You're using Node.js v8.11.3 but Google Cloud Functions only supports v6.11.5.
+  functions: app: http://localhost:5001/learning-13a18/us-central1/app
Shutting down...


upupming@DESKTOP-6EB87T6 MINGW64 /e/github/firebase-test
$ firebase deploy

Error: Server Error. socket hang up

upupming@DESKTOP-6EB87T6 MINGW64 /e/github/firebase-test
$ firebase deploy

=== Deploying to 'learning-13a18'...

i  deploying functions, hosting
Running command: npm --prefix "%RESOURCE_DIR%" run lint

> functions@ lint E:\github\firebase-test\functions
> eslint .

+  functions: Finished running predeploy script.
i  functions: ensuring necessary APIs are enabled...
+  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (52.46 KB) for uploading
+  functions: functions folder uploaded successfully
i  hosting[learning-13a18]: beginning deploy...
i  hosting[learning-13a18]: found 2 files in public
+  hosting[learning-13a18]: file upload complete
i  functions: updating Node.js 6 function app(us-central1)...
+  functions[app(us-central1)]: Successful update operation.
i  hosting[learning-13a18]: finalizing version...
+  hosting[learning-13a18]: version finalized
i  hosting[learning-13a18]: releasing new version...
+  hosting[learning-13a18]: release complete

+  Deploy complete!

Project Console: https://console.firebase.google.com/project/learning-13a18/overviewHosting URL: https://learning-13a18.firebaseapp.com

Alternative solution

If you are always using home WiFi network, you can config Shadowsocks proxy on your router. See this repo for more information.

@tangyong3g

This comment has been minimized.

Copy link

@tangyong3g tangyong3g commented Nov 11, 2018

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 use http_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

firebase login --no-localhost

Serve

export https_proxy=socks5://127.0.0.1:1080
firebase serve

Deploy

Add the follwowing code between BEGIN_PROXY and AFTER_PROXY to your functions/node_modules/faye-websocket/lib/faye/websocket/client.js

// ...
var Client = function(_url, protocols, options) {
  options = options || {};

  // BEGIN_PROXY
  options.proxy = {
    origin:  'http://localhost:8888',
    headers: {'User-Agent': 'node'},
  }
  // AFTER_PROXY

// ...
firebase deploy

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.

@Genie77998

This comment has been minimized.

Copy link

@Genie77998 Genie77998 commented Dec 14, 2018

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

@KunalKene1797

This comment has been minimized.

Copy link

@KunalKene1797 KunalKene1797 commented Jan 8, 2019

2019 Still doesn't work! any luck?

@Purus

This comment has been minimized.

Copy link

@Purus Purus commented Jan 10, 2019

I am not behind proxy. Login is succecssfull and facing this same issue in deploy.

@unipheas

This comment has been minimized.

Copy link

@unipheas unipheas commented Jan 13, 2019

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

Worked for me behind shadowsocks in China. Thanks!

@naftalibe

This comment has been minimized.

Copy link

@naftalibe naftalibe commented Jan 21, 2019

same problem ..

@yqx1110

This comment has been minimized.

Copy link

@yqx1110 yqx1110 commented Feb 9, 2019

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(R) on your router. Worked for me.

@tutudezhenshen

This comment has been minimized.

Copy link

@tutudezhenshen tutudezhenshen commented Feb 16, 2019

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

It works on my Mac with shadowsocks in China. Thanks a lot!

@xuemind

This comment has been minimized.

Copy link

@xuemind xuemind commented Mar 7, 2019

in Powershell on Windows 10 powered by shadowsocks.

PS> $env:http_proxy = 'http://127.0.0.1:1080'
PS> $env:https_proxy = 'http://127.0.0.1:1080'
PS> $env:NO_PROXY = 'localhost,127.0.0.1'
PS> firebase login
@ishowman

This comment has been minimized.

Copy link

@ishowman ishowman commented Mar 24, 2019

2019/03/24, still failed on my mac air

@upupming

This comment has been minimized.

Copy link

@upupming upupming commented Mar 24, 2019

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(R) on your router. Worked for me.

@yqx1110 Thanks very much, this is the most powerful tool I have ever seen.

@cnscorpions

This comment has been minimized.

Copy link

@cnscorpions cnscorpions commented Apr 1, 2019

failed, not work

@9pab

This comment has been minimized.

Copy link

@9pab 9pab commented Apr 18, 2019

Hello, I just found the solution. Please follow the link https://qiita.com/tanoc/items/ac92464de473ae483d50

@asralf90

This comment has been minimized.

Copy link

@asralf90 asralf90 commented Apr 24, 2019

Hello, I just found the solution. Please follow the link https://qiita.com/tanoc/items/ac92464de473ae483d50

The above also works for Clasp. Thank you

@PriestTomb

This comment has been minimized.

Copy link

@PriestTomb PriestTomb commented Jun 29, 2019

in Powershell on Windows 10 powered by shadowsocks.

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

Thanks, it works for me on win10.

@hiteshsahu

This comment has been minimized.

Copy link

@hiteshsahu hiteshsahu commented Jul 19, 2019

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

@WispAmulet

This comment has been minimized.

Copy link

@WispAmulet WispAmulet commented Jul 26, 2019

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

Works for me! Thx.

@brekov

This comment has been minimized.

Copy link

@brekov brekov commented Aug 10, 2019

2019.8.10 I've tried almost all the solutions above, and it's not working. sadly...

@Hackergeek

This comment has been minimized.

Copy link

@Hackergeek Hackergeek commented Aug 13, 2019

@starry
work for me , thanks

@spongebody

This comment has been minimized.

Copy link

@spongebody spongebody commented Sep 2, 2019

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

@Hesse-Huang

This comment has been minimized.

Copy link

@Hesse-Huang Hesse-Huang commented Oct 27, 2019

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. 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.