bazelisk: could not resolve the version 'latest' to an actual version number

I download the latest version bazelist for my Mac, but it show bazelist could get bazel from GCS bucket. Here is the error messgae , how should i resolve this?

could not resolve the version 'latest' to an actual version number: unable to determine latest version: could not list Bazel versions in GCS bucket: could not list GCS objects at https://www.googleapis.com/storage/v1/b/bazel/o?delimiter=/: could not fetch https://www.googleapis.com/storage/v1/b/bazel/o?delimiter=/: Get "https://www.googleapis.com/storage/v1/b/bazel/o?delimiter=/": net/http: TLS handshake timeout

when I connect a gloable proxy, bazelist show following error message: could not resolve the version 'latest' to an actual version number: unable to determine latest version: could not list Bazel versions in GCS bucket: could not list GCS objects at https://www.googleapis.com/storage/v1/b/bazel/o?delimiter=/: could not fetch https://www.googleapis.com/storage/v1/b/bazel/o?delimiter=/: Get "https://www.googleapis.com/storage/v1/b/bazel/o?delimiter=/": read tcp 192.168.43.5:57885->172.217.24.10:443: read: connection reset by peer

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I was having the same issues where setting the base url environment world didn’t seem to work. It turned out the issue was indeed that googleapis.com was blocked from my company’s network.

I set the BAZELISK_BASE_URL but that didn’t work for whatever reason, so I ended up just explicitly setting the Bazel version in the .bazeliskrc rather than always getting the latest.

echo "USE_BAZEL_VERSION=4.1.0" > .bazeliskrc

The point is that the issue was that googleapis (which checks for latest version) is blocked, but the registry to download bazel was not. So just setting the version number worked for me.

Workaround:

  1. In your terminal: navigate to your workspace root (= directory with the WORKSPACE file)
  2. Run echo "BAZELISK_BASE_URL=https://github.com/bazelbuild/bazel/releases/download" > .bazeliskrc
# .zshrc
export USE_BAZEL_VERSION=5.4.0
export BAZELISK_BASE_URL=https://github.com/bazelbuild/bazel/releases/download

I use @keanedawg 's method ,and I finally succeed!!! Like this d1abd0394be865019dd4ec73ab85988

I was having the same issues where setting the base url environment world didn’t seem to work. It turned out the issue was indeed that googleapis.com was blocked from my company’s network.

I set the BAZELISK_BASE_URL but that didn’t work for whatever reason, so I ended up just explicitly setting the Bazel version in the .bazeliskrc rather than always getting the latest.

echo "USE_BAZEL_VERSION=4.1.0" > .bazeliskrc

The point is that the issue was that googleapis (which checks for latest version) is blocked, but the registry to download bazel was not. So just setting the version number worked for me.

it works, thx

I also use @keanedawg 's method ,and I finally succeed!!!

  1. For each of your Bazel projects: find the directory that contains the WORKSPACE file
  2. Create a file called .bazeliskrc in this directory, and write the following content: BAZELISK_BASE_URL=https://github.com/bazelbuild/bazel/releases/download

BTW, I have already do this, but not works. running in docker.

hi, @fweikert, I am working on ubuntu and facing the same error now, how could I solve this? thank you

Hi,

it sounds like your network is not allowing access to https://www.googleapis.com/ (with or without proxy).

Unfortunately with the current Bazelisk version it is not possible to fallback to GitHub when GCS is not available. Apparently we implemented the reverse direction (https://github.com/bazelbuild/bazelisk/commit/46d319d70558aa39a3a178a95ff18fec47dc5083) but haven’t considered that GCS might not be reachable.

I will have to think about how we could solve this in a simple way. Sorry that I can’t offer you a quick workaround 😕

Pinging @fweikert just in case he has an idea.