You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Docker container app in which I am trying to utilize nodriver in a python script.
However, for some reason it will never start properly.
When I try to spawn a browser (using the no_sandbox=True parameter inside my start function) I get the following error:
`(venv) root@cdee75c0f2bd:/var/www/python# python scraper/nodriver_scraper.py "https://example.com" "body"
Error:
---------------------
Failed to connect to browser
---------------------
One of the causes could be when you are running as root.
In that case you need to pass no_sandbox=True
Traceback: Traceback (most recent call last):
File "/var/www/python/scraper/nodriver_scraper.py", line 12, in scrape
driver = await uc.start(sandbox=False, headless=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/www/python/venv/lib/python3.11/site-packages/nodriver/core/util.py", line 95, in start
return await Browser.create(config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/www/python/venv/lib/python3.11/site-packages/nodriver/core/browser.py", line 90, in create
await instance.start()
File "/var/www/python/venv/lib/python3.11/site-packages/nodriver/core/browser.py", line 351, in start
raise Exception(
Exception:
---------------------
Failed to connect to browser
---------------------
One of the causes could be when you are running as root.
In that case you need to pass no_sandbox=True
{"status": "error", "error": "\n ---------------------\n Failed to connect to browser\n ---------------------\n One of the causes could be when you are running as root.\n In that case you need to pass no_sandbox=True \n ", "traceback": "Traceback (most recent call last):\n File "/var/www/python/scraper/nodriver_scraper.py", line 12, in scrape\n driver = await uc.start(sandbox=False, headless=False)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/var/www/python/venv/lib/python3.11/site-packages/nodriver/core/util.py", line 95, in start\n return await Browser.create(config)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/var/www/python/venv/lib/python3.11/site-packages/nodriver/core/browser.py", line 90, in create\n await instance.start()\n File "/var/www/python/venv/lib/python3.11/site-packages/nodriver/core/browser.py", line 351, in start\n raise Exception(\nException: \n ---------------------\n Failed to connect to browser\n ---------------------\n One of the causes could be when you are running as root.\n In that case you need to pass no_sandbox=True \n \n"}`
I am already running with no_sandbox=True but this does not help.
If anyone knows a fix, please let me know!
The text was updated successfully, but these errors were encountered:
I got everything working with Symfony Panther which also uses the same binary so the installation of Chromium inside my container is not the issue here. I am using the PHP-FPM base image.
Hello guys,
I have a Docker container app in which I am trying to utilize nodriver in a python script.
However, for some reason it will never start properly.
When I try to spawn a browser (using the no_sandbox=True parameter inside my start function) I get the following error:
`(venv) root@cdee75c0f2bd:/var/www/python# python scraper/nodriver_scraper.py "https://example.com" "body"
Error:
---------------------
Failed to connect to browser
---------------------
One of the causes could be when you are running as root.
In that case you need to pass no_sandbox=True
Traceback: Traceback (most recent call last):
File "/var/www/python/scraper/nodriver_scraper.py", line 12, in scrape
driver = await uc.start(sandbox=False, headless=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/www/python/venv/lib/python3.11/site-packages/nodriver/core/util.py", line 95, in start
return await Browser.create(config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/www/python/venv/lib/python3.11/site-packages/nodriver/core/browser.py", line 90, in create
await instance.start()
File "/var/www/python/venv/lib/python3.11/site-packages/nodriver/core/browser.py", line 351, in start
raise Exception(
Exception:
---------------------
Failed to connect to browser
---------------------
One of the causes could be when you are running as root.
In that case you need to pass no_sandbox=True
{"status": "error", "error": "\n ---------------------\n Failed to connect to browser\n ---------------------\n One of the causes could be when you are running as root.\n In that case you need to pass no_sandbox=True \n ", "traceback": "Traceback (most recent call last):\n File "/var/www/python/scraper/nodriver_scraper.py", line 12, in scrape\n driver = await uc.start(sandbox=False, headless=False)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/var/www/python/venv/lib/python3.11/site-packages/nodriver/core/util.py", line 95, in start\n return await Browser.create(config)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/var/www/python/venv/lib/python3.11/site-packages/nodriver/core/browser.py", line 90, in create\n await instance.start()\n File "/var/www/python/venv/lib/python3.11/site-packages/nodriver/core/browser.py", line 351, in start\n raise Exception(\nException: \n ---------------------\n Failed to connect to browser\n ---------------------\n One of the causes could be when you are running as root.\n In that case you need to pass no_sandbox=True \n \n"}`
I am already running with no_sandbox=True but this does not help.
If anyone knows a fix, please let me know!
The text was updated successfully, but these errors were encountered: