Heroku Only Dev Environment has Chrome version 81 issue

Viewed 884

I am using heroku with selenium with heroku/google-chrome and heroku/chromedriver buildpacks. There was a recent update to google chrome and the google-chrome buildpack was updated.

EDIT: I am seeing on my dev instance that

/app/.apt/opt/google/chrome/chrome --version
Google Chrome 80.0.3987.163 unknown

but on my prod instance which works

Google Chrome 81.0.4044.92 unknown

So the question is how to I force the version here on heroku?

Old information below that is probably less relevant now.

However, I am now seeing chrome version errors despite this, but ONLY on my dev instance. When I build directly with my production instance, it works fine. However, my typical process is to build and test with my dev instance and then promote that exact build to the production instance, which now would be promoting a broken build.

Here is the error:

2020-04-09T22:20:56.505318+00:00 app[celery_worker.1]: [2020-04-09 22:20:56,504: ERROR/ForkPoolWorker-1] Task ... raised unexpected: SessionNotCreatedException('session not created: This version of ChromeDriver only supports Chrome version 81', None, None)
...
2020-04-09T22:20:56.505336+00:00 app[celery_worker.1]: 'CHROMEDRIVER_PATH', ''), chrome_options=chrome_options)
2020-04-09T22:20:56.505336+00:00 app[celery_worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/seleniumwire/webdriver/browser.py", line 88, in __init__
2020-04-09T22:20:56.505337+00:00 app[celery_worker.1]: super().__init__(*args, **kwargs)
2020-04-09T22:20:56.505337+00:00 app[celery_worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
2020-04-09T22:20:56.505338+00:00 app[celery_worker.1]: desired_capabilities=desired_capabilities)
2020-04-09T22:20:56.505338+00:00 app[celery_worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
2020-04-09T22:20:56.505339+00:00 app[celery_worker.1]: self.start_session(capabilities, browser_profile)
2020-04-09T22:20:56.505339+00:00 app[celery_worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
2020-04-09T22:20:56.505339+00:00 app[celery_worker.1]: response = self.execute(Command.NEW_SESSION, parameters)
2020-04-09T22:20:56.505340+00:00 app[celery_worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
2020-04-09T22:20:56.505340+00:00 app[celery_worker.1]: self.error_handler.check_response(response)
2020-04-09T22:20:56.505341+00:00 app[celery_worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
2020-04-09T22:20:56.505342+00:00 app[celery_worker.1]: raise exception_class(message, screen, stacktrace)
2020-04-09T22:20:56.505342+00:00 app[celery_worker.1]: selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81

As far as I can tell, my dev instance is essentially exactly the same as my production instance but obviously this is not the case. The buildpacks and requirements.txt are exactly the same and the build logs are nearly identical I did see this difference in the build logs, the dev version has:

-----> Installing libasound2_1.1.3-5ubuntu0.2_amd64.deb
-----> Installing libasound2_1.1.3-5ubuntu0.4_amd64.deb
-----> Installing libasound2-data_1.1.3-5ubuntu0.2_all.deb
-----> Installing libasound2-data_1.1.3-5ubuntu0.4_all.deb

but the production version only has

-----> Installing libasound2_1.1.3-5ubuntu0.4_amd64.deb
-----> Installing libasound2-data_1.1.3-5ubuntu0.4_all.deb

This seems like a red herring though.

Here is a likely relevant issue from the heroku/google-chrome buildpack: https://github.com/heroku/heroku-buildpack-google-chrome/pull/85

Anybody else seeing this and know how to get the dev build to work or how to get selenium working on heroku again?

1 Answers

I figured out the fix, you need to reset your cache

$ heroku plugins:install heroku-repo

$ heroku repo:purge_cache -a appname

and then redeploy with an empty commit or deploy from master.

The reason it was only failing on dev was because I never built on my production stack and as a result it didn't have a cache of the old chrome version.

https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache

Related