Hello,
I am trying to duplicate this sample for ToC in .net 7 with the latest libraries.
https://playground.jsreport.net/w/admin/tV6sVKbV
var scriptList = new List<Script>();
scriptList.Add(new Script()
{
Content = @"const jsreport = require('jsreport-proxy') .... --- all content of script from sample ----"
});
HttpContext.JsReportFeature()
.Recipe(Recipe.ChromePdf)
.Engine(Engine.Handlebars)
.Configure((r) =>
{
r.Template.Scripts = scriptList;
r.Template.Helpers = @"
const jsreport = require('jsreport-proxy')
const headings = []
------ all content for the helpers -------- --> copied from sample."
});
return View("Toc") // Template from playground
The error message I get is from node:
JsReportBinaryException: Error rendering report: rendering has finished with errors:An error ocurred while trying to execute "render" command (3)(because) a critical error occurred while trying to execute the render command (2)(because) error when evaluating custom script anonymousTemplate must contains _id, name, shortid or content attribute (1)-- error (1) ---> stackError: Error when evaluating custom script anonymousTemplate must contains _id, name, shortid or content attribute at Client.render (C:\snapshot\jsreport\packages\nodejs-client\lib\client.js:92:17) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async startRender (C:\snapshot\jsreport\packages\jsreport-cli\lib\commands\render.js:321:24) at async C:\snapshot\jsreport\packages\jsreport-cli\lib\commands\render.js:228:22 at async executeCommand (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\executeCommand.js:22:20) at async Object.handler (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\registerCommand.js:76:9) at async parseCLI (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\startCommand.js:156:3) at async startCLI (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\startCommand.js:121:20) at async startCommand (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\startCommand.js:67:5) at async startProcessing (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\startProcessing.js:195:3)Remote stack: Error: Template must contains _id, name, shortid or content attribute at C:\snapshot\jsreport\packages\jsreport-core\lib\shared\createError.js:10:13 at WorkerReporter.createError (C:\snapshot\jsreport\packages\jsreport-core\lib\shared\reporter.js:49:12) at AsyncFunction.<anonymous> (C:\snapshot\jsreport\packages\jsreport-core\lib\worker\templates.js:14:24) at ListenerCollection.fire (C:\snapshot\jsreport\packages\jsreport-core\lib\shared\listenerCollection.js:157:32) at async beforeRender (C:\snapshot\jsreport\packages\jsreport-core\lib\worker\render\render.js:25:5) at async WorkerReporter._render (C:\snapshot\jsreport\packages\jsreport-core\lib\worker\render\render.js:146:7) at async Object.proxy.render (C:\snapshot\jsreport\packages\jsreport-core\lib\worker\defaultProxyExtend.js:6:17)wrapped by:-- error (2) ---> stackError: at onCriticalError (C:\snapshot\jsreport\packages\jsreport-cli\lib\commands\render.js:304:19) at C:\snapshot\jsreport\packages\jsreport-cli\lib\commands\render.js:258:14 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async executeCommand (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\executeCommand.js:22:20) at async Object.handler (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\registerCommand.js:76:9) at async parseCLI (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\startCommand.js:156:3) at async startCLI (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\startCommand.js:121:20) at async startCommand (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\startCommand.js:67:5) at async startProcessing (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\startProcessing.js:195:3)wrapped by:-- error (3) ---> stackError: at startCLI (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\startCommand.js:127:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async startCommand (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\startCommand.js:67:5) at async startProcessing (C:\snapshot\jsreport\packages\jsreport-cli\lib\commander\startProcessing.js:195:3)
Without the script section being set, I get the ToC as expected, but of course Page Numbers are missing (NA is written instead). Anybody has experienced the same? No help if I explicitly set the short id of the Script.
Maybe it's a bug in the Wrapper and the Script Object is not parsed correctly before being passed to the Node.js server?