Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

330
Views
Receiving 401 Unauthorized error in Sendgrid with Strapi

I'm trying to add a "forgot password" link in my application, using the built-in API provided by Strapi. I've included the configuration for Sendgrid in config/plugins.js:

module.exports = ({ env }) => ({
    email: {
      provider: "sendgrid",
      providerOptions: {
        apiKey: env('SENDGRID_API_KEY'),
      },
      settings: {
        defaultFrom: "myemail@gmail.com",
        defaultReplyTo: "myemail@gmail.com",
      },
    },
  });

Every answer I find about this error is about adding the API key in the environment variables, which I've already done (and re-done) several times. I also re-created my API key twice, in case it expired, but it's still the same. I don't understand, it was working perfectly well a couple days ago but now I'm stuck on this error. Any idea what could be the issue here?

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Probably indeed the expression env('SENDGRID_API_KEY') is not resolving the correct api key. You can also directly put your api key in the json like this:

module.exports = ({ env }) => ({
email: {
  provider: "sendgrid",
  providerOptions: {
    apiKey: 'SG.MY_SENDGRID_API_KEY',// <== not using the env function
  },
  settings: {
    defaultFrom: "myemail@gmail.com",
    defaultReplyTo: "myemail@gmail.com",
  },
},

});

If this works, the plugin is working, and you can focus on why the env() function is not resolving the variable

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!