1

Having some difficulty running database updates via drush after updating modules in the codebase. This is the error that is being reported:

Error: Call to undefined function batch_get() in /root/.config/composer/vendor/drush/drush/commands/core/drupal/batch.inc on line 92 #0 /root/.config/composer/vendor/drush/drush/includes/batch.inc(98): _drush_batch_command('11459')

This is only happening on our production environment, our staging environment is identical and works without issue.

We are able to run the updates via update.php; but we are planning to migrate to the new core media module in the coming days, and those updates bring the site down until database updates are run so update.php will not be an option.

The database is located on another server, but we have no problem connecting to that server via tools such as drush sql-cli.

We have also tracked down the 'undefined' method in question and verified it to be in existence.

Many thanks in advance for any help.

  • Are you using Composer to manage installs and dependencies? Have you run "composer install" on your production environment? We have found differences between environments and now just include composer install in a deployment shell command. – Prestosaurus Mar 22 '18 at 14:55
  • We don't run composer on the production environment; we deploy the vendor directory in our releases. – Jon Hockley Mar 22 '18 at 15:22
1

Run your drush statement with the --debug flag, you will see something along the lines of:

Checking DB credentials yielded error: Unable to find a matching SQL [debug] Class. Drush cannot find your database connection details.

Try navigating to the actual sites folder e.g. /var/www/vhosts/EXAMPLE/website/sites/default and run the drush command from the site specific directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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