<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Error: jsreport already initialized or just initializing. Make sure init is called only once]]></title><description><![CDATA[<p>Hi,</p>
<p>So I use jsreport to create a pdf from a template. So we prep the data and require in the html template then do the following:</p>
<pre><code> jsreport.init().then(() =&gt; {
  
  return jsreport.render({
    template: {
      content: htmlTemplate,
      engine: 'handlebars',
      recipe: 'chrome-pdf',
      chrome: {
        format: 'A4',
        printBackground: true,
        marginTop: '1in',
        marginRight: '0.5in',
        marginBottom: '0.25in',
        marginLeft: '0.5in'
      }
    },
      data: modifiedReport

    }).then(resp =&gt; {
      return MailService.mailer(resp.content, 'ServiceReport.pdf', reportId, type);
    });

  }).catch(err =&gt; {
    console.error(err);
  });
</code></pre>
<p>this is how I import it:</p>
<pre><code>const jsreport = require('jsreport-core')();
</code></pre>
<p>these are the packages I have:</p>
<pre><code>    &quot;jsreport-chrome-pdf&quot;: &quot;^1.3.0&quot;,
    &quot;jsreport-core&quot;: &quot;^2.4.3&quot;,
    &quot;jsreport-handlebars&quot;: &quot;^2.0.1&quot;,
    &quot;puppeteer&quot;: &quot;^1.13.0&quot;,
</code></pre>
<p>I read you did not need to get jsreport to use those modules by calling use()</p>
<p>In development all is good. On the aws ec2 debian linux server it errors with</p>
<pre><code>Error: jsreport already initialized or just initializing. Make sure init is called only once
at Reporter.init (/home/ben/node/node_modules/jsreport-core/lib/reporter.js:99:29)
at createJSReportPdf (/home/paul/node/pdfReport/composeServiceReports.js:49:12)
at Object.sendReportEmail (/home/paul/node/pdfReport/composeServiceReports.js:16:10)
at process._tickCallback (internal/process/next_tick.js:68:7)
</code></pre>
<p>This seems to happen after jsreport has been called once.</p>
<p>Any ideas of how to tackle this?</p>
<p>Much appreciated, thanks</p>
<p>Paul</p>
]]></description><link>https://forum.jsreport.net/topic/968/error-jsreport-already-initialized-or-just-initializing-make-sure-init-is-called-only-once</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 22:14:08 GMT</lastBuildDate><atom:link href="https://forum.jsreport.net/topic/968.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 22 Mar 2019 22:37:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Error: jsreport already initialized or just initializing. Make sure init is called only once on Invalid Date]]></title><description><![CDATA[<p>Hi,</p>
<p>So I use jsreport to create a pdf from a template. So we prep the data and require in the html template then do the following:</p>
<pre><code> jsreport.init().then(() =&gt; {
  
  return jsreport.render({
    template: {
      content: htmlTemplate,
      engine: 'handlebars',
      recipe: 'chrome-pdf',
      chrome: {
        format: 'A4',
        printBackground: true,
        marginTop: '1in',
        marginRight: '0.5in',
        marginBottom: '0.25in',
        marginLeft: '0.5in'
      }
    },
      data: modifiedReport

    }).then(resp =&gt; {
      return MailService.mailer(resp.content, 'ServiceReport.pdf', reportId, type);
    });

  }).catch(err =&gt; {
    console.error(err);
  });
</code></pre>
<p>this is how I import it:</p>
<pre><code>const jsreport = require('jsreport-core')();
</code></pre>
<p>these are the packages I have:</p>
<pre><code>    &quot;jsreport-chrome-pdf&quot;: &quot;^1.3.0&quot;,
    &quot;jsreport-core&quot;: &quot;^2.4.3&quot;,
    &quot;jsreport-handlebars&quot;: &quot;^2.0.1&quot;,
    &quot;puppeteer&quot;: &quot;^1.13.0&quot;,
