-
Notifications
You must be signed in to change notification settings - Fork 783
Closed
Labels
difficulty: easyfix is easy in difficultyfix is easy in difficultystatus: work in progressTwilio or the community is in the process of implementingTwilio or the community is in the process of implementingtype: twilio enhancementfeature request on Twilio's roadmapfeature request on Twilio's roadmap
Description
Issue Summary
I'm retrieving the api key from an environment variable. Somehow in one of our environments the api key was undefined. It would be helpful if an error is logged or an error is thrown when setupApiKey is called with undefined, or with other wrong inputs, so that we are immediately informed when this is the case.
Steps to Reproduce
- Setup the api key as undefined
sgMail.setupApiKey(undefined) - No error, so it seems like the ApiKey is set correctly
- Only when trying to send a mail an error is thrown
Code Snippet
const msg = {
to: 'test@example.com',
from: 'test@example.com',
subject: 'Sending with SendGrid is Fun',
text: 'and easy to do anywhere, even with Node.js',
html: '<strong>and easy to do anywhere, even with Node.js</strong>',
};
sgMail.setApiKey(undefined);
sgMail.send(msg);Exception/Log
None after setupApiKey(undefined)
Error after sending the mail;
Unauthorized (401)
Permission denied, wrong credentials
Technical details:
- sendgrid-nodejs version: 6.5.4
- node version: 8.16.2
Metadata
Metadata
Assignees
Labels
difficulty: easyfix is easy in difficultyfix is easy in difficultystatus: work in progressTwilio or the community is in the process of implementingTwilio or the community is in the process of implementingtype: twilio enhancementfeature request on Twilio's roadmapfeature request on Twilio's roadmap