<?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[Issue with Azure functions]]></title><description><![CDATA[<p>Hi,</p>
<p>Sorry, I know I am asking a lot of questions, but I am working on big reports and it's all new to me: jsReport, Azure Functions, handlebars....I am unfamiliar with all these.</p>
<p>So this my studio, invoice is just a test template:<br />
<img src="https://dl3.pushbulletusercontent.com/lsbUhQlW41Upun1D5PyVzuBsyceahqKU/image.png" alt="alt text" class="img-responsive img-markdown" /></p>
<p>ALL reports are working fine in the studio.</p>
<p>and this is the main function that i am calling jsReport:</p>
<pre><code>/**
 * @function fetchReport  It's the Promise function that sends a post request to jsReport server (using axios)
 * then it pipes the response to a streamObj, the promise is resolved after finishing writing the stream to the temp folder
 * @param {string} path the path to temp folder
 * @param {object} data  The object needed to generate report in jsReport server (a Functions App)
 * @param {string} functionName  The name of the Azure's function in  jsReport app, for now there's only one.
 * @param {string} reportName   it's the name of the report template configured in jsReport.
 */

const fetchReport = (path, data, functionName, reportName) =&gt; {
  return new Promise(async (resolve, reject) =&gt; {
    let jsr = process.env.JSREPORTURL + &quot;/api/&quot; + functionName;

    let options = {
      url: jsr, //valid string to report api
      headers: {
        &quot;Content-Type&quot;: &quot;application/json&quot;,
      },
      body: JSON.stringify(data),
      responseType: &quot;stream&quot;,
      maxContentLength: Infinity,
      maxBodyLength: Infinity,
    };

    let response = await axios.post(
      jsr,
      {
        template: { name: reportName },
        data: data,
      },
      options
    );
    if(response.data){   
    let writeStream = response.data
      .pipe(fs.createWriteStream(path))
      .on(&quot;finish&quot;, () =&gt; {
        resolve(writeStream);
      });
    }
    else {
      reject(null);
    }
  }).catch((e) =&gt; {
    console.log(&quot;ERROR&quot;);
    console.log(e);
  });
};
</code></pre>
<p>functionName is always &quot;report&quot;</p>
<p>and reportName is the name of my target template.</p>
<p>and process.env.JSREPORTURL is either localhost:5488 or the azure function url :<a href="https://xxxxxxxxx.azurewebsites.net" rel="nofollow">https://xxxxxxxxx.azurewebsites.net</a></p>
<p>When I am testing this from local to local, it's all working fine, if I pass &quot;executive&quot; as reportName, I get the executive report filled with data, if I pass &quot;single&quot;,  I get the right  report....and so on.</p>
<p>BUT when I try from my local to my deployed azure function, only the &quot;invoice&quot; report is working when I pass anything else the axios is returning 400</p>
<p>This is my azure deployed function:</p>
<p><img src="https://dl3.pushbulletusercontent.com/0q7qW9nRGeqUgkTFuulj9ogpyTdfNZVl/image.png" alt="alt text" class="img-responsive img-markdown" /></p>
<p>I noticed the the default template after the || operator,  so maybe that's why only the 'invoice' is returning a report?</p>
<p>Am I missing something, should I deploy a separate function for each template/report ? Please help.</p>
]]></description><link>https://forum.jsreport.net/topic/1782/issue-with-azure-functions</link><generator>RSS for Node</generator><lastBuildDate>Wed, 20 May 2026 01:39:22 GMT</lastBuildDate><atom:link href="https://forum.jsreport.net/topic/1782.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 Oct 2020 22:07:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Issue with Azure functions on Fri, 23 Oct 2020 06:42:21 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>Sorry, I know I am asking a lot of questions, but I am working on big reports and it's all new to me: jsReport, Azure Functions, handlebars....I am unfamiliar with all these.</p>
<p>So this my studio, invoice is just a test template:<br />
<img src="https://dl3.pushbulletusercontent.com/lsbUhQlW41Upun1D5PyVzuBsyceahqKU/image.png" alt="alt text" class="img-responsive img-markdown" /></p>
<p>ALL reports are working fine in the studio.</p>
<p>and this is the main function that i am calling jsReport:</p>
<pre><code>/**
 * @function fetchReport  It's the Promise function that sends a post request to jsReport server (using axios)
 * then it pipes the response to a streamObj, the promise is resolved after finishing writing the stream to the temp folder
 * @param {string} path the path to temp folder
 * @param {object} data  The object needed to generate report in jsReport server (a Functions App)
 * @param {string} functionName  The name of the Azure's function in  jsReport app, for now there's only one.
 * @param {string} reportName   it's the name of the report template configured in jsReport.
 */

