Skip to content
Init is coming / May 19 - 23
Back

Internal curl error has occurred within the executor! Error Number: 52Error Code: 500

  • 0
  • Functions
  • Cloud
Gauravdarkslayer
19 Nov, 2024, 19:13

Getting the above error in execution tab while running on appwrite cloud. I am trying to send emails from node:appwrite and nodemailer as well but both are showing the above error. functionId: 673ccc4600223a53680e

TL;DR
Error Code 500: Internal curl error within executor. Messages indicate function likely timing out due to incorrect mail settings. Error occurs when sending emails using node:appwrite and nodemailer on appwrite cloud.
Steven
19 Nov, 2024, 19:56

Your function is probably timing out. Maybe from incorrect mail settings

Steven
20 Nov, 2024, 04:56

What's your code and how are you executing your function?

Gauravdarkslayer
20 Nov, 2024, 05:24
TypeScript
// const sdk = require('node-appwrite');
const nodemailer = require('nodemailer');


// Initialize the Mail Service
// const mailService = new sdk.Messaging(client);

export default async (context) => {
    

    try {
      context.log(context.req.bodyJson);
      context.log(context.req.bodyJson);
      const payload = context.req.bodyJson; // The data passed when triggering the function
  
  
      // Retrieve email and other relevant details
      const email = payload.email;
      const petName = payload.petName;

        const transporter = nodemailer.createTransport({
            host: 'smtp.gmail.com',
            port: 587,
            secure: false,
            auth: {
            user: process.env.emailUser,
            pass: process.env.emailPassword,
            },
        });

        const mailOptions = {
            from: '',
            to: email,
            subject: 'subject',
            html: 'html',
          };
            transporter.sendMail(mailOptions, (err, info) => {
              if (err) {
                context.error(err);
              } else {
                context.log('sent');
              }
            });
  
        return context.res.json({ success: true, message: 'Email sent successfully.' });
    } catch (err) {
         context.error('Error sending email:', err);
        return context.res.json({ success: false, error: err.message });
    }
};
Gauravdarkslayer
20 Nov, 2024, 05:24

This is the approach i've used for sending mails using nodemailer, i've also tried using node:appwrite but no luck.

Steven
20 Nov, 2024, 06:50

This seems okay. I'd have to troubleshoot this with you when I'm at a computer tomorrow.

Would you please also share your project id and deployment id?

Gauravdarkslayer
20 Nov, 2024, 07:56

Here's the latest deployment ID: 673ce25bf082a75070ba project id: 673857a800117f69b1e3

Gauravdarkslayer
21 Nov, 2024, 10:19

Hi @Steven any update on this please ?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more