Error while executing templating engine. First argument must be a string



  • Hi,
    When i'm rendering report through API call, it throwing an error,

    in report studio it working properly.

    Note : report contain "pdfCreatePagesGroup" function.


    Error Log

    Error while executing templating engine. First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.. 31 | // otherwise just simple one value param is supported 32 | > 33 | const value = Buffer.from(JSON.stringify(groupId)).toString('base64') | ^ 34 | const result = group@@@${value}@@@ 35 | console.log('Pdf utils adding group hidden field ' + result) 36 | return result
    TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object. at Function.Buffer.from (buffer.js:183:11) at Object.apply (/app/node_modules/vm2/lib/contextify.js:288:34) at Object.pdfCreatePagesGroup (evaluate-template-engine-helpers.js:33:28) at eval (eval at createFunctionContext (/app/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), :39:100) at prog (/app/node_modules/handlebars/dist/cjs/handlebars/runtime.js:221:12) at execIteration (/app/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:51:19) at Object. (/app/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:61:13) at Object.eval [as main] (eval at createFunctionContext (/app/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), :5:34) at main (/app/node_modules/handlebars/dist/cjs/handlebars/runtime.js:175:32) at ret (/app/node_modules/handlebars/dist/cjs/handlebars/runtime.js:178:12)

    +0 Starting rendering request 1045 (user: admin)
    +8 Rendering template { name: /TestCaseCard/test_casecard, recipe: chrome-pdf, engine: handlebars, preview: false }
    +9 Inline data specified.
    +9 Resources not defined for this template.
    +12 Base url not specified, skipping its injection.
    +12 Rendering engine handlebars



  • pdfCreatePagesGroup expects parameter and you are calling it with undefined.
    It works for you in studio because you have likely different data there compared to the API call.
    Make sure you call pdfCreatePagesGroup with param.



  • Thanks :)


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.