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?
/admin/config/services/sendgrid
?