core icon indicating copy to clipboard operation
core copied to clipboard

Remote Chrome for puppeteer instance for JavaScript rendering

Open Waffleophagus opened this issue 1 year ago • 0 comments

Description You use Browsershot to reach out to a puppeteer instance and then a headless instance of Chrome. Browsershot has the ability to use a remote instance of headless Chrome, for instance something like Browserless. https://spatie.be/docs/browsershot/v4/miscellaneous-options/connection-to-a-remote-chrome-instance

To my understanding, at the moment, Roach does not enable this functionality. It would be useful to allow for better management of servers, not running chrome on the server that is storing the data.

Proposed solution I already wrote a solution, this is more or less asking if you’d like a PR. It’s a one file change as it stands, ExecuteJavascriptMiddleware.php that checks for the existence of some environment variables, and if they exist, set up to use the remote instance of Chrome with Browsershot. I’d be down to tweak it if there is some other method you’d prefer, but it is working via an override, I’d love to make it official.

Considered alternatives Given I have a one file change that works for me currently I haven’t really thought of alternatives.

Additional context Having Chrome be on a different server than the server hosting my site gives good separation of concerns, on top of allowing the scraping to occur on a different IP address than the server hosting my site.

Waffleophagus avatar Nov 24 '24 16:11 Waffleophagus