502 Bad Gateway .NET long data XLSX

  • Hello everyone,

    I am trying to generate a XLSX file but I am getting the error of the title only when the data is too long (I do not know what's too long for jsreport). Let me explain. With some data I am able to generate it but with other I am not. Also it takes a while to generate it. The longest json might have around 15000 lines.

    jsreport.Client.JsReportException: 'Unable to render template.  <html>
    <head><title>502 Bad Gateway</title></head>
    <center><h1>502 Bad Gateway</h1></center>

    In the profile I also get this:

    Error: Report cancelled by the client or closed network
    var reportRequest = await rs.RenderAsync(new RenderRequest()
                    Template = new Template()
                        Recipe = Recipe.Xlsx,
                        Engine = Engine.Handlebars,
                        Name = "/Informe/soldata",
                    Options = new RenderOptions
                        Timeout = 1600000,
                        Debug = new DebugOptions
                            LogsToResponseHeader = false
                    Data = mainObject,

    Thank you in advance.

  • The 502 Bad Gateway error you get when trying to generate a report using the jsreport-xlsx plugin can have various causes. One of the most common causes is a memory problem or insufficient resources on the server. You can try increasing the amount of allocated memory for Node.js or increase the amount of resources on the server. It's also worth checking that the version of the jsreport-xlsx plugin is compatible with the version of jsreport you're using. You may need to update one of these components. Another reason that can cause a 502 Bad Gateway error when using jsreport-xlsx is that the amount of data you are trying to process is too large. In that case, it may help you to adjust plugin parameters such as xlsx.maxRows and xlsx.bufferSize to suit your needs. I hope that my information will help you solve the problem of 502 Bad Gateway error when using jsreport-xlsx.

  • @AbrahamYokoyama thank you for nice summary

    I am just adding that the jsreport 3.11.2 includes a fix for using options.timeout.

  • I have installed localy and I am making some new tests. How could I change the xlsx.maxRows and xlsx.bufferSize? I am getting an error if the json is too big. with 15000 rows now works but with 20000 no.

    preview error
    Got not ok response, status: 500
    Error: Got not ok response, status: 500
        at http://localhost:5488/studio/assets/client.a5efe5637ea659b2401f.js:41:78261
        at m (http://localhost:5488/studio/assets/client.a5efe5637ea659b2401f.js:311:73091)
        at Generator._invoke (http://localhost:5488/studio/assets/client.a5efe5637ea659b2401f.js:311:72844)
        at forEach.e.<computed> [as next] (http://localhost:5488/studio/assets/client.a5efe5637ea659b2401f.js:311:73271)
        at i (http://localhost:5488/studio/assets/client.a5efe5637ea659b2401f.js:3:368084)
        at http://localhost:5488/studio/assets/client.a5efe5637ea659b2401f.js:3:368181

    I changed already the timeout value.

      "httpPort": 5488,
      "store": {
        "provider": "fs"
      "blobStorage": {
        "provider": "fs"
      "logger": {
        "console": {
          "transport": "console",
          "level": "debug"
        "file": {
          "transport": "file",
          "level": "info",
          "filename": "logs/reporter.log"
        "error": {
          "transport": "file",
          "level": "error",
          "filename": "logs/error.log"
      "trustUserCode": false,
      "reportTimeout": 60000000,
      "workers": {
        "numberOfWorkers": 2
      "extensions": {
        "authentication": {
          "cookieSession": {},
          "admin": {
            "username": "admin",
            "password": "password"
          "enabled": false

Log in to reply

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