Getting 'SyntaxError: Identifier 'err' has already been declared' in then block.



  • Hi,

    Just trying out jsreport for it's ease off use. I got it going in a test project, now in the real thing, I keep getting the above syntax error and I can't figure out why.

      Jsreport
        .render({
          template: {
            content: reportString,
            engine: "handlebars",
            recipe: "chrome-pdf"
          }
        })
        .then((resp) => {
    
          MailService.mailer(
            resp.content,
            "ServiceReport.pdf",
            report,
            type
          ).catch((err) => {
            console.error(err);
          });
          
        }).catch((error) => {
          console.error(error);
        });
    }
    

    The error happens on MailService.... line. This is a service I call to send the result of the jsreport process. It is an asynchronous call, hence the catch.

    I have tried putting a try catch and using the async/await style syntax as well to no effect. To be clear I have no global, or in scope var named 'err' in this file.

    Any ideas? Googling has brought forth nothing.

    Cheers!


  • administrators

    hi! unfourtanly the details are not enough, i don't have a good idea why you get such error, in any case this does not look like an error coming from jsreport, maybe you can try to rename the err variable to something else until you get ride of that SyntaxError error.


Log in to reply
 

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