My CiviCRM database cannot connect to my database server when it is loading a Drupal page that accesses CiviCRM through Views.

We have been having all sorts of trouble with our Amazon Aurora instance but all the problems have appeared focused on the Drupal database. We have one server but two databases running on the instance. One for Drupal 9.3.3 and one for CiviCRM 5.45.2.

The error is InvalidArgumentException: Minimum requirement: driver://host/database in Drupal\Core\Database\Connection::createConnectionOptionsFromUrl() (line 2021 of core/lib/Drupal/Core/Database/Connection.php).

The full backtrace too long to include but these are the key lines:

Drupal\Core\Database\Database::convertDbUrlToConnectionInfo('mysql://db_name:password@db-address:port/database?new_link=true', '/var/www/web') (Line: 67)
Drupal\civicrm_entity\Plugin\views\query\CivicrmSql->init(Object, Object, Array) (Line: 820)
Drupal\views\Plugin\views\display\DisplayPluginBase->getPlugin('query') (Line: 1182)
Drupal\views\ViewExecutable->initQuery() (Line: 1154)
Drupal\views\ViewExecutable->getQuery() (Line: 242)
Drupal\views\Plugin\views\cache\CachePluginBase->getCacheTags() (Line: 1566)
Drupal\views\ViewExecutable->getCacheTags() (Line: 2208)
Drupal\views\Plugin\views\display\DisplayPluginBase->applyDisplayCacheabilityMetadata(Array) (Line: 2407)
Drupal\views\Plugin\views\display\DisplayPluginBase->buildRenderable(Array, ) (Line: 1595)
Drupal\views\ViewExecutable->buildRenderable('block_1', Array, ) (Line: 51)
Drupal\views\Plugin\Block\ViewsBlock->build() (Line: 171)

I am able to load /civicrm and I am able to connect to the database with cv command. I have no reason to think there would be any corruption to the database. I did recently expand the value for max_allowed_packets, expand the size of the RDS Aurora instance, and turn on file based long query auditing. I do not think any of these things should break this. Further, it was working this morning after those changes were made.

Any help is greatly appreciated.



1 Answer 1


I use CiviCRM/Drupal 9 in a split database configuration with Views. Make sure that you've added the necessary configuration into settings.php (can be found under Administer menu » System Settings » CMS Database Configuration). You'll also need the civicrm_entity module.

Note that this is a moving target as of February 2022 - Drupal 10 won't support per-table database prefixes in settings.php so work is underway to use a different approach. There is an open issue (and open pull request) which, once merged, will change the values you put into settings.php.

  • thank you for your help. I have checked my database settings and they all look right for Drupal 9. Nothing should be changed on my end. Looking back at what I did, I think I updated to the newest version of civicrm_entity. I tried to go back to old dev copy I was using (probably 9 months old) and that will not work any longer. I get "'Error: Class ''Drupal\civicrm_entity\ModuleInstaller'' not found in Drupal\Component\DependencyInjection\Container->createService() (line 262 of /var/www/site/web/core/lib/Drupal/Comp'" Any ideas on where else to look is greatly appreciated
    – Josh
    Commented Feb 9, 2022 at 5:01
  • I recall there was an issue with older versions of civicrm_entity that didn't uninstall cleanly, though I don't recall details past that - that may be related to your problem. You can check Github or d.o for civicrm_entity issues that mention uninstall. I suspect that if you can cleanly uninstall and reinstall civicrm_entity you'll be good - though now that I look, I too am running some older dev version. Still, uninstall/reinstall of civicrm_entity seems like a good next move. Commented Feb 9, 2022 at 18:45
  • I am sorry I have not updated this sooner but I was able to fix this by adding a second database without prefixes. There is an example here: drupal.org/project/civicrm_entity/issues/…
    – Josh
    Commented Apr 24, 2022 at 20:54

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.