Closed (fixed)
Project:
Mailgun
Version:
8.x-1.0
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Feb 2021 at 10:53 UTC
Updated:
28 Feb 2021 at 07:54 UTC
Jump to comment: Most recent
TypeError: Argument 1 passed to Mailgun\Mailgun::create() must be of the type string, null given, called in /var/www/html/web/modules/contrib/mailgun/src/MailgunFactory.php on line 41 in Mailgun\Mailgun::create() (line 68 of /var/www/html/vendor/mailgun/mailgun-php/src/Mailgun.php).
D9 , Mailgun version 1.0
Nearly vanilla install. installed some other module before like commerce.
Comments
Comment #2
sokru commentedIs your api_key correctly set? Your error log indicates its missing.
Comment #3
bennos commentedCould not enter the API key, because the URL
admin/config/services/mailgun/settings
is the path where the error above appears.
Comment #4
sokru commentedNot being able to reproduce the issue with these steps.
1.
git clone --branch 9.2.x https://git.drupalcode.org/project/drupal.git2.
composer install3.
composer require drupal/mailgun4.
php core/scripts/drupal quick-start standard5. Enable mailgun module.
6. Go to admin/config/services/mailgun/settings, no error displayed nor on dblog.
You can bypass the problem by adding the API key to end of your settings.php file as
$config['mailgun.settings']['api_key'] = 'key-123';Comment #5
bennos commentedhmm, setting the API in settings.php works. no error. hmm
Comment #6
matroskeenI cannot reproduce it either.
Besides,
mailgun.mailgun_client_factoryis not executed onadmin/config/services/mailgun/settingspage;Mailgun::create();Another thing that bothers me is the fact that it has occurred in line 41 of MailgunFactory.php. It means that
api_endpointconfig property is empty as well.Given that, I think that the config object (mailgun.settings) wasn't properly installed during the module installation.
@bennos, can you try to uninstall and install the module again?
Once it's done, you can inspect active
mailgun.settingsconfig object. It can be done via drush:drush cget mailgun.settingsIt should be like this:
Comment #7
bennos commentedyeah, mailgun wasn't correct installed. there was an error during installation, raised from an other module in dev. Didn't know it. Looked in the logs and found the problem.
after uninstall mailgun and re-install it works correct.
Comment #8
matroskeenGreat, mystery solved!
I'm marking this as "Fixed" and giving credit to @sokru for being helpful.
Thanks!