Browsershot::html not working with Remote Chrome #486
Replies: 3 comments
-
|
We just ran into the same issue. So instead we just proxied the rendered views through a route on the same service so we can just provide a URL. |
Beta Was this translation helpful? Give feedback.
-
|
On #491 I've shared a little bit of my experience with browsershot remote instance and docker. Looks like you are trying to access chrome remotely with a hostname, that only works with an IP. |
Beta Was this translation helpful? Give feedback.
-
|
Hi! This is a common issue when combining 🔹 The problem
This is why your current approach with 🔹 The correct approachInstead of relying on a temporary file, you should send the HTML content directly to Chrome using Puppeteer’s use Spatie\Browsershot\Browsershot;
Browsershot::remoteChrome('http://remote-chrome:3000')
->setHtml('<h1>test</h1>') // pass HTML directly
->noSandbox()
->save('test.pdf'); // or test.png |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When I try to combine
Browsershot::htmlwithBrowsershot::setRemoteInstanceI run into the following error.Example:
I think the problem is that puppeteer's page.goto('file://<file_path>') not work because the file is not available on the remote Chrome. Would it be better to read the temporary html file and use puppeteer's
page.setContent-method?Beta Was this translation helpful? Give feedback.
All reactions