Puppeteer closes the browser after some minutes of inactivity?

Anonymous
TRIAL

10 months ago

does anyone know if railway has a kind of timeout if a server has no movement?
i.e. if there is no movement in an open browser with puppeteer or in the app in general… the server restarts at the next request or movement?

maybe railway pauses the container in general if there are no incoming requests?

1 Replies

drmarshall
PRO

10 months ago

Do you have App Sleeping turned on?


Anonymous
TRIAL

10 months ago

nope

1288635497941307400


10 months ago

nope, railway is not serverless, and wont stop your container unless you enable that.

any inactivity timeouts come from the apps running inside the container.

you would want to read browserless's docs.


Anonymous
TRIAL

10 months ago

I did a magic trick, because before, my puppeteer browser was waiting for instructions but when it was called for example after 3 hours it seemed that the browser was no longer active and got errors… that's the reason of my question (maybe the browser closes out after inactivity)

now I'm doing that with a settimeout something moves on the browser screen every 10min and after 4 hours everything is still working great… this is something weird lol


danbisdev
HOBBY

10 months ago

My advice is to switch to selenium. There is already a template in railway to host a selenium web driver and you can request a driver from it internally. Here's an example in python

from selenium import webdriver

options = webdriver.ChromeOptions() // Or similarly FirefoxOptions etc

... any options needed here like "--headless"

driver = webdriver.Remote('{internal-selenium-address}/wd/hub', options=options

This way every time you need to do an action with your "puppet" you can get the selenium web driver to pass you one by making a get request to it


Puppeteer closes the browser after some minutes of inactivity? - Railway Help Station