question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Puppeteer option 'timeout' being ignored in rendering

See original GitHub issue

🐞 Bug report

We have a Scully configuration for one of our company’s project. As there have been some changes on the underlying API some pages are taking more time to get all the information so we began getting a: Puppeteer error while rendering "/some_url/final_url" TimeoutError: Navigation timeout of 30000 ms exceeded we will retry rendering this page up to 3 times.

We tried adding the timeout option in the puppeteerLaunchOptions section of our Scully config without any results.

🔬 Minimal Reproduction

Scully config file extract:

export const config: ScullyConfig = {
  puppeteerLaunchOptions: {
    // slowMo: 1750, // Relentiza la ejecucion de Puppeteer
    args: [
      '--disable-gpu',
      '--renderer',
      '--no-sandbox',
      '--no-service-autorun',
      '--no-experiments',
      '--no-default-browser-check',
      '--disable-dev-shm-usage',
      '--disable-setuid-sandbox',
      '--no-first-run',
      '--no-zygote',
      '--single-process',
      '--disable-extensions',
      '--user-agent=\'Scully Navigator\''
    ],
    executablePath: '/usr/local/bin/chromium',
    timeout: 120000
  },
  projectRoot: './apps/frontend/project/src',
// other configurations...
};

Execute: npx scully --prod --showGuessError --showBrowser=false --pluginsError=false --logSeverity=normal --project frontend-project

After a while many endpoints still launch the same error pointing to a Navigation timeout of 30000 ms exceeded even though the configuration states a timeout of 120000 ms. I think this might be a Puppeteer issue and not Scully’s fault, but anyway Scully lacks an option that allows increasing the navigation timeout.

Workaround

I edited directly the node_modules/@scullyio/scully/src/lib/renderPlugins/puppeteerRenderPlugin.js in order to increase the timeout when navigating the pages.


        // enter url in page
        await page.goto(path, , { waitUntil: 'domcontentloaded', timeout: 120000 });

Some sites suggest using { waitUntil: 'load', timeout: 0 } . See https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagegotourl-options for all available options.

💻Your Environment

Angular Version:



[12:19:39] → ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 11.2.10
Node: 14.15.5
OS: darwin x64

Angular: 11.2.11
... animations, common, compiler, compiler-cli, core, elements
... forms, language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: <error>

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.2
@angular-devkit/build-angular   0.1102.10
@angular-devkit/core            11.2.10
@angular-devkit/schematics      11.2.10
@angular/cdk                    11.2.10
@angular/cli                    11.2.10
@angular/flex-layout            10.0.0-beta.32
@angular/material               11.2.10
@schematics/angular             10.2.3
@schematics/update              0.1102.10
ng-packagr                      11.2.4
rxjs                            6.6.7
typescript                      4.0.3


Scully Version:



    "@scullyio/init": "1.0.1",
    "@scullyio/ng-lib": "1.0.0",
    "@scullyio/scully": "^1.1.1-BETA.94615"


We are using the @develop version of Scully as @SanderElias suggested on https://github.com/scullyio/scully/issues/1348#issuecomment-831397694

I hope you can help us with this. We have a CI pipeline for our deploys and I’ll have to make a special version with the workaround to make things work again (the cleanest option is to make a pull request and submit the fix, but … ¯_(ツ)_/¯

Thanks in advance for any help.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hunhavoccommented, Nov 10, 2021

Hi @jsanta ,

No need to say sorry, you just made me a favour 😃 Thank you for sharing, it definitely helps a lot!

Stay safe

1reaction
SanderEliascommented, May 31, 2021

@jsanta that is the reason the enterprise plugins are there, so you can override whatever you need. I designed Scully so, that almost everything is a plugin, that can be swapped out when needed. You even can replace existing plugins if you like.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js puppeteer - How to set navigation timeout?
The default in puppeteer timeout is 30 seconds. To use custom timeouts, you can use the setDefaultNavigationTimeout and setDefaultTimeout ...
Read more >
Puppeteer timeout | Make videos programmatically in React
Sometimes, you cannot avoid a render taking longer than 30 seconds. For example: Expensive WebGL scenes; Expensive preprocessing of data. You can increase...
Read more >
Puppeteer documentation - DevDocs
Puppeteer is a Node library which provides a high-level API to control Chromium or Chrome over the DevTools Protocol. The Puppeteer API is...
Read more >
iobroker.puppeteer - npm
The crop options will be ignored. cropLeft/Top/Height/Width. Configure the crop options in px to only screenshot the desired segment of the page ...
Read more >
Puppeteer Scraper - Apify Documentation
The selector may never be found and the function might never return true , so the page.waitFor() function also has a timeout. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found