Sendgrid not receiving anything at production level

Just created and tested an email blaster using sendgrid.
Everything works perfectly locally but when I try to test using a production build but nothing gets sent to SendGrid.
I tried the fixes to similar problems I found on this forum.

Hi @jeffreyyi11

Do you receive any errors? Are you logging to the console to see what is happening when the script runs?
Do you have some function code you can share, or a git repository?

I have the same issue. The error is 502

hi @ismaelpaul

Welcome to our forums! do you mind sharing a bit more detail on your implementation of sendgrid emails? Are you experiencing this locally as well?


hi @gualter, thanks. Locally it works just fine. I just did some research and I think the problem is because I didn’t create a variable on netlify and, of course, I didn’t push to production the .env file with the API key. It might work when I create the variable on netlify. I am away from the computer and I’ll try this tomorrow. I’ll come back to tell you whether it worked or not. If it doesn’t work I’ll give you more details about the implementation and we see what we can do.
Thanks for your prompt response.

sounds good! from your description it seem like that may be the root cause :crossed_fingers:

feel free to reach out anyway!

1 Like

Hi @gualter, it’s sorted! The problem was with the environment variable and I had to do some tweaks on my code as well.

Thanks for the support :slight_smile: