Docker Image issues: TypeError: c.charCodeAt(...).toString(...).padStart is not a function for html-to-text

108 Views Asked by At

i have issues on nodemailer transport using smtp which i developed in nodejs, it has no issues in local server and email sent correctly, but when i'm dockerize them and deploy to AWS ECS, the API still return status 200 without any error but email is not send to the clients email. how do i overcome this issues? i tried port 25 and 465 as well but still its not sending anything to client email.

const transporter = await nodemailer.createTransport({
        host: 'smtp.office365.com',
        port: 587,
        auth: {
            user: '[email protected]',
            pass: 'password'
        },
    })
    const templates = new EmailTemplates()
    await templates.render(template, context, async (err, html, text, subject) => {
        await transporter.sendMail({
            from: '"Company Name" <[email protected]>',
            to: email,
            subject: subjects,
            html: html,
            text: text
        }).then(() => {
            console.log(`Email sent to ${email}`)
        }).catch((err) => {
            console.log('error: ', err)
        })
    })

at first i though it's nodemailer issues, but then when i'm test run my local docker image, it's return an error

/srv/node_modules/html-to-text/lib/whitespace-processor.js:11

.map(c => '\\u' + c.charCodeAt(0).toString(16).padStart(4, '0'))

^


TypeError: c.charCodeAt(...).toString(...).padStart is not a function

at map.c (/srv/node_modules/html-to-text/lib/whitespace-processor.js:11:52)

at Array.map (native)

at charactersToCodes (/srv/node_modules/html-to-text/lib/whitespace-processor.js:11:6)

at new WhitespaceProcessor (/srv/node_modules/html-to-text/lib/whitespace-processor.js:32:29)

at new BlockTextBuilder (/srv/node_modules/html-to-text/lib/block-text-builder.js:28:31)

at htmlToText (/srv/node_modules/html-to-text/lib/html-to-text.js:146:19)

at Object.fromString (/srv/node_modules/html-to-text/lib/html-to-text.js:289:44)

at /srv/node_modules/swig-email-templates/index.js:50:29

at FSReqWrap.cb [as oncomplete] (fs.js:260:19)

i wonder what is the actual error and how to solve this html-to-text error?

0

There are 0 best solutions below