email-templates icon indicating copy to clipboard operation
email-templates copied to clipboard

[DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.

Open bcomnes opened this issue 2 years ago • 4 comments

Describe the bug

Node.js version: v21.7.1

OS version: macOS 14.4

Description: Started getting a node DeprecationWarning originating from line: https://github.com/forwardemail/email-templates/blob/e8b8cfced71077a9401f6fd03c6ae8369766978a/index.js#L249

Actual behavior

Test/usage output includes the following deprecation warnings.

(node:60785) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at Email.render (/Users/bret/Developer/email-templates/index.js:249:47)
    at async Promise.all (index 2)
    at Email.renderAll (/Users/bret/Developer/email-templates/index.js:263:37)
    at Email.send (/Users/bret/Developer/email-templates/index.js:333:20)
    at async /Users/bret/Developer/email-templates/test/test.js:233:9
(node:60785) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:431:17
    at new Promise (<anonymous>)
    at node:internal/util:416:12
    at Email.render (/Users/bret/Developer/email-templates/index.js:249:47)
    at async Promise.all (index 1)
    at Email.renderAll (/Users/bret/Developer/email-templates/index.js:263:37)
    at Email.send (/Users/bret/Developer/email-templates/index.js:333:20)
    at async /Users/bret/Developer/email-templates/test/test.js:233:9
  ✔ send two emails with two different locals

Expected behavior

It should avoid running promisify on promise returning functions.

  ✔ send two emails with two different locals

Code to reproduce

Run npm test running on node 21.

Checklist

  • [x] I have searched through GitHub issues for similar issues.
  • [x] I have completely read through the README and documentation.
  • [x] I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.

bcomnes avatar Mar 18 '24 23:03 bcomnes

Seeing the same behavior here, would be great if it could be looked into!

axelvugts avatar Apr 25 '24 13:04 axelvugts

Same issue in my product, please help to take a look.

ThuanLCSE avatar May 21 '24 12:05 ThuanLCSE

Please submit a PR if you'd like to fix this.

titanism avatar Jun 16 '24 21:06 titanism

I may revisit if I find time but anyone else feel free to take a stab at it.

bcomnes avatar Jun 17 '24 23:06 bcomnes

PR welcome

titanism avatar Jul 18 '24 10:07 titanism