using Laravel-Sail, which is basically a convenient way to generate a docker-compose.yml
to have a Webserver, MariaDB etc. locally, is causing trouble when it comes to the use of Browsershots, a Laravel-Package that provides Puppeteer.
Before I start
First of all: Puppeteer itself is working, as I extended the docker file and rebuilt the image.
What is the problem?
This part of my pdf-generation method is running forever and fails with timeout.
$view = view('pdf.user', compact('user'));
$body_html = $view->render();
return response()->streamDownload(function () use (
$body_html
) {
echo Browsershot::html($body_html)->format('A4')
->margins(0, 0, 0, 0)->showBackground()
->addChromiumArguments([
'font-render-hinting' => 'none',
])->noSandbox()->waitUntilNetworkIdle()->pdf();
});
As it turns out, this line within the blade-template is causing the issue:
<img src="{{asset('images/logo.png')}}" class="h-24 w-24">
Using tinker in the container, I found out that the assets()
helper returns
asset('images/logo.png')
> http://myapp.test/images/logo.png
which is fine.
If I use a random image coming from another URL (not-dockerized), e.g. https://www.google.de/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png
the view is being loaded and rendered fine.
So my question is: What could possibly be the problem here and how can I solve it?