Giter Site home page Giter Site logo

Comments (5)

zenato avatar zenato commented on September 13, 2024

@jason-o-matic Thanks for your report.

The pixel matching error seems to be due to the animation not finished yet.
I think you should set more time to animationTimeout.

And I couldn't agree with your suggestion that wait until matching size.
Even if animation is not finished yet, I think anmationTimeout option shouldn't wait more.

from puppeteer-renderer.

jason-o-matic avatar jason-o-matic commented on September 13, 2024

Thanks for the prompt reply!

Here's a stack trace with more info, with an example that I think indicates more animationTimeout isn't the only problem.

$ time curl 'http://localhost:3000/?type=screenshot&fullPage=true&animationTimeout=9999999999&url=https://www.cnn.com/'
Oops, An expected error seems to have occurred.
real	0m23.766s
user	0m0.015s
sys	0m0.039s
$ docker logs foobar

> [email protected] start /app
> node src/index.js

Initialized renderer.
Listen port on 3000.
Error: Image sizes do not match.
    at pixelmatch (/app/node_modules/pixelmatch/index.js:21:15)
    at waitForAnimations (/app/src/wait-for-animations.js:18:20)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Renderer.screenshot (/app/src/renderer.js:115:9)
    at async /app/src/index.js:61:44

I set the animationTimeout to a very large number, but the exception still happened in under 24 seconds.

I completely agree that animationTimeout should be the maximum amount of time to wait.

Would it be possible to add a try/catch around pixelmatch(...) so the calling function continued to retry?

from puppeteer-renderer.

jason-o-matic avatar jason-o-matic commented on September 13, 2024

Would it be possible to add a try/catch around pixelmatch(...) so the calling function continued to retry?

Just to clarify, I mean continue to retry until reaching animationTimeout, but not more than that.

from puppeteer-renderer.

zenato avatar zenato commented on September 13, 2024

@jason-o-matic
I misunderstood about animationTimeout problem.
So I've fixed bug by comparing data sizes.
Thanks for the detailed error reporting.

from puppeteer-renderer.

jason-o-matic avatar jason-o-matic commented on September 13, 2024

I can confirm this solved the issue for me, thanks!

from puppeteer-renderer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.