Get a read timeout when running a report from API

  • Hello,
    We are calling reports from client this way:

    var request = require("request");
    var option = {
        method: 'POST',
        uri: 'jsReportServer/api/report',
        body: { "template": { "name": myTemplate }, "data": myData},
        json: true,
        encoding: null,
        timeout: 3000
    request(option, function (error, res, reportContent) {

    This report myTemplate is complex and myData is large. Hence the report rendering takes more than 3min20s to complete. This time is too large for the "request" module for which the timeout option is only taken into account for the initial connection to jsReportServer wich is quick enough.
    For this report we get this error:

    Error: read ECONNRESET
    at _errnoException (util.js:1022:11)
    at TLSWrap.onread (net.js:615:25)
    [stack]: ←[32m'Error: read ECONNRESET\n at _errnoException (util.js:1022:11)\n at TLSWrap.onread (net.js:615:25)'←[31m,
    [message]: ←[32m'read ECONNRESET'←[31m,
    code: ←[32m'ECONNRESET'←[31m,
    errno: ←[32m'ECONNRESET'←[31m,
    syscall: ←[32m'read'←[31m }] ←[39m

    But I did not found a way to tell request a "read timeout" large enough to wait for large report rendering.
    I am sure that we are not the only ones that catch this issue. Is there a solution for this?

    Note: we did buy a support plan but don't know how to contact support staff directly.

  • I am not sure if this is really problem with request module timeout.

    1. I run locally jsreport server with report running 3 minutes and I can still finish request with timeout set to 4 minutes.
    2. The lower timeout in request I get different error - Error: ESOCKETTIMEDOUT
    3. This description of ECONNRESET can be found

    "ECONNRESET" means the other side of the TCP conversation abruptly closed its end of the connection. This is most probably due to one or more application protocol errors. You could look at the API server logs to see if it complains about something.

    Can you find an error in the jsreport server log? How does the infrastructure hosting jsreport looks like? Do you run it behind a web server like nginx? Don't you host it on azure? I think azure closes connections which are inactive for 2 minutes.

    You can use email for paid support questions. Just add name of the company subscribed to support.

Log in to reply

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