Two new browsers per minute, but what if you keep the browser open indefinitely with a DO?
Two new browsers per minute, but what if you keep the browser open indefinitely with a DO?


KEEP_BROWSER_ALIVE_IN_SECONDS to something like 24h?
If users omit the browser.close() statement, it will stay open, ready to be connected to again and re-used but it will, by default, close automatically after 1 minute of inactivity. Users can optionally extend this idle time up to 10 minutes, by using the keep_alive option, set in milliseconds:


browser = await puppeteer.connect(env.MYBROWSER, sessionId); instead of pupeeteer.launch`
puppeteer.sessions(env.YourBrowserBinding) like in this example here https://developers.cloudflare.com/browser-rendering/get-started/reuse-sessions/

KEEP_BROWSER_ALIVE_IN_SECONDS