I am using firebase's firestore triggers to send emails when new appointments are created, but sgMail.send function suddently stopped working yesterday evening.
const msg = {
to: owner.email,
from: SUPPORT_EMAIL,
subject: `Virtually Appointment Confirmation: ${client.name}`,
templateId: HOST_NEW_APPOINTMENT_TEMPLATE,
substitutionWrappers: ["{{", "}}"],
dynamic_template_data: {
host: {
name: owner.firstName
},
client,
meeting: createMeetingData(time, meeting),
pricingOption,
questionnaireResponse: questionnaireText
}
};
console.log(`Message; ${JSON.stringify(msg)}`);
sgMail.send(msg).catch(function(error) {
console.log("Error sending host confirmation: " + error.message);
});
Output:
Message; {"to":"CLIENT_EMAIL","from":"FROM_EMAIL","subject":"Virtually Appointment Confirmation: Euron Greyjoy","templateId":"TEMPLATE_ID","substitutionWrappers":["{{","}}"],"dynamic_template_data":{"host":{"name":"NAME"},"client":{"email":"CLIENT_EMAIL","imageUri":null,"message":"Nope","name":"Euron Greyjoy","userId":null},"meeting":{"link":"VIDEO_LINK","type":"video","dateString":"May 10, 2019","timeString":"2:30 PM - 2:45 PM (EST) / 11:30 AM - 11:45 AM (PST)"},"pricingOption":{"description":"Let's chat!","id":"ID","length":30,"name":"1-on-1 Meeting","price":0},"questionnaireResponse":"N/A"}}
Error sending host confirmation: Object.values is not a function
Call sgMail.send(msg) function from firebase firestore trigger.
It was working perfectly up until yesterday.
Issue was resolved by upgrading cloud functions from Node 6 to Node 8.
This issue shouldn't be closed as problem still persists in Node 6 env (also happens in our env after upgrading from sendgrid node js 6.3.1 to 6.4.0)
Reopening as others are seeing this issue as well.
Hello everyone,
It looks like this is a compatibility issue with some browsers based on some initial research. I've added this to our backlog for further investigation; however, in the meantime, it appears this may be a bandaid for now.
With Best Regards,
Elmer
TypeError: sendgrid.setApiKey is not a function. Just encountered this issue in Node.js 8 with "@sendgrid/client": "^6.3.0" ...upgrading to 6.4 has the same error.
sendgrid.request(sendgridRequest)
.then(([response, body]) => {
console.log('sendgrid response:', response);
console.log('sendgrid body:', body);
archiveEmailRequest(emailRequest, handler.ref);
}, (reason) => {
console.log('sendgrid reason:', reason);
console.log('sendgrid reason.response:', reason.response);
console.log('sendgrid reason.reponse.body:', reason.response.body);
archiveEmailRequest(emailRequest, handler.ref, reason.response);
}).catch((err) => {
console.log(err);
archiveEmailRequest(emailRequest, handler.ref, err);
});
Elmer?
async function initSendgrid() {
const config = await getConfig();
const apiKey = config.sendgrid.apiKey;
sendgrid.setApiKey(apiKey);
}
Closing as both Node 6 and 8 are now EOL. We'll probably do a major version roll in the near future that will drop support for both.
Most helpful comment
This issue shouldn't be closed as problem still persists in Node 6 env (also happens in our env after upgrading from sendgrid node js 6.3.1 to 6.4.0)