Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeoutError: Navigation Timeout Exceeded: 30000ms exceeded #69

Open
lietusme opened this issue Jan 14, 2020 · 5 comments
Open

TimeoutError: Navigation Timeout Exceeded: 30000ms exceeded #69

lietusme opened this issue Jan 14, 2020 · 5 comments

Comments

@lietusme
Copy link

lietusme commented Jan 14, 2020

I found out that busy build machines running conversion experience puppeteer error:
TimeoutError: Navigation Timeout Exceeded: 30000ms exceeded

It originates from this line:
await this[_page].goto(fileUrl(tempFile.path));

As this is this uses browser just for rendering, not networking, it seems appropriate fix would be to configure page timeouts (as only page objects allow that):

    if (!this[_browser]) {
      this[_browser] = await puppeteer.launch(this[_options].puppeteer);
      this[_page] = await this[_browser].newPage();
    }

->

    if (!this[_browser]) {
      this[_browser] = await puppeteer.launch(this[_options].puppeteer);
      this[_page] = await this[_browser].newPage();
      this[_page].setDefaultTimeout(0); // Disabled timeout
    }
@neocotic
Copy link
Owner

@lietusme Thanks for raising this issue. Is this solution not already achievable by simply using the puppeteer options (e.g. {timeout:0})?

I'm a bit reluctant to disable the timeout all together as I'm not sure that this would be desirable for all implementations. I can imagine most systems wouldn't want to wait more than that default maximum of 30 seconds.

@lietusme
Copy link
Author

lietusme commented Jan 14, 2020

I could not find a way to globally set timeout for puppeteer and only timeout settings seem to be available on page objects only.

I'm not sure how to pass/access puppeteer from converter using this as well:

const { createConverter } = require('convert-svg-to-png');
await this.converter.convertFile(sourcePath, options);

Any hints?

P.S. setting timeout to 1 ms is good way to test if it works, as it starts to fail randomly with same error.

@neocotic
Copy link
Owner

Ah sorry, I didn't see the distinction between browser instance startup timeout and page navigation timeout. You're right that this isn't currently supported via puppeteer options, however, I'm still a bit curious as to why it should ever timeout after 30 seconds. Are the SVGs you're rendering containing remotely hosted resources (e.g. images, fonts)?

If we were to disable the page navigation timeout, I think it would need to be done on a opt-in basis as I feel like this is implementation detail for puppeteer itself which I'd like to keep out as much as possible.

What I might consider is splitting the existing puppeteer options to be passed down as follows:

This should be able to offer greater control for those like yourself that need it and then you could simply do the following:

const { createConverter } = require('convert-svg-to-png');
await this.converter.convertFile(sourcePath, { puppeteerPageGoto: { timeout: 0 }});

@lietusme
Copy link
Author

lietusme commented Jan 14, 2020

Yes, such customization would work well for my case:
{ puppeteerPageGoto: { timeout: 0 }}

Any estimate when new NPM package version would go out with puppeteer options added?

Regarding SVG that times out - no external resources, 1.4KB size, so not sure what causes it. It is reproduced on remote build machines (MacOS) used by multiple teams so that may be just be result of their slowness or random lags.

@lietusme
Copy link
Author

For now I worked around this by catching exception and retrying few times before failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants