0

I have set a crawling command that works in local as well as in live using Laravel 11 and spatie browsershot. But when running directly from a url and cron in server following error occurs. I am using latest node version v23.9.0

vendor/spatie/browsershot/bin/browser.cjs:104 protocolTimeout: request.options.protocolTimeout ?? 30000,^ SyntaxError: Unexpected token '?'

Tried in locally which works but not in server from url and cron. My main code using package:

$browsershot = Browsershot::url($url)
                ->waitUntilNetworkIdle(true, 1000) // Increase to 1s for better stability
                ->userAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36')
                ->timeout($waitTime) // Increase timeout to 3 minutes
                ->setOption('args', [
                    '--no-sandbox',
                    '--disable-dev-shm-usage',
                    '--disable-setuid-sandbox',
                    '--ignore-certificate-errors',
                    '--disable-background-timer-throttling',
                    '--disable-backgrounding-occluded-windows'
                ])
                ->ignoreHttpsErrors()
                ->dismissDialogs();

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.