0

I have two Drupal 8 sites. Both have sendgrid integration installed via composer and both are using the same version (1.2). I have a Sendgrid account created and an API Key has been saved to the config for both sites.

The problem is that only one site is able to send mail while the other fails. I tested the functionality by sending test emails to myself and the site that failed always gave this error.

No API Secret key has been set

I've traced the error to the following code where the first if statement always fails.

$site_config = $this->configFactory->get('system.site');
$sendgrid_config = $this->configFactory->get('sendgrid_integration.settings');

$key_secret = $sendgrid_config->get('apikey');
if ($this->moduleHandler->moduleExists('key')) {
  $key = \Drupal::service('key.repository')->getKey($key_secret);
  if ($key) {
    $key_value = $key->getKeyValue();
    if ($key_value) {
      $key_secret = $key_value;
    }
  }
}

I'm confused because this is only happening on one of my sites, not on both even though they are configured the same way. Does anyone know what might be causing this issue?

4
  • Did you enter the key over at /admin/config/services/sendgrid?
    – No Sssweat
    Commented May 24, 2019 at 18:04
  • Yes, it shows that the key has been saved.
    – Trey D
    Commented May 24, 2019 at 19:04
  • try uninstalling and re-installing the module and setting the key again.
    – No Sssweat
    Commented May 24, 2019 at 19:41
  • Tried uninstalling and re-installing. I pasted the API key in and the field says it saved. Still unable to test a email using Sendgrid.
    – Trey D
    Commented May 30, 2019 at 18:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.