CircleCI-Public / browser-tools-orb

Quickly and easily install common browsers and browser testing tools on CircleCI
https://circleci.com/developer/orbs/orb/circleci/browser-tools
MIT License
23 stars 34 forks source link

ChromeDriver install returning 404 and failing to install any backup #102

Open prpetten opened 8 months ago

prpetten commented 8 months ago

Orb version

1.4.6

What happened

Went to update our Chrome version to just be set to the latest version by default. Updated our config to read:

      - browser-tools/install-chrome
      - browser-tools/install-chromedriver

That resulted in this error when the "Install Chromedriver" step was hit:

Chrome version major is 121
Installed version of Google Chrome is 121.0.6167.139 
404
Matching Chrome Driver Version 404'd, falling back to first matching major version.
/bin/bash: line 159: jq: command not found
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   863  100   863    0     0  61642      0 --:--:-- --:--:-- --:--:-- 61642
(23) Failed writing body
New ChromeDriver version to be installed: 
 will be installed
curl: (22) The requested URL returned error: 404 
mv: cannot stat 'chromedriver-linux64': No such file or directory
mv: cannot stat 'chromedriver/chromedriver': No such file or directory
chmod: cannot access '/usr/local/bin/chromedriver': No such file or directory
/bin/bash: line 202: chromedriver: command not found
Something went wrong; ChromeDriver could not be installed

Exited with code exit status 1

Also tried manually setting the Chromedriver version (121.0.6167.85), but got the same result. When I reverted to the old version of Chrome we were previously using (114.0.5735.90), everything worked fine.

Expected behavior

Ideally chromedriver would have been installed.

prpetten commented 8 months ago

Note: If I manually hit the URL below, for the version when I specified it (121.0.6167.85). It returns 200 for me. It appears that is what your script should resolve to

https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/121.0.6167.85/linux64/chromedriver-linux64.zip

However, I do not see the version installed by default (121.0.6167.139) on the list of available versions on the Chrome for Testing site https://googlechromelabs.github.io/chrome-for-testing/

And indeed, when I attempt to visit

https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/121.0.6167.139/linux64/chromedriver-linux64.zip

I get a 404 error. Not sure how you're somehow ahead of the latest stable version? Perhaps Google Chrome reverted to an earlier version.

Not sure why when I manually set the version number I get the same error, as that one returns fine.

prpetten commented 8 months ago

Just for fun, I tried manually specifying the last stable v120 version 120.0.6099.109.

      - browser-tools/install-chrome:
          chrome-version: 120.0.6099.109
          replace-existing: true
      - browser-tools/install-chromedriver

It installed Chrome fine, but did not install chromedriver.

Chrome version major is 120
Installed version of Google Chrome is 120.0.6099.109 
404
Matching Chrome Driver Version 404'd, falling back to first matching major version.
/bin/bash: line 159: jq: command not found
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   863  100   863    0     0  57533      0 --:--:-- --:--:-- --:--:-- 57533
(23) Failed writing body
New ChromeDriver version to be installed: 
 will be installed
curl: (22) The requested URL returned error: 404 
mv: cannot stat 'chromedriver-linux64': No such file or directory
mv: cannot stat 'chromedriver/chromedriver': No such file or directory
chmod: cannot access '/usr/local/bin/chromedriver': No such file or directory
/bin/bash: line 202: chromedriver: command not found
Something went wrong; ChromeDriver could not be installed

Exited with code exit status 1

which again is weird, because when I visit:

https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/120.0.6099.109/linux64/chromedriver-linux64.zip

I get a 200. Not sure what would be causing the discrepancy....

arthurthefourth commented 8 months ago

I think this is an issue with the Chrome stable desktop release channel being different from the Chrome for Testing stable release channel.

The Chrome Releases blog shows 121.0.6167.139 released to stable on Jan. 30, but the Chrome for Testing dashboard shows the latest stable version still at 121.0.6167.85 as of February 1st.

As far as I can tell, the install-chrome script seems to be ignoring Chrome for Testing altogether and just downloading regular desktop versions.

prpetten commented 8 months ago

@arthurthefourth That totally makes sense for using the latest.

Still not sure why specifying previous versions with supported chromedrivers is breaking though.

arthurthefourth commented 8 months ago

I wonder what’s up with that jq: command not found you’re seeing. I saw it mentioned in another issue as well.

prpetten commented 8 months ago

