jsreport install procedure on Debian 11



  • Dear jsreport community,

    We previously run two jsreport instances on CentOS, but since the CentOS project was shut down, we decided to switch back to Debian (11).

    Starting from the ubuntu installation guide, we've successfully setup jsreport using the following steps:

    # Check node version
    node --version
    v16.13.2
    
    cd /opt/
    mkdir jsreportapp
    cd jsreportapp
    npm i -g @jsreport/jsreport-cli
    jsreport init
    jsreport configure
    
    # I installed chrome as follow, but I'm unsure if its necessary (it's mentioned on jsreport centOS guide but not on jsreport ubuntu guide):
    # https://www.itzgeek.com/how-tos/linux/debian/how-to-install-google-chrome-on-debian-11.html
    
    # chrome dependencies
    sudo apt update && sudo apt install -y gconf-service libgbm-dev libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils 
    # libappindicator1 has been deprecated - removing it from the list and 
    apt install libayatana-appindicator1
    
    # you may wont to install additional fonts
    sudo apt install -y fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst
    
    # test start jsreport to see it running on port 5488
    jsreport start &
    

    From the startup log all seems good:

    skipping lines...
    2022-01-18T08:17:06.546Z - info: Creating default express app.
    2022-01-18T08:17:06.559Z - info: jsreport server successfully started on http port: 5488
    2022-01-18T08:17:06.560Z - info: Verifying license key free
    2022-01-18T08:17:06.561Z - info: Using free license
    2022-01-18T08:17:06.563Z - info: Initializing worker threads
    2022-01-18T08:17:06.701Z - info: 2 worker threads initialized in 138ms
    2022-01-18T08:17:06.702Z - info: Starting temp files cleanup with 600000ms threshold
    2022-01-18T08:17:06.702Z - info: reporter initialized
    

    On browser I can access jsreport web interface successfully. But when we run a report jsreport Studio display the following error:

    preview error
    Report cancelled
    Error: Report cancelled
        at Object.close (/opt/jsreportapp/node_modules/@jsreport/advanced-workers/lib/threadWorker.js:138:21)
        at Object.release (/opt/jsreportapp/node_modules/@jsreport/advanced-workers/lib/pool.js:38:22)
        at EventEmitter.<anonymous> (/opt/jsreportapp/node_modules/@jsreport/jsreport-core/lib/main/reporter.js:344:16)
        at Object.onceWrapper (node:events:509:28)
        at EventEmitter.emit (node:events:390:28)
        at Socket.<anonymous> (/opt/jsreportapp/node_modules/@jsreport/jsreport-express/lib/routes.js:68:20)
        at Object.onceWrapper (node:events:510:26)
        at Socket.emit (node:events:402:35)
        at TCP.<anonymous> (node:net:687:12)
    

    And from our side (java application) we get the following error: "Socket Timeout".

    Anyone has some Idea on what could be the issue, or how to debug/troubleshoot it? The error message is not very explanatory at my eyes.



  • You get also the same error when running a template with an HTML recipe right?

    It looks like some kind of networking problem.
    This error is thrown when the connection from the client is closed.
    https://github.com/jsreport/jsreport/blob/master/packages/jsreport-express/lib/routes.js#L67

    It seems to me that we should use different nodejs event. Are you able to change the linked line and verify if it solves the problem? Thank you

    req.once('close', () => {
        abortEmitter.emit('abort')
    })
    


  • We have just tested with HTML recipe and the report is running successfully.

    I've edited the mentioned line in the file:
    jsreportapp/node_modules/@jsreport/jsreport-express/lib/routes.js

    and fixed some issue on our sides (javascript dependencies), now the js report log(logs/reporter.log) is very clean:

    
    2022-01-18T15:46:13.736Z - info: Starting rendering request 6 (user: null) rootId=vkm9lug7fzxusnp, id=vkm9lug7fzxusnp
    2022-01-18T15:46:13.736Z - info: Rendering anonymous template { recipe: chrome-pdf, engine: handlebars } rootId=vkm9lug7fzxusnp, id=vkm9lug7fzxusnp
    2022-01-18T15:46:31.144Z - info: Rendering request 6 finished in 17409 ms rootId=vkm9lug7fzxusnp, id=vkm9lug7fzxusnp
    

    But we still receive the "Socket Timeout" exception on the client side.

    jsreport studio seems to not detecting any issue either:

    
    info
    +0
    Starting rendering request 6 (user: null)
    info
    +0
    Rendering anonymous template { recipe: chrome-pdf, engine: handlebars }
    debug
    +0
    Inline data specified.
    debug
    +1
    Base url not specified, skipping its injection.
    debug
    +1
    Rendering engine handlebars
    debug
    +5
    Executing recipe chrome-pdf
    debug
    +1
    Converting with chrome HeadlessChrome/93.0.4577.0 using chrome-pool strategy
    debug
    +22
    Page request: GET (document) file:///tmp/jsreport/autocleanup/bdd6f31f-80ca-41cc-b6f4-1dec1903dbf8-chrome-pdf.html
    debug
    +4
    Page request finished: GET (document) file:///tmp/jsreport/autocleanup/bdd6f31f-80ca-41cc-b6f4-1dec1903dbf8-chrome-pdf.html
    debug
    +2
    Page request: GET (stylesheet) http://192.168.155.15/jsreport-resources/style/footable.css
    debug
    +1
    Page request: GET (stylesheet) http://192.168.155.15/jsreport-resources/style/style.css
    debug
    +0
    Page request: GET (stylesheet) http://192.168.155.15/jsreport-resources/style/tpcolors.css
    debug
    +0
    Page request: GET (script) http://192.168.155.15/jsreport-resources/js/jquery.min.js
    debug
    +0
    Page request: GET (script) https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.6.0/chart.min.js
    debug
    +1
    Page request finished: GET (stylesheet) 200 http://192.168.155.15/jsreport-resources/style/footable.css
    debug
    +1
    Page request finished: GET (stylesheet) 200 http://192.168.155.15/jsreport-resources/style/style.css
    debug
    +0
    Page request finished: GET (stylesheet) 200 http://192.168.155.15/jsreport-resources/style/tpcolors.css
    debug
    +1
    Page request finished: GET (script) 200 http://192.168.155.15/jsreport-resources/js/jquery.min.js
    debug
    +0
    Page request: GET (script) https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js
    debug
    +5
    Page request finished: GET (script) 200 https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.6.0/chart.min.js
    debug
    +0
    Page request: GET (script) http://192.168.155.15/jsreport-resources/js/utils.js
    debug
    +4
    Page request: GET (image) http://192.168.155.15/jsreport-resources/images/TraPartnersSIMLogo.jpg
    debug
    +0
    Page request finished: GET (script) 200 https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js
    debug
    +21
    Invalid scale configuration for scale: yAxes
    debug
    +0
    Invalid scale configuration for scale: xAxes
    debug
    +16332
    Invalid scale configuration for scale: yAxes
    debug
    +0
    Invalid scale configuration for scale: xAxes
    debug
    +8
    Invalid scale configuration for scale: yAxes
    debug
    +0
    Invalid scale configuration for scale: xAxes
    debug
    +9
    Invalid scale configuration for scale: yAxes
    debug
    +0
    Invalid scale configuration for scale: xAxes
    debug
    +22
    Page request finished: GET (script) 200 http://192.168.155.15/jsreport-resources/js/utils.js
    debug
    +23
    Page request finished: GET (image) 200 http://192.168.155.15/jsreport-resources/images/TraPartnersSIMLogo.jpg
    debug
    +11
    Chrome will wait for printing trigger
    debug
    +490
    Running chrome with params {"landscape":true,"format":"A4","waitForJS":true,"timeout":600000,"margin":{},"printBackground":true}
    debug
    +444
    Skipping storing report.
    info
    +0
    Rendering request 6 finished in 17409 ms
    

Log in to reply
 

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