Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
bcomnes opened this issue Mar 18, 2024 · 2 comments
Labels

Comments

@bcomnes
Copy link

bcomnes commented Mar 18, 2024

Describe the bug

Node.js version: v21.7.1

OS version: macOS 14.4

Description: Started getting a node DeprecationWarning originating from line:

const res = await util.promisify(renderFn)(filePath, locals);

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

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.
  • I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
@bcomnes bcomnes added the bug label Mar 18, 2024
@axelvugts
Copy link

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

@ThuanLCSE
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants