Cannot set property 'contentType' of undefined on html-to-xlsx recipe
-
Trying to move enable html-to-xlsx recipe and running into an error:
reporting:reporting.js:90 JSReport render error TypeError: Cannot set property 'contentType' of undefined at module.exports (/opt/atlassian/pipelines/agent/build/node_modules/jsreport-html-to-xlsx/lib/responseXlsx.js:35:29) at Object.execute (/opt/atlassian/pipelines/agent/build/node_modules/jsreport-html-to-xlsx/lib/htmlToXlsx.js:71:14) at <anonymous> reporting:index.js:44 report error: TypeError: Cannot set property 'contentType' of undefined at module.exports (/opt/atlassian/pipelines/agent/build/node_modules/jsreport-html-to-xlsx/lib/responseXlsx.js:35:29) at Object.execute (/opt/atlassian/pipelines/agent/build/node_modules/jsreport-html-to-xlsx/lib/htmlToXlsx.js:71:14) at <anonymous>
It is happening from this code (see screen cap).. line 35.
I have no idea why meta would be null.. nor even where it gets populated.
I am doing the sample code from earlier, and just changed to html-to-xlsx and added a table to the content.. simple as that.I did add the "jsreport-html-to-xlsx": "2.1.2", to the package..
my package.json
"dependencies": { "config": "^1.21.0", "debug": "^3.0.1", "handlebars": "4.0.6", "handlebars-helpers": "0.10.0", "handlebars-intl": "1.1.2", "jsonwebtoken": "8.2.1", "jsreport": "1.10.0", "jsreport-html-to-xlsx": "2.1.2", "mongoose": "^4.13.17", "npm": "^6.4.1", "upgrade": "1.1.0", "uuid": "^3.1.0" },
and my content
let template = { content: `<table> <tr> <td style="height: 50px; font-size: 35px">Hello world</td> <td>world</td> </tr> <tr> <td style="width: 20px; text-align:right">right</td> <td>world</td> </tr> <tr> <td>world</td> <td>world</td> </tr> </table>`, engine: 'handlebars', helpers: ` const handlebars = require('handlebars'); const helpers = require('handlebars-helpers')({ handlebars: handlebars }); `, phantom: { orientation: "portrait", format: "A4", }, recipe: 'html-to-xlsx' }; let data = { "foo": "world" };
I did try to specify a 'phantom' config.. but same error..
any ideas? @bjrmatos ?
-
hi! the version of html-to-xlsx that you are trying to use only works in jsreport v2, your app is using jsreport v1 (
1.10.0
) so you are getting an error caused by an inconsistency. just remove thejsreport-html-to-xlsx
depedency of your project, that recipe is already installed as part of default v1,v2 installation
-
ok.. will try. I did try to go to V2 of js report. but it got that same error 'missing abs helper'. I was going to debug that later.. but jsreport 1 is working fine..
thank you...let me try!
-
Thank you .. that worked great! ..
now the question is am I brave enough to move to V2!!?!??! :)