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

Firebase CLI deploy doesn't work behind a proxy (regression) #2927

Closed
0100101101001011 opened this issue Dec 13, 2020 · 24 comments · Fixed by #2996
Closed

Firebase CLI deploy doesn't work behind a proxy (regression) #2927

0100101101001011 opened this issue Dec 13, 2020 · 24 comments · Fixed by #2996

Comments

@0100101101001011
Copy link

The firebase deploy hosting was working perfectly before. But now it produces the error:

My firebase --version is 8.19.0

i  deploying hosting
i  hosting[my-main-website]: beginning deploy...
i  hosting[my-main-website]: found 1462 files in public
⠋  hosting: adding files to version [0/1462] (0%)(node:4195) UnhandledPromiseRejectionWarning: FirebaseError: Failed to make request to https://firebase-public.firebaseio.com/cli.json
    at Client.<anonymous> (/usr/local/lib/node_modules/firebase-tools/lib/apiv2.js:177:23)
    at Generator.throw (<anonymous>)
    at rejected (/usr/local/lib/node_modules/firebase-tools/lib/apiv2.js:6:65)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
(node:4195) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4195) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
⠴  hosting: adding files to version [0/1462] (0%)
Error: Task index 0 failed: retries exhausted after 4 attempts
(node:4195) UnhandledPromiseRejectionWarning: FirebaseError: Task index 0 failed: retries exhausted after 4 attempts
    at Queue.<anonymous> (/usr/local/lib/node_modules/firebase-tools/lib/throttler/throttler.js:191:27)
    at Generator.throw (<anonymous>)
    at rejected (/usr/local/lib/node_modules/firebase-tools/lib/throttler/throttler.js:6:65)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
(node:4195) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
@khagesh
Copy link

khagesh commented Dec 15, 2020

Although this is not an hosting issue, but when starting local emulators I am also seeing similar issue

node:33316) UnhandledPromiseRejectionWarning: FirebaseError: Failed to make request to https://firebase-public.firebaseio.com/cli.json
    at Client.<anonymous> (/Users/a/.nvm/versions/node/v10.20.1/lib/node_modules/firebase-tools/lib/apiv2.js:177:23)
    at Generator.throw (<anonymous>)
    at rejected (/Users/a/.nvm/versions/node/v10.20.1/lib/node_modules/firebase-tools/lib/apiv2.js:6:65)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:33316) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:33316) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I think this url is down https://firebase-public.firebaseio.com/cli.json because I am not able to open this url in my browser.

What should we do next? Is there a workaround we can try?

@mbleigh
Copy link
Contributor

mbleigh commented Dec 15, 2020

Can you copy the complete response of curl -I https://firebase-public.firebaseio.com/cli.json? The URL in question is functioning for me, and I'm wondering if it's an ISP/firewall related issue.

@Eson-Jia
Copy link

firebase version is 9.0.0

