Search code examples
sendgridremix.run

Why would the sendgrid node.js api hang when sending an email and give no error?


I am trying to send an email with sendgrid in a remix action. I have verified that the api key is the correct environment variable. Nothing is being logged to the console at alll. Here is my code:

const sgMail = require("@sendgrid/mail");
  sgMail.setApiKey(process.env.SENDGRID_KEY);
  const message = {
    from: "admin@chriswestbrook.com",
    to: "westbchris+blog@gmail.com",
    subject: `a comment has been left on ${slug}`,
    text: "testing",
    html: `author:${author}<br/>
    email:${email}<br/>
    text:${text}
    `,
  };
  try {
    await sgMail.send(message);
  } catch (e) {
    console.log(e);
  }

Am I missing something obvious?


Solution

  • This ended up having something to do with their indy stack using msw to mock server api requests blocking sendgrid. See this issue.