jeroenheijmans/sample-angular-oauth2-oidc-with-auth-guards

Fix broken GitHub Actions because of Chromedriver (v84) versus Chrome (v85) issues

jeroenheijmans opened this issue · 4 comments

For example this Action run failed:

[00:20:01] I/launcher - Running 1 instances of WebDriver
[00:20:01] I/direct - Using ChromeDriver directly...
[00:20:07] E/launcher - session not created: This version of ChromeDriver only supports Chrome version 85
  (Driver info: chromedriver=85.0.4183.87 (cd6713ebf92fa1cacc0f1a598df280093af0c5d7-refs/branch-heads/4183@{#1689}),platform=Linux 5.3.0-1034-azure x86_64)
[00:20:07] E/launcher - SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 85
  (Driver info: chromedriver=85.0.4183.87 (cd6713ebf92fa1cacc0f1a598df280093af0c5d7-refs/branch-heads/4183@{#1689}),platform=Linux 5.3.0-1034-azure x86_64)
    at Object.checkLegacyResponse (/home/runner/work/sample-angular-oauth2-oidc-with-auth-guards/sample-angular-oauth2-oidc-with-auth-guards/node_modules/selenium-webdriver/lib/error.js:546:15)
    at parseHttpResponse (/home/runner/work/sample-angular-oauth2-oidc-with-auth-guards/sample-angular-oauth2-oidc-with-auth-guards/node_modules/selenium-webdriver/lib/http.js:509:13)
    at /home/runner/work/sample-angular-oauth2-oidc-with-auth-guards/sample-angular-oauth2-oidc-with-auth-guards/node_modules/selenium-webdriver/lib/http.js:441:30
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Seems to me that Chrome in the image from GitHub is still at version 84, while the webdriver-manager included with Angular tries to get the latest version (85)? Not sure why it would do that though, since it seems the purpose of said package would be to install the right one?

Anyways, the CI setup should be robust against this situation.

I don't exactly understand why this is happening or how to fix it, so asked for some help on Stack Overflow, maybe that'll turn up with a solution...

Turns out the issue wasn't properly fixed. For example this recent build would say this during the Update Chrome ci step:

sudo apt-get update && sudo apt-get install google-chrome-stable
# ...
Get:31 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 c-n-f Metadata [540 B]
Fetched 6430 kB in 5s (1197 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
google-chrome-stable is already the newest version (95.0.4638.69-1).
0 upgraded, 0 newly installed, 0 to remove and 41 not upgraded.

Then later, during the E2E Tests step it fails with:

# ...
[18:55:39] I/update - chromedriver: unzipping chromedriver_96.0.4664.45.zip
# ...
[18:55:57] E/launcher - session not created: This version of ChromeDriver only supports Chrome version 96
Current browser version is 95.0.4638.69 with binary path /usr/bin/google-chrome
  (Driver info: chromedriver=96.0.4664.45 (76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947}),platform=Linux 5.11.0-1020-azure x86_64)
[18:55:57] E/launcher - SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 96
 # ....

So somehow the updating of Chrome failed to go to latest (currently v96) version of Chrome.

My PC does have Chrome 96 already. But... according to the Chrome release schedule it was only released roughly around today. So maybe the apt packages from Ubuntu don't contain the newest version yet? I wonder how many days can go by before those get updated.

Perhaps a better fix on our end is needed that doesn't update chromedriver if it shouldn't?

I'm super stumped, tried changing the order of commands around a bit, but nothing helped. Can it be that somehow the apt package cache being used is not updated with the latest Chrome yet? I don't really know how to check if http://azure.archive.ubuntu.com/ubuntu has a specific version of Chrome or not.

Tried a commit to run with the flag --webdriverUpdate=false to force it to use the global Chromedriver that should be available in the GitHub image, but it leads to the GitHub Action saying:

[14:14:32] I/launcher - Running 1 instances of WebDriver
npm ERR! sample-angular-oauth2-oidc-with-auth-guards@1.0.0 e2e: `ng e2e "--configuration=ci" "--webdriverUpdate=false"`
[14:14:32] I/direct - Using ChromeDriver directly...
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sample-angular-oauth2-oidc-with-auth-guards@1.0.0 e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2021-11-17T14_14_32_671Z-debug.log
[14:14:32] E/direct - Error code: 135
[14:14:32] E/direct - Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
[14:14:32] E/direct - Error: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.

In short, it didn't work.