Problem/Motivation
I get the following error message when trying to send a test email
Error: Call to a member function getStatusCode() on null in SendGrid\Client->postRequest() (line 196 of \vendor\fastglass\sendgrid\src\Client.php)
#0 \vendor\fastglass\sendgrid\src\Client.php(150): SendGrid\Client->postRequest('/v3/mail/send', Object(SendGrid\Mail\Mail))
#1 \public_html\modules\contrib\sendgrid_integration\src\Plugin\Mail\SendGridMail.php(604): SendGrid\Client->send(Object(SendGrid\Mail\Mail))
#2 \public_html\modules\contrib\sendgrid_integration\src\Plugin\Mail\SendGridMail.php(147): Drupal\sendgrid_integration\Plugin\Mail\SendGridMail->doMail(Array)
#3 \public_html\modules\contrib\mailsystem\src\Adapter.php(50): Drupal\sendgrid_integration\Plugin\Mail\SendGridMail->mail(Array)
#4 \public_html\core\lib\Drupal\Core\Mail\MailManager.php(307): Drupal\mailsystem\Adapter->mail(Array)
#5 \public_html\core\lib\Drupal\Core\Mail\MailManager.php(180): Drupal\Core\Mail\MailManager->doMail('sendgrid_integr...', 'sengrid_integra...', 'me@gma...', 'en', Array, ' Localhost <...', true)
#6 \public_html\core\lib\Drupal\Core\Render\Renderer.php(580): Drupal\Core\Mail\MailManager->Drupal\Core\Mail\{closure}()
#7 \public_html\core\lib\Drupal\Core\Mail\MailManager.php(181): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#8 \public_html\modules\contrib\mailsystem\src\MailsystemManager.php(70): Drupal\Core\Mail\MailManager->mail('sendgrid_integr...', 'sengrid_integra...', 'me@gma...', 'en', Array, ' Localhost <...', true)
#9 \public_html\modules\contrib\sendgrid_integration\src\Form\SendGridTestForm.php(168): Drupal\mailsystem\MailsystemManager->mail('sendgrid_integr...', 'sengrid_integra...', me@gma...', 'en', Array, ' Localhost <...')
#10 [internal function]: Drupal\sendgrid_integration\Form\SendGridTestForm->submitForm(Array, Object(Drupal\Core\Form\FormState))
#11 \public_html\core\lib\Drupal\Core\Form\FormSubmitter.php(114): call_user_func_array(Array, Array)
#12 \public_html\core\lib\Drupal\Core\Form\FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
#13 \public_html\core\lib\Drupal\Core\Form\FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
#14 \public_html\core\lib\Drupal\Core\Form\FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm('sendgrid_integr...', Array, Object(Drupal\Core\Form\FormState))
#15 \public_html\core\lib\Drupal\Core\Controller\FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\sendgrid_integration\Form\SendGridTestForm), Object(Drupal\Core\Form\FormState))
#16 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#17 \public_html\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#18 \public_html\core\lib\Drupal\Core\Render\Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#19 \public_html\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#20 \public_html\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#21 \vendor\symfony\http-kernel\HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#22 \vendor\symfony\http-kernel\HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#23 \public_html\core\lib\Drupal\Core\StackMiddleware\Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 \public_html\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 \public_html\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 \public_html\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 \public_html\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 \public_html\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 \vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 \public_html\core\lib\Drupal\Core\DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 \public_html\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#32 {main}
Steps to reproduce
Install module and go to send test email after you have entered your secret key.
The following error happens when you send the test email
My setup
WAMP Localhost setup (SSL not active on localhost)
Drupal Version 9.5.9
PHP Version 8.1.18