I want to generate pdf using puppeteer in laravel 8. It is generating pdf, if i set timeout, but shows error instead to redirecting to generated pdf. And if i don't set timeout, then pdf does not generate and showing the error. Below is my code -
$content = view('/index')->render();
Browsershot::html($content)
->setNodeBinary('/usr/bin/node')
->setNpmBinary('/usr/bin/npm')
->setNodeModulePath(base_path('node_modules/'))
->format('A3')
->savePdf('sample.pdf');
return Redirect::to('sample.pdf');
When i run the code, this error is showing -
Error Output:\n================\nTimeoutError: Navigation timeout of 30000 ms exceeded\n at LifecycleWatcher._LifecycleWatcher_createTimeoutPromise
Please help me out where i am wrong.