DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
-
Recently, our jsReport application has been generating a large number of the following
DeprecationWarningmessages. We are currently using jsReport version 4.3.1.(node:3268) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. at node:internal/util:496:17 at new Promise (<anonymous>) at beforeRender (node:internal/util:481:12) at executionFn (E:\app-reporting\node_modules\@jsreport\jsreport-scripts\lib\executeScript.js:73:58) at sandbox.js:50:18 at async run (E:\app-reporting\node_modules\@jsreport\jsreport-core\lib\worker\sandbox\createSandbox.js:137:16) at async WorkerReporter.runInSandbox [as _runInSandbox] (E:\app-reporting\node_modules\@jsreport\jsreport-core\lib\worker\sandbox\runInSandbox.js:211:14) at async executeScript (E:\app-reporting\node_modules\@jsreport\jsreport-scripts\lib\executeScript.js:129:12) at async Scripts._runScript (E:\app-reporting\node_modules\@jsreport\jsreport-scripts\lib\worker.js:140:30) at async Scripts.handleBeforeRender (E:\app-reporting\node_modules\@jsreport\jsreport-scripts\lib\worker.js:64:7)I am wondering whether upgrading to the next minor version might resolve this issue. Although these are only warnings, the high volume is significantly cluttering our error logs.
-
This is likely because you have updated the nodejs.
You have several options.
- downgrade back nodejs
- suppress warnings
node --no-deprecation server.jsor envNODE_NO_WARNINGS=1 - update jsreport, there seems to be no such warning in the latest jsreport, latest nodejs
-
With the latest Jsreport (v4.12) and the latest Node v22 LTS (v22.22.1), I still see this warning. Perhaps when you say "latest nodejs," this warning doesn't occur only with Node v24?
-
hmm we only call promisify on script functions with 3 parameters, does your
beforeRenderorafterRenderfunctions in the script are defined with 3 parameters?it seems you have async functions but for some reason the definition of them have 3 parameters, which is incorrect for modern jsreport scripts. you are hitting a legacy part of code that we maintain to support older version in which the
beforeRender,afterRenderfunctions were callback based.the solution is to check the
beforeRender,afterRenderfunctions in your scripts and if you are using async function just make sure the function does not receive 3 parameters.
-
Thank you very much for this advice! I've been using Jsreport since v2, so when I upgraded to v4 (seems like years ago), I don't think I've altered the beforeRender or afterRender parameters. I will look into this.