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 an issue getting a headless Chrome browser to run in my Ruby on Rails app deployed via Docker. It times out on all requests when started from the web server, but it works perfectly when launched from the Rails console or in dev mode.
I want to fetch a remote URL and extract its content.
This is pretty standard code that used to work on another system.
To reproduce the timeout:
git clone https://github.com/randomsnowflake/puppeteertest.gitt
cd puppeteertest
docker compose build
docker compose up
# in a webbrowser: http://localhost:3000/test/test
# this request will timeout
# it will hang in the "Puppeteer.launch" call in the Puptest model
# setting CHROME_PATH does not seem to have an effect
To see it working:
Using dev mode
bin/dev # this starts the local rails dev srver
# in a webbrowser: http://localhost:3000/test/test
# this will output some random webpages HTML content
# note: it also works in local production mode
Using docker and rails console
# Note: will not work on M1 macs because of rosetta error, it does work in Linux
docker exec -it <CONTAINER_ID> bin/rails c
issue(prod)> x = Puptest.new.fetch_content("https://www.google.com")
# this will load the content of the remote page, as expected
So you see, the puppeteer code works, but only in dev/production mode and via the rails console in Docker. Inside the docker webserver it fails. In one Docker log I see several [1] ! reaped unknown child process pid=1805 status=pid 1805 exit 0 errors in the log, most likely from puma.
Thanks for pointing me in the right direction.
The text was updated successfully, but these errors were encountered:
I have an issue getting a headless Chrome browser to run in my Ruby on Rails app deployed via Docker. It times out on all requests when started from the web server, but it works perfectly when launched from the Rails console or in dev mode.
I want to fetch a remote URL and extract its content.
I have set up a demo repository, to reproduce the issue: https://github.com/randomsnowflake/puppeteertest
The relevant changes are:
This is pretty standard code that used to work on another system.
To reproduce the timeout:
To see it working:
Using dev mode
Using docker and rails console
So you see, the puppeteer code works, but only in dev/production mode and via the rails console in Docker. Inside the docker webserver it fails. In one Docker log I see several
[1] ! reaped unknown child process pid=1805 status=pid 1805 exit 0
errors in the log, most likely from puma.Thanks for pointing me in the right direction.
The text was updated successfully, but these errors were encountered: