fix: wait for idle network before taking screenshots

This commit is contained in:
Sunny 2025-07-07 21:00:26 +02:00
parent ba9def7d4b
commit b5fbc08ce5
No known key found for this signature in database
GPG key ID: 6C809239719866E4

View file

@ -30,6 +30,7 @@ class ImageGenerationService
try {
BrowsershotLambda::html($markup)
->windowSize(800, 480)
->waitUntilNetworkIdle()
->save($pngPath);
} catch (Exception $e) {
Log::error('Failed to generate PNG: '.$e->getMessage());
@ -40,6 +41,7 @@ class ImageGenerationService
Browsershot::html($markup)
->setOption('args', config('app.puppeteer_docker') ? ['--no-sandbox', '--disable-setuid-sandbox', '--disable-gpu'] : [])
->windowSize(800, 480)
->waitUntilNetworkIdle()
->save($pngPath);
} catch (Exception $e) {
Log::error('Failed to generate PNG: '.$e->getMessage());