'sendGrid not delivering emails from a node application hosted on vercel

I'm having issues sending emails via a node application hosted on vercel. I'm currently using sendGrid Email API with a verified domain. On development mode, it works fine, but when deployed to vercel, it will execute with the status of 200 but mail won't be delivered. here is a screenshot of my code snippet for async and not async.

const sgMail = require("@sendgrid/mail");
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const sendMail = (mail) => {
  sgMail.send(mail).then(
    () => {},
    (error) => {
      console.error(error);

      if (error.response) {
        console.error(error.response.body);
      }
    }
  );
};

const sgMail = require("@sendgrid/mail");
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const sendMail = async(mail) => {
  await sgMail.send(mail).then(
    () => {},
    (error) => {
      console.error(error);

      if (error.response) {
        console.error(error.response.body);
      }
    }
  );
};


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source