Search code examples
sendgridstrapi

Error: Could not load email provider "sendgrid"


ms  | [2023-06-13 15:20:43.443] debug: ⛔️ Server wasn't able to start properly.
cms  | [2023-06-13 15:20:43.444] error: Could not load email provider "sendgrid".
cms  | Error: Could not load email provider "sendgrid".
cms  |     at createProvider (/opt/app/node_modules/@strapi/plugin-email/server/bootstrap.js:21:11)
cms  |     at Object.module.exports [as bootstrap] (/opt/app/node_modules/@strapi/plugin-email/server/bootstrap.js:29:37)
cms  |     at Object.bootstrap (/opt/app/node_modules/@strapi/strapi/lib/core/domain/module/index.js:40:47)
cms  |     at Object.bootstrap (/opt/app/node_modules/@strapi/strapi/lib/core/registries/modules.js:28:19)
cms  |     at processTicksAndRejections (node:internal/process/task_queues:96:5)
cms  |     at async Strapi.runLifecyclesFunctions (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:531:5)
cms  |     at async Strapi.bootstrap (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:469:5)
cms  |     at async Strapi.load (/opt/app/node_modules/@strapi/strapi/lib/Strapi.js:478:5)

Getting the above error:

  email: {
    config: {
      provider: "sendgrid",
      providerOptions: {
        apiKey: env("SENDGRID_API_KEY"),
      },
      settings: {
        defaultFrom: env("SENDGRID_FROM"),
        defaultReplyTo: env("SENDGRID_REPLY_TO"),
      },
    },
  },

....


    "@strapi/provider-email-sendgrid": "^4.11.1",

Solution

  • When using docker-compose if you don't have the volume node_modules mapped you have to add --build when you install a new module:

    docker-compose up --build fixed it for me.