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

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

Open
3 tasks done
ereator opened this issue Nov 24, 2024 · 0 comments
Labels

Comments

@ereator
Copy link

ereator commented Nov 24, 2024

Describe the bug

Node.js version: 23.2.0

OS version: Windows 10 Pro 22H2 19045.5131

Description:
After updating the latest Node, Express and Mail template versions, the error appeared.
Once sending an email the Node.js server throws:
(node:13892) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
at node:internal/util:454:17
at new Promise ()
at node:internal/util:439:12
at Email.render (D:\Projects\uvvo\node_modules\email-templates\index.js:254:47)
at async Promise.all (index 1)
at async Email.renderAll (D:\Projects\uvvo\node_modules\email-templates\index.js:268:37)
at async Email.send (D:\Projects\uvvo\node_modules\email-templates\index.js:338:20)

Actual behavior

Throws the DeprecationWarning

Expected behavior

Do not throw the DeprecationWarning

Code to reproduce

const transporter = require('../config/transporter');
const Email = require('email-templates');

const email = new Email({
    message: {from: '"Uvvo" <noreply@uvvo.eu>'},
    send: true,
    preview: false,
    juice: true,
    juiceResources: { 
        applyStyleTags: true,
        removeStyleTags: true
    },
    transport: transporter //{jsonTransport: true }
});

async function sendReminder(crm, template, date, notistatus, logMessage) {
    if (crm.user.onNews) {
        mailer.send({
            template,
            message: { to: crm.user.email },
            locals: {
                name: crm.user.first_name,
                email: encrypt(crm.user.email),
                uid:  crm.user._id
            }
        }).catch((err) => {
            console.error('Error sending email:', err);
        });
    }

    crm.notistatus = notistatus;
    crm.comment += `📧 **${date}:** ${logMessage}`;
    console.log(`notify ${notistatus}: `, crm.user.email);
}

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.
@ereator ereator added the bug label Nov 24, 2024
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

1 participant