JS Report suddenly stopped finding templates.. please help!
-
went to do a build and suddenly helpers can't be found .. no code change in a month. This code has been working great. Has something changed?
or can you please offer what might be wrong?
Here is how I am loading JSReport:
const jsreport = require('jsreport-core')({
tasks: {
allowedModules: '*'
},
loadConfig: false,
dataDirectory: path.join(os.tmpdir(), 'jsreport'),
templatingEngines: { allowedModules: ["handlebars", "handlebars-helpers", "handlebars-intl"] },
connectionString: { 'name': 'fs', syncModifications: true }
});
jsreport.use(require('jsreport-handlebars')());
jsreport.use(require('jsreport-phantom-pdf')());
jsreport.use(require('jsreport-fs-store')());and here is my template:
let template = {
content: "<h1>Hello {{foo}} number using "abs" helper from handlebars-helpers: {{abs -100}} </h1>",
engine: 'handlebars',
helpers: `
const handlebars = require('handlebars');const helpers = require('handlebars-helpers')({ handlebars: handlebars }); `, recipe: 'phantom-pdf' }; let data = { "foo": "world" };
in fact this code is sample code I use for a sanity check that came form this forum..
my package.json.I took out the ^ thinking it might be pulling the latest but same issue..
"dependencies": {
"config": "^1.21.0",
"debug": "^3.0.1",
"handlebars-helpers": "0.10.0",
"handlebars-intl": "1.1.2",
"jsonwebtoken": "^8.2.1",
"jsreport": "2.2.0",
"jsreport-handlebars": "2.0.0",
"jsreport-phantom-pdf": "2.1.3",
"mongoose": "^4.13.17",
"npm": "^6.4.1",
"upgrade": "^1.1.0",
"uuid": "^3.1.0"
},
-
Oh.. the error I am getting is "log": [
"report error:",
"{"message":"Error while executing templating engine. Missing helper: \"abs\"","name":"Error","weak":true,"logged":true}"
],
"id": {none of the helpers are being found.. I get the same error for all . compare, abs..etc..
-
problem resolution and full description here