const fetchReport = (path, data, functionName, reportName) =&gt; {
  return new Promise(async (resolve, reject) =&gt; {
    let jsr = process.env.JSREPORTURL + &quot;/api/&quot; + functionName;

    let options = {
      url: jsr, //valid string to report api
      headers: {
        &quot;Content-Type&quot;: &quot;application/json&quot;,
      },
      body: JSON.stringify(data),
      responseType: &quot;stream&quot;,
      maxContentLength: Infinity,
      maxBodyLength: Infinity,
    };

    let response = await axios.post(
      jsr,
      {
        template: { name: reportName },
        data: data,
      },
      options
    );
    if(response.data){   
    let writeStream = response.data
      .pipe(fs.createWriteStream(path))
      .on(&quot;finish&quot;, () =&gt; {
        resolve(writeStream);
      });
    }
    else {
      reject(null);
    }
  }).catch((e) =&gt; {
    console.log(&quot;ERROR&quot;);
    console.log(e);
  });
};
</code></pre>
<p>functionName is always &quot;report&quot;</p>
<p>and reportName is the name of my target template.</p>
<p>and process.env.JSREPORTURL is either localhost:5488 or the azure function url :<a href="https://xxxxxxxxx.azurewebsites.net" rel="nofollow">https://xxxxxxxxx.azurewebsites.net</a></p>
<p>When I am testing this from local to local, it's all working fine, if I pass &quot;executive&quot; as reportName, I get the executive report filled with data, if I pass &quot;single&quot;,  I get the right  report....and so on.</p>
<p>BUT when I try from my local to my deployed azure function, only the &quot;invoice&quot; report is working when I pass anything else the axios is returning 400</p>
<p>This is my azure deployed function:</p>
<p><img src="https://dl3.pushbulletusercontent.com/0q7qW9nRGeqUgkTFuulj9ogpyTdfNZVl/image.png" alt="alt text" class="img-responsive img-markdown" /></p>
<p>I noticed the the default template after the || operator,  so maybe that's why only the 'invoice' is returning a report?</p>
<p>Am I missing something, should I deploy a separate function for each template/report ? Please help.</p>
]]></description><link>https://forum.jsreport.net/post/7961</link><guid isPermaLink="true">https://forum.jsreport.net/post/7961</guid><dc:creator><![CDATA[Samerkassem]]></dc:creator><pubDate>Fri, 23 Oct 2020 06:42:21 GMT</pubDate></item><item><title><![CDATA[Reply to Issue with Azure functions on Invalid Date]]></title><description><![CDATA[<p>In case the function is properly deployed, you should be able to render this way all the templates you prepared and have them stored in the data folder.</p>
<p>jsreport returns 400 when the report rendering fails during the templating engine evaluation for example.<br />
The 400 error response body should contain some additional information. See how we handle errors in our <a href="https://github.com/jsreport/jsreport-azure-functions-starter-kit/blob/master/test.js" rel="nofollow">azure functions starter kit</a>.<br />
Also, jsreport writes by default to the stdout the logs, you should be able to reach this in the azure function and get more information there as well.</p>
]]></description><link>https://forum.jsreport.net/post/7971</link><guid isPermaLink="true">https://forum.jsreport.net/post/7971</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>