I missed that initially. My guess would be that since jq is not installed by default, without a separate installation step, you probably get this result.

If it's a prereq for the orb, probably should add that to the documentation.

Alternatively, it might make sense to see if the script can perform the actions without the overhead of adding an additional binary to the environment.

prpetten commented 8 months ago

So looking into the PR history, it looks like jq was recently added to help out with the fallback condition of getting a 404 in the first place.

I'm guessing the assumption was you'd have installed jq on your machine for other purposes. Probably need to add to the documentation

So, if you run it after installing jq, it works...

orbs:
  jq: circleci/jq@3.0.0
  browser-tools: circleci/browser-tools@1.4.6
  #....
    steps:
        - jq/install:
          version: jq-1.7
      - browser-tools/install-chrome
      - browser-tools/install-chromedriver
tujlaky commented 7 months ago

With 1.4.6 I have started to get 404 too when I don't specify a version.

Chrome version major is 121
Installed version of Google Chrome is 121.0.6167.184 
404
Matching Chrome Driver Version 404'd, falling back to first matching major version.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   864  100   864    0     0   7956      0 --:--:-- --:--:-- --:--:--  8000
New ChromeDriver version to be installed: 121.0.6167.184
121.0.6167.184 will be installed
curl: (22) The requested URL returned error: 404

Exited with code exit status 22

Looks like the fallback is happening but using the same version as before so it is 404 again.

egorkel-altexsoft commented 7 months ago

I think the problem is here As stated here, URL should be defferent

egorkel-altexsoft commented 7 months ago

As a workaround, I can suggest

    steps:
#      Until https://github.com/CircleCI-Public/browser-tools-orb/issues/102 is resolved
#      - browser-tools/install-chrome
#      - browser-tools/install-chromedriver
      - browser-tools/install-browser-tools:
          chrome-version: 114.0.5735.90
tujlaky commented 7 months ago

Looks like now it is working:

