Running Reports.JS in AWS Lambda

Stimulsoft Reports.JS discussion
Post Reply
purple84
Posts: 1
Joined: Mon Mar 13, 2023 2:26 pm

Running Reports.JS in AWS Lambda

Post by purple84 »

Hey everyone,

Im having some trouble rendering reports using Reports.JS in AWS Lambda. I had previously written lambdas that used Reports.JS without a problem, however now the report does not render all of the pages of my report(Based off the report.renderedPages.count) and appears to output nothing.

I looked a my previous code and found that I was using "render()" to generate the reports instead of "renderAsync()". I now know that that function was made obsolete and will generate an error when I use it. However when I look at the report.renderedPages.count that comes from "render()" it is the full report all pages. Im a bit rusty on my node and I would really appreciate if someone could point me in the right direction. Below is the current code I have generating the report.

Code: Select all

async function generate() {

    var reportPath = path.join(__dirname, 'assets/survey.mrt');
    var report = new Stimulsoft.Report.StiReport();
    report.loadFile(reportPath);

    // Export to PDF
    let renderReport = await report.renderAsync();
    let document = report.exportDocumentAsync((pdfData) => {
        console.log("Report rendered. Pages count: ", report.renderedPages.count);
        console.log("Rendered report saved into PDF-file.");
        var buffer = Buffer.from(pdfData);
        sendemail(buffer)
    }, Stimulsoft.Report.StiExportFormat.Pdf);

}
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Running Reports.JS in AWS Lambda

Post by Lech Kulikowski »

Hello,

Unfortunately, we couldn't provide any information. We do not work with AWS Lambda. Sorry.

Thank you.
Post Reply