firebase-tools: Firebase CLI deploy doesn't work behind a proxy (regression)

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)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (3 by maintainers)

Most upvoted comments

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.

npm i -g firebase-tool@8.15.0

Sorry for the inconvenience, and happy holidays! ❄️

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)

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

  1. Logout firebase logout

  2. Login firebase login

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

Same issue firebase-tools@11.0.0 and node v16.18.1.

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

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.

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

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?