electron-pdf timeout



  • Hello,

    I'm attempting to run jsreport in a docker container as a dependency for a dockerized microservice. I'm getting a timeout when using electron-pdf as the recipe. I have tried bumping the timeout for electron up to as much as five minutes and it still times out.

    I saw a post from 6 months ago that suggested electron-pdf is unstable in certain situations. I was wondering if this might be the same and if there were any updates to this or the potential headless chrome as another option. Retry logic was alos suggested but I haven't been able to generate a pdf even trying multiple times.

    We've looked into other recipes, like phantom-pdf and wkhtmltopdf, but electron-pdf best fits our needs for certain features.

    Here are some details:

    Debug logging:

    Error occured - Error during rendering report: Timeout when executing in electron
    logs:
    +0      Starting rendering request 1
    +1      Rendering template {shortid:liz, recipe:electron-pdf, engine:jade, preview:true}
    +1      Data item not defined for this template.
    +7      Resources not defined for this template.
    +8      Base url not specified, skipping its injection.
    +9      Rendering engine jade
    +240    Compiled template not found in the cache, compiling
    +255    Replaced images []
    +257    Executing recipe electron-pdf
    Stak - Error: Timeout when executing in electron
        at Timeout._onTimeout (/usr/src/app/node_modules/electron-html-to/lib/dedicatedProcessStrategy.js:272:20)
        at ontimeout (timers.js:475:11)
        at tryOnTimeout (timers.js:310:5)
        at Timer.listOnTimeout (timers.js:270:5)  
    

    Because the base jsreport image didn't work out of the box for jade/electron I created a dockerfile in order to build a jsreport image:

    From jsreport/jsreport
    
    RUN npm install jsreport-jade@2.0.1
    RUN npm install jsreport-electron-pdf npm install electron
    

    I'm running this container via docker-compose, but it is reproducible via:

    docker run -p 5488:5488 -v <local templates folder>:/usr/src/app/data/templates <local image name>:latest
    

    The template content is in a folder in the local templates folder and the content.jade file contains:

    .page
        .page-header
        .page-content(style="text-align: center")
            b hello world
    

    And the template config.json:

    {
        "shortid": "12345",
        "recipe": "electron-pdf",
        "engine": "jade",
        "modificationDate": {
            "$$date": 1522176393572
        },
        "_id": "12345",
        "data": null,
        "electron": {
            "printDelay": "5000"
        },
        "scripts": []
    }
    

    Thanks for your time!



  • hi!

    I'm attempting to run jsreport in a docker container as a dependency for a dockerized microservice. I'm getting a timeout when using electron-pdf as the recipe. I have tried bumping the timeout for electron up to as much as five minutes and it still times out.

    Because the base jsreport image didn't work out of the box for jade/electron I created a dockerfile in order to build a jsreport image

    your demo template looks simpler so i'm not sure why it always ends in timeout for you, it looks like you are not applying all the steps needed to run electron under linux/docker so please use jsreport full image (1.10.0-full) instead of the normal one, jsreport full image contains all the steps needed to run electron.

    saw a post from 6 months ago that suggested electron-pdf is unstable in certain situations. I was wondering if this might be the same and if there were any updates to this or the potential headless chrome as another option. Retry logic was alos suggested but I haven't been able to generate a pdf even trying multiple times.

    FYI jsreport v2 will have chrome headless as default recipe which has much better support when running with docker. we are in the process of launching a beta right now, probably you could try it tomorrow.



  • Oh, I had not seen the full image. I will try that out to see if that makes a difference.



  • The full docker container is much better! The timeouts have stopped and while I know there might still be some instability there, it's probably enough for now. I'm also trying to do the volume mapping properly, but am getting an error. I think it makes more sense to start a new post about that after I've gathered up the error message and written it up a bit.

    I'd be interested in checking out the beta with the chrome headless recipe. Can you tell me how/where to get the beta version when it's ready to start looking at?


  • administrators

    the v2 beta should be ready today or tomorrow, stay tuned we will publish details about v2 beta in a blog post.


  • administrators


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.