</code></pre>
<p>I read you did not need to get jsreport to use those modules by calling use()</p>
<p>In development all is good. On the aws ec2 debian linux server it errors with</p>
<pre><code>Error: jsreport already initialized or just initializing. Make sure init is called only once
at Reporter.init (/home/ben/node/node_modules/jsreport-core/lib/reporter.js:99:29)
at createJSReportPdf (/home/paul/node/pdfReport/composeServiceReports.js:49:12)
at Object.sendReportEmail (/home/paul/node/pdfReport/composeServiceReports.js:16:10)
at process._tickCallback (internal/process/next_tick.js:68:7)
</code></pre>
<p>This seems to happen after jsreport has been called once.</p>
<p>Any ideas of how to tackle this?</p>
<p>Much appreciated, thanks</p>
<p>Paul</p>
]]></description><link>https://forum.jsreport.net/post/4649</link><guid isPermaLink="true">https://forum.jsreport.net/post/4649</guid><dc:creator><![CDATA[godhar]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Error: jsreport already initialized or just initializing. Make sure init is called only once on Invalid Date]]></title><description><![CDATA[<p>Call <code>jsreport.init</code> just once at the beginning of your application.<br />
Store the jsreport instance.<br />
And later use just <code>jsreport.render</code>.</p>
]]></description><link>https://forum.jsreport.net/post/4666</link><guid isPermaLink="true">https://forum.jsreport.net/post/4666</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Error: jsreport already initialized or just initializing. Make sure init is called only once on Mon, 25 Mar 2019 15:50:25 GMT]]></title><description><![CDATA[<p>Hi! Thanks for getting back to me. Like this:</p>
<pre><code> const jsreport = require('jsreport-core')();
 let jsReportInitialized = false;
</code></pre>
<p>..........</p>
<pre><code> function checkIfJsReportIsInit() {

   if( !jsReportInitialized ) {
       jsReportInitialized = true;
       return jsreport.init();
   }
   return Promise.resolve();
}
</code></pre>
<p>............</p>
<pre><code>return checkIfJsReportIsInit().then(() =&gt; {

  jsreport.render({
   template: {
   content: htmlTemplate,
   engine: 'handlebars',
   recipe: 'chrome-pdf',
  chrome: {
    format: 'A4',
    printBackground: true,
    marginTop: '1in',
    marginRight: '0.5in',
    marginBottom: '0.25in',
    marginLeft: '0.5in'
  }
},
  data: modifiedReport
}).then(resp =&gt; {
 return MailService.mailer(resp.content, 'ServiceReport.pdf', reportId, type);
  });
   }).catch(err =&gt; {
    console.error(err);
 });</code></pre>
]]></description><link>https://forum.jsreport.net/post/4674</link><guid isPermaLink="true">https://forum.jsreport.net/post/4674</guid><dc:creator><![CDATA[godhar]]></dc:creator><pubDate>Mon, 25 Mar 2019 15:50:25 GMT</pubDate></item><item><title><![CDATA[Reply to Error: jsreport already initialized or just initializing. Make sure init is called only once on Invalid Date]]></title><description><![CDATA[<p>you are probably just missing one return at</p>
<pre><code class="language-js">  return jsreport.render({
</code></pre>
<p>the rest looks good</p>
]]></description><link>https://forum.jsreport.net/post/4682</link><guid isPermaLink="true">https://forum.jsreport.net/post/4682</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Error: jsreport already initialized or just initializing. Make sure init is called only once on Invalid Date]]></title><description><![CDATA[<p>Thanks <a class="plugin-mentions-a" href="https://forum.jsreport.net/uid/2">@jan_blaha</a> , really appreciate it.</p>
]]></description><link>https://forum.jsreport.net/post/4683</link><guid isPermaLink="true">https://forum.jsreport.net/post/4683</guid><dc:creator><![CDATA[godhar]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>