✔ firestore: deployed indexes in firestore.indexes.json successfully
i hosting[fir-d4713]: beginning deploy...
i hosting[fir-d4713]: found 4 files in public
[2020-12-16T12:11:22.813Z] > refreshing access token with scopes: []
[2020-12-16T12:11:22.814Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token

[2020-12-16T12:11:22.817Z] [hosting] hash cache [cHVibGlj] stored for 4 files
[2020-12-16T12:11:22.818Z] [hosting][hash queue][FINAL] {"max":1,"min":1,"avg":1,"active":0,"complete":4,"success":4,"errored":0,"retried":0,"total":4,"elapsed":8}
[2020-12-16T12:11:23.732Z] <<< HTTP RESPONSE 200 {"expires":"Mon, 01 Jan 1990 00:00:00 GMT","date":"Wed, 16 Dec 2020 12:11:23 GMT","cache-control":"no-cache, no-store, max-age=0, must-revalidate","pragma":"no-cache","content-type":"application/json; charset=utf-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","server":"scaffolding on HTTPServer2","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-12-16T12:11:23.750Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/sites/fir-d4713/versions/661a636dce18f662:populateFiles [none]
[2020-12-16T12:11:23.751Z] >>> [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/sites/fir-d4713/versions/661a636dce18f662:populateFiles {"files":{"/404.html":"b7bab6b83fa074653ff28c8d2a64135d3434575f70a12ab3d3ba8080461b9537","/app.js":"ed5852442df49d644540be2f9b24b31e56d7c191b1201922793f6d4145c46064","/index.html":"d19903a54430182a7c4ef6593892e5b047c28833d4065cff4649629cabb9a620","/main.css":"b595f535fcb21c96fcaba1aea6439231917d3cebbf9e2bb3256aa003d44a623e"}}
[2020-12-16T12:11:24.192Z] [populateQueue] Retrying task index 0
[2020-12-16T12:11:24.194Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/sites/fir-d4713/versions/661a636dce18f662:populateFiles [none]
[2020-12-16T12:11:24.195Z] >>> [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/sites/fir-d4713/versions/661a636dce18f662:populateFiles {"files":{"/404.html":"b7bab6b83fa074653ff28c8d2a64135d3434575f70a12ab3d3ba8080461b9537","/app.js":"ed5852442df49d644540be2f9b24b31e56d7c191b1201922793f6d4145c46064","/index.html":"d19903a54430182a7c4ef6593892e5b047c28833d4065cff4649629cabb9a620","/main.css":"b595f535fcb21c96fcaba1aea6439231917d3cebbf9e2bb3256aa003d44a623e"}}
i hosting: adding files to version [0/4] (0%)
[2020-12-16T12:11:25.034Z] [populateQueue] Retrying task index 0
[2020-12-16T12:11:25.035Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/sites/fir-d4713/versions/661a636dce18f662:populateFiles [none]
[2020-12-16T12:11:25.035Z] >>> [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/sites/fir-d4713/versions/661a636dce18f662:populateFiles {"files":{"/404.html":"b7bab6b83fa074653ff28c8d2a64135d3434575f70a12ab3d3ba8080461b9537","/app.js":"ed5852442df49d644540be2f9b24b31e56d7c191b1201922793f6d4145c46064","/index.html":"d19903a54430182a7c4ef6593892e5b047c28833d4065cff4649629cabb9a620","/main.css":"b595f535fcb21c96fcaba1aea6439231917d3cebbf9e2bb3256aa003d44a623e"}}
[2020-12-16T12:11:26.668Z] [populateQueue] Retrying task index 0
[2020-12-16T12:11:26.669Z] >>> [apiv2][query] POST https://firebasehosting.googleapis.com/v1beta1/sites/fir-d4713/versions/661a636dce18f662:populateFiles [none]
[2020-12-16T12:11:26.669Z] >>> [apiv2][body] POST https://firebasehosting.googleapis.com/v1beta1/sites/fir-d4713/versions/661a636dce18f662:populateFiles {"files":{"/404.html":"b7bab6b83fa074653ff28c8d2a64135d3434575f70a12ab3d3ba8080461b9537","/app.js":"ed5852442df49d644540be2f9b24b31e56d7c191b1201922793f6d4145c46064","/index.html":"d19903a54430182a7c4ef6593892e5b047c28833d4065cff4649629cabb9a620","/main.css":"b595f535fcb21c96fcaba1aea6439231917d3cebbf9e2bb3256aa003d44a623e"}}
[2020-12-16T12:11:26.696Z] FirebaseError: Task index 0 failed: retries exhausted after 4 attempts
[2020-12-16T12:11:26.697Z] [hosting][upload queue][FINAL] {"max":0,"min":9999999999,"avg":0,"active":0,"complete":0,"success":0,"errored":0,"retried":0,"total":0,"elapsed":1608120686697}
(node:40361) UnhandledPromiseRejectionWarning: FirebaseError: Task index 0 failed: retries exhausted after 4 attempts
at Queue.executeTask (/usr/local/lib/node_modules/firebase-tools/lib/throttler/throttler.js:179:23)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Queue.handle (/usr/local/lib/node_modules/firebase-tools/lib/throttler/throttler.js:91:22)
(Use node --trace-warnings ... to show where the warning was created)
(node:40361) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:40361) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[2020-12-16T12:11:28.371Z] FirebaseError: Failed to make request to https://firebasehosting.googleapis.com/v1beta1/sites/fir-d4713/versions/661a636dce18f662:populateFiles
at Client.doRequest (/usr/local/lib/node_modules/firebase-tools/lib/apiv2.js:161:19)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Client.request (/usr/local/lib/node_modules/firebase-tools/lib/apiv2.js:84:20)
at async Uploader.populateHandler (/usr/local/lib/node_modules/firebase-tools/lib/deploy/hosting/uploader.js:156:21)
at async Queue.executeTask (/usr/local/lib/node_modules/firebase-tools/lib/throttler/throttler.js:175:22)
at async Queue.handle (/usr/local/lib/node_modules/firebase-tools/lib/throttler/throttler.js:91:22)

Error: Task index 0 failed: retries exhausted after 4 attempts

@zw3428
Copy link

zw3428 commented Dec 17, 2020

@Eson-Jia I have the same error as yours, did you solve this problem? How did you solve it?

@Eson-Jia
Copy link

@Eson-Jia I have the same error as yours, did you solve this problem? How did you solve it?

not yet

@hanguokai
Copy link

I also encountered hosting deployment issue. In my test, I go back to the v8.16.2 version and there is no problem, but from v8.17.0 version, it has this issue. This issue may be related to network proxy.

Below is error details:

hosting: adding files to version [0/52] (0%)(node:50485) UnhandledPromiseRejectionWarning: FirebaseError: Failed to make request to https://firebase-public.firebaseio.com/cli.json
    at Client.<anonymous> (/Users/xxx/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/apiv2.js:174:23)
    at Generator.throw (<anonymous>)
    at rejected (/Users/xxx/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/apiv2.js:6:65)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:50485) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:50485) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
⠹  hosting: adding files to version [0/52] (0%)
Error: Task index 0 failed: retries exhausted after 4 attempts
(node:50485) UnhandledPromiseRejectionWarning: FirebaseError: Task index 0 failed: retries exhausted after 4 attempts
    at Queue.<anonymous> (/Users/xxx/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/throttler/throttler.js:191:27)
    at Generator.throw (<anonymous>)
    at rejected (/Users/xxx/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/throttler/throttler.js:6:65)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:50485) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

@sks4903440
Copy link

Faced the same issue while deleting a lot of files. Downgrading firebase to version 8.15.0 worked.

@khagesh
Copy link

khagesh commented Dec 21, 2020

@mbleigh Here is the output for curl command

curl -I https://firebase-public.firebaseio.com/cli.json
curl: (7) Failed to connect to firebase-public.firebaseio.com port 443: Operation timed out

This is the output when I try to connect from Wi-Fi. However, when I connect to a VPN and selected a US server, then this url seems to work fine. Here is curl output using US servers on a VPN

curl -I https://firebase-public.firebaseio.com/cli.json
HTTP/1.1 405 Method Not Allowed
Server: nginx
Date: Mon, 21 Dec 2020 09:20:25 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 43
Connection: keep-alive
Access-Control-Allow-Origin: *
Cache-Control: no-cache
Strict-Transport-Security: max-age=31556926; includeSubDomains; preload

I also connected via Hotspot of my phone and this url works fine. Looks like some problem with my WiFi ISP.

I have got the expected output. Now, I can reverse proxy this url to return expected output. However, I would suggest building a fallback in code for cases when this url fails to load.

@hanguokai
Copy link

As @khagesh also confirmed this issue related to network and @sks4903440 also confirmed it is ok for an old version of firebase cli.

So I guess this is a regression issue. #155 is related to proxy problem in firebase cli, and it was fixed 2 years ago. Now, since 8.17.0, this problem reappeared again.

@mbleigh mbleigh changed the title Firebase deploy hosting error on: adding files to version step. Firebase CLI deploy doesn't work behind a proxy (regression) Dec 21, 2020
@mbleigh
Copy link
Contributor

mbleigh commented Dec 21, 2020

TL;DR: Downgrade to 8.15.0 as a workaround for the time being

Hi folks,

I think there is indeed a regression here. We have been migrating to a new HTTP library for core CLI functionality, and it looks like it might not support the HTTP_PROXY environment variable by default. Since it's around the holidays we are currently reducing our release schedule and might not be able to get this fixed until early January. However, you should be able to downgrade your CLI to v8.15.0 to get around the issue until then.

Sorry for the inconvenience, and happy holidays! ❄️

@0100101101001011
Copy link
Author

Downgrading firebase tools to 8.15.0 npm i -g [email protected] does solve this problem for now. Thanks!

@MollyXuemn
Copy link

MollyXuemn commented Mar 14, 2021

why i downgraded the firebase to 8.15.0, the problem still exists?

Waiting for authentication...
(node:10492) UnhandledPromiseRejectionWarning: FirebaseError: Failed to make request to https://firebase-public.firebaseio.com/cli.json
at Client.doRequest (/usr/local/lib/node_modules/firebase-tools/lib/apiv2.js:211:19)
at processTicksAndRejections (internal/process/task_queues.js:85:5)
(node:10492) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10492) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@Habtesoft
Copy link

check your internet connection

@kamalbanga
Copy link

@mbleigh Downgrading to 8.15.0 helps but is the issue still not solved in 9.10.0? I have not been able to login with the latest version, but works for 8.15.0.

@mbleigh
Copy link
Contributor

mbleigh commented May 3, 2021

@kamalbanga please open a new issue with detailed information about the error you're experiencing, closed issues aren't monitored on an ongoing basis.

@zhongshuaicc
Copy link

I faced the same problem and resolved it by adding proxies.
set http_proxy=http://127.0.0.1:20809
set https_proxy=http://127.0.0.1:20809

@JamesHongBiz333
Copy link

JamesHongBiz333 commented Nov 27, 2021

hello, I also have the same problem, the "Error: Failed to make request to https://firebase-public.firebaseio.com/cli.json" caused by refresh token for my case. and I'm lucky to found firebase cli also provide and option "--token", So I think maybe I can give it a token so that it no need to request that URL to get a new token to cause the Error.
I tried it, and it worked for my.
1, using firebase login:ci, to generate an token, after it redirect to browser and your authorized login, a new token is generated, and also you use "$FIREBASE_TOKEN" instead.
2, for me, I just went to run emulator locally without internet (my poor internet), so I run command: firebase emulators:start --token "$FIREBASE_TOKEN"
hope you guys get lucky, too.

@tremayne-stewart
Copy link

hello, I also have the same problem, the "Error: Failed to make request to https://firebase-public.firebaseio.com/cli.json" caused by refresh token for my case. and I'm lucky to found firebase cli also provide and option "--token", So I think maybe I can give it a token so that it no need to request that URL to get a new token to cause the Error. I tried it, and it worked for my. 1, using firebase login:ci, to generate an token, after it redirect to browser and your authorized login, a new token is generated, and also you use "$FIREBASE_TOKEN" instead. 2, for me, I just went to run emulator locally without internet (my poor internet), so I run command: firebase emulators:start --token "$FIREBASE_TOKEN" hope you guys get lucky, too.

Thank you for this!

Also turns out that the token flag just needs to be present with something in it so
firebase emulators:start --token 'null' works just as fine.

@BuligaRobert
Copy link

For me a logout from Firebase CLI and then a login solved the issue.

  1. Logout
    firebase logout

  2. Login
    firebase login

@KingTochi
Copy link

Hey guys, what worked for me was simply updating my firebase tools cli

  1. Close the terminal

  2. Open it up again and run npm i -g firebase-tools

It should start working after that else reboot your wifi or source of internet connection, reconnect and try again. happy coding. !giveup

@parisa7103
Copy link

I am using firebase version 11.0.1, and the problem still exists. when I try to run firebase init I faced this error Failed to make request to https://firebase-public.firebaseio.com/cli.json.
I tried to log out and log in again, but the error is shown at the end of each response.

@dhruvsakariya
Copy link

same error

  • functions: Using node@16 from host.
    ! Your requested "node" version "14" doesn't match your global version "16". Using node@16 from host.

@johnnyoshika
Copy link

@tremayne-stewart What does --token 'null' do when passed to firebase emulators:start?

I'm still getting the Error: Failed to make request to https://firebase-public.firebaseio.com/cli.json error when I'm not connected to the internet and I try to start the emulator with firebase emulators:start --token 'null'.

@mohammad-goldast
Copy link

Same issue [email protected] and node v16.18.1.

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

Successfully merging a pull request may close this issue.