Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API key does not start with "SG." #1427

Open
donpayne199 opened this issue Feb 6, 2025 · 0 comments
Open

API key does not start with "SG." #1427

donpayne199 opened this issue Feb 6, 2025 · 0 comments

Comments

@donpayne199
Copy link

Hello. Day 1 with sendGrid. Weekend warrior when it comes to coding.
I have followed the simple instructions and have created a contactUs.js file which looks like this

import sgMail from "@sendgrid/mail";
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
to: "[email protected]",
from: "[email protected]",
subject: "Hello world",
text: "Hello plain world!",
html: "

Hello HTML world!

",
};
sgMail.send(msg);
(I am using modules as seen above, if I have brought that over correctly)

My .env looks like this
SENDGRID_API_KEY=SG.xW.......

And I am trying to run this in the backend with
$node contactUs.js

I get in return
API key does not start with "SG.".
Followed by ResponseError: Unauthorized ...

What am I am missing in order to get this to go at this point and forward?

The solutions offered online for "API key does not start with "SG."" did not address my issue.
A little help please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant