It works fine locally, but why does a Flask error appear when I upload it to Google Run?

29 Views Asked by At

this is error message:

First:

Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/flask/app.py", line 1463, in wsgi_app
response = self.full_dispatch_request()

Second:

GET500921B1.1 sChrome 123 ``https://flask-selenium-app-qs6rhz6vcq-du.a.run.app/

I created a dynamic website scraper using Selenium and Flask. It works fine locally, but when I configure it with Docker and upload it to Google Run, the error above appears.

The current requirements.txt is as follows: There is no need for anything else since it is simply a simple scraping of one page.

flask==3.0.2
beautifulsoup4==4.12.3
selenium==4.19.0
gunicorn==21.2.0

When configuring the container, Python was version 3.12.

I changed it to work by setting the port to 8080. I also ran wsgi.py as shown below.

if __name__ == "__main__":
    app.run(port=8080)

The same goes for Docker.

CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:8080", "wsgi:app"]     app.run(port=8080)
1

There are 1 best solutions below

0
efeakaroz13 On

server Linux distros are not capable of running selenium because they don't have a user interface to run chrome. You can try to set it up on a windows VDS or with a remote driver.

And I can't be exactly sure about the error since you didn't provide all the logs.