Chrome version major is 121
Installed version of Google Chrome is 121.0.6167.184 
404
Matching Chrome Driver Version 404'd, falling back to first matching major version.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   863  100   863    0     0   8240      0 --:--:-- --:--:-- --:--:--  8298
New ChromeDriver version to be installed: 121.0.6167.85
121.0.6167.85 will be installed
^@^@ChromeDriver 121.0.6167.85 (3f98d690ad7e59242ef110144c757b2ac4eef1a2-refs/branch-heads/6167@{#1539}) has been installed to /usr/local/bin/chromedriver
egorkel-altexsoft commented 7 months ago

I think the problem is here As stated here, URL should be defferent

Never mind, this URL is for 114 and older versions

arthurthefourth commented 7 months ago

Ah right, I thought you'd linked to install-chrome.sh, not install-chromedriver.sh. I think there are a few separate issues which are getting conflated here:

  1. As I mentioned above, install-chrome.sh seems to be pulling its Chrome versions from the official Chrome stable releases, rather than the Chrome for Testing releases:

https://github.com/CircleCI-Public/browser-tools-orb/blob/62fdb2b5213e68d3219b30446210a8b372994ca7/src/scripts/install-chrome.sh#L90

But install-chromedriver.sh is looking for matching versions in Chrome for Testing:

https://github.com/CircleCI-Public/browser-tools-orb/blob/62fdb2b5213e68d3219b30446210a8b372994ca7/src/scripts/install-chromedriver.sh#L156

So when an official release like 121.0.6167.184 comes out before there's a matching Chromedriver version, it 404s looking for the Chromedriver version.

  1. The 404 fallback seems to be breaking if jq isn't installed.

  2. The issue that @tujlaky reported where the fallback was temporarily falling back to the same version.

@tujlaky are there any issues once you've got the right fallback version?

tujlaky commented 7 months ago

No, after the fallback everything is working. I think in my case the json contained a version which was not available to download. This was not an issue with the orb. Thanks for the help

egorkel-altexsoft commented 7 months ago

Yeah, it looks like the problem was that the new version was not available at https://edgedl.me.gvt1.com Why don't they use the same URLs for the whole installation process?

prpetten commented 7 months ago

It's broken for me again.

Chrome version major is 121
Installed version of Google Chrome is 121.0.6167.85 
404
Matching Chrome Driver Version 404'd, falling back to first matching major version.
/bin/bash: line 159: jq: command not found
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   864  100   864    0     0  66461      0 --:--:-- --:--:-- --:--:-- 66461
(23) Failed writing body
New ChromeDriver version to be installed: 
 will be installed
curl: (22) The requested URL returned error: 404 
mv: cannot stat 'chromedriver-linux64': No such file or directory
mv: cannot stat 'chromedriver/chromedriver': No such file or directory
chmod: cannot access '/usr/local/bin/chromedriver': No such file or directory
/bin/bash: line 202: chromedriver: command not found
Something went wrong; ChromeDriver could not be installed

Exited with code exit status 1
tujlaky commented 7 months ago

For me too

tujlaky commented 7 months ago

I have created a PR because there is a small typo in the script which is preventing the usage of a fix version on the 121 versions.

Eg: the following version will still show a 404: 121.0.6167.85 but that should work with the following:

      - browser-tools/install-browser-tools:
          chrome-version: 121.0.6167.85

https://github.com/CircleCI-Public/browser-tools-orb/blob/main/src/scripts/install-chromedriver.sh#L156

@arthurthefourth because of this what your are mentioning in 2 will be always a 404 so it will always go for the fallback.

https://github.com/CircleCI-Public/browser-tools-orb/pull/107

tujlaky commented 7 months ago

Should not this script use the following URL for the download for the newest versions? https://storage.googleapis.com/chrome-for-testing-public/121.0.6167.184/linux64/chromedriver-linux64.zip

Which is working for me.

But the one what the script is using is not: https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/121.0.6167.184/linux64/chromedriver-linux64.zip

From this page: https://googlechromelabs.github.io/chrome-for-testing/#stable

matthewhively commented 7 months ago

During chromedriver installation step I got the following output:

Chrome version major is 121
Installed version of Google Chrome is 121.0.6167.184 
A different version of ChromeDriver is installed (ChromeDriver 121.0.6167.85 (3f98d690ad7e59242ef110144c757b2ac4eef1a2-refs/branch-heads/6167@{#1539})); removing it
404
Matching Chrome Driver Version 404'd, falling back to first matching major version.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   864  100   864    0     0  72000      0 --:--:-- --:--:-- --:--:-- 72000
New ChromeDriver version to be installed: 121.0.6167.184
121.0.6167.184 will be installed
/bin/bash: line 164: [[: 121.0.6167.184: syntax error: invalid arithmetic operator (error token is ".0.6167.184")
ChromeDriver 121.0.6167.184 (057a8ae7deb3374d0f1b04b36304d236f0136188-refs/branch-heads/6167@{#1818}) has been installed to /usr/local/bin/chromedriver

so, it installed as expected, but with a BASH error.

josephfrazier commented 7 months ago

I'm also experiencing the bash syntax error:

Chrome version major is 122
Installed version of Google Chrome is 122.0.6261.57 
404
Matching Chrome Driver Version 404'd, falling back to first matching major version.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   864  100   864    0     0  11464      0 --:--:-- --:--:-- --:--:-- 11520
New ChromeDriver version to be installed: 122.0.6261.57
122.0.6261.57 will be installed
/bin/bash: line 165: [[: 122.0.6261.57: syntax error: invalid arithmetic operator (error token is ".0.6261.57")
^@^@ChromeDriver 122.0.6261.57 (87957e464700ccf3468df47ce741e0dc089e0544-refs/branch-heads/6261@{#853}) has been installed to /usr/local/bin/chromedriver

I realize that the script says chromedriver has been installed, but when I try to use a headless chrome via testcafe, it says "No inspectable targets":

ERROR Unable to open the "chrome:headless" browser due to the following error:

Error: No inspectable targets
    at defaultTarget (/home/app/node_modules/chrome-remote-interface/lib/chrome.js:48:23)
    at Chrome._fetchDebuggerURL (/home/app/node_modules/chrome-remote-interface/lib/chrome.js:194:28)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Chrome._start (/home/app/node_modules/chrome-remote-interface/lib/chrome.js:141:25)

Type "testcafe -h" for help.

so I suspect that the chromedriver installation script may not have actually worked...

josephfrazier commented 7 months ago

EDIT: it was a testcafe problem: https://github.com/DevExpress/testcafe/issues/8145

I realize that the script says chromedriver has been installed, but when I try to use a headless chrome via testcafe, it says "No inspectable targets", so I suspect that the chromedriver installation script may not have actually worked...

Might have to walk this back a bit: I tried pinning chrome to 116:

          - run:
              name: apt-get update
              command: sudo apt-get update
          - browser-tools/install-chrome:
              replace-existing: true
              chrome-version: 116.0.5845.110

and while I still got the bash syntax error, the rest of the CI job worked, so maybe my problem is with testcafe, the browser automation I'm using.

Chrome version major is 116
Installed version of Google Chrome is 116.0.5845.110 
404
Matching Chrome Driver Version 404'd, falling back to first matching major version.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   864  100   864    0     0  13503      0 --:--:-- --:--:-- --:--:-- 13714
New ChromeDriver version to be installed: 116.0.5845.96
116.0.5845.96 will be installed
/bin/bash: line 165: [[: 116.0.5845.96: syntax error: invalid arithmetic operator (error token is ".0.5845.96")
^@^@ChromeDriver 116.0.5845.96 (1a391816688002153ef791ffe60d9e899a71a037-refs/branch-heads/5845@{#1382}) has been installed to /usr/local/bin/chromedriver

CircleCI received exit code 0
sedghi commented 7 months ago

Same issue on our end too, I reported it here https://github.com/cypress-io/circleci-orb/issues/459#issue-2147692338

neospeed83 commented 7 months ago

Honestly with how fast Google is releasing chrome versions and the potential delay between a new Google Chrome version being out and the corresponding ChromeDriver version is out, I feel like the best way to go about this is to check the latest stable ChromeDriver version, download corresponding chrome and then install the ChromeDriver for it.

arthurthefourth commented 6 months ago

@neospeed83 Do you think using the Chrome for Testing binaries for Chrome instead of the official releases isn't an option? That'd certainly be my preference, since those are already matched. But I don't know much about what scenarios this orb has to support. If that way isn't possible, I agree that your suggestion seems like the best way forward.

diegobayshanntech commented 6 months ago

Should we (the users of the orb) look for alternatives as there is no work-around and the PR is just sitting there ?

tujlaky commented 6 months ago

We started to use firefox in the meantime. That looks more stable.

cartwrightian commented 4 months ago

Seeing similar with 124

Chrome version major is 124 Installed version of Google Chrome is 124.0.6367.60 404 Matching Chrome Driver Version 404'd, falling back to first matching major version. % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1085 100 1085 0 0 21956 0 --:--:-- --:--:-- --:--:-- 22142 New ChromeDriver version to be installed: 124.0.6367.91 124.0.6367.91 will be installed curl: (22) The requested URL returned error: 404

Exited with code exit status 22

markzalar commented 4 months ago

We're seeing this again. We initially specified version 114.0.5735.90 per recommendations above. A couple weeks ago that version stopped working so we switched to 114.0.5735.198. Today that version disappeared.

Google Chrome is not currently installed; installing it Preparing Chrome installation for Debian-based systems https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_114.0.5735.198-1_amd64.deb: 2024-05-30 21:22:34 ERROR 404: Not Found. /bin/bash: line 130: google-chrome-stable: command not found Google Chrome v114.0.5735.198 (stable) failed to install.

Exited with code exit status 1

Does anyone have a good strategy for quickly identifying a new version that is available? Or a strategy for determining how much longer a given version is likely to be available?

rjherrera commented 3 months ago

we are seeing the same issue as @markzalar and @cartwrightian when specifying versions. In my case the 114.0.5735.X versions.

I tried looking at the chrome releases blog and at the refs in chromium repository for versions and tried several, all with the same results ➡️ the same 404 and failure to install.

I was wondering if there is any way we could specify a mirror url as a parameter for the orb as a temp fix, because I can't seem to find another way. Any help is hugely appreciated.

Edit: I forgot to add that I changed to firefox and all is working as expected, but I'd like to go back to chrome if possible.

deepakmahakale commented 2 months ago

This started to break again on 17th July 2024 for us

The following worked:

  orbs:
-   browser-tools: circleci/browser-tools@1.4.4
+   browser-tools: circleci/browser-tools@1.4.8

  commands:
    install-chrome:
      steps:
-       - run: sudo apt-get update # TODO: remove when chromedriver downloads are fixed
-       - browser-tools/install-chrome:
-          chrome-version: 116.0.5845.96 # TODO: remove when chromedriver downloads are fixed
+       - browser-tools/install-chrome
        - browser-tools/install-chromedriver