0

I'm trying to do a 'file to media' migration on a d8 installation. Following the readme on the module I have created a custom module and created the two yaml files. After enabling the module and drush ms i get the following error:

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed

The error appears on my local (DDEV) and my production environment. Drush works otherwise. drush sql-cli works.

I think i'm missing something. Do i have to set a database reference somewhere? Happy to provide additional information when needed, as i'm clueless atm.

Thanks for pointing me in the right direction.

Edit: output of drush ms -v

Exception trace:
  at myproject/docroot/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php:416
 PDO->__construct() at myproject/docroot/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php:416
 Drupal\Core\Database\Driver\mysql\Connection::open() at myproject/docroot/core/lib/Drupal/Core/Database/Database.php:374
 Drupal\Core\Database\Database::openConnection() at myproject/docroot/core/lib/Drupal/Core/Database/Database.php:169
 Drupal\Core\Database\Database::getConnection() at myproject/docroot/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php:201
 Drupal\migrate\Plugin\migrate\source\SqlBase->setUpDatabase() at myproject/docroot/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php:154
 Drupal\migrate\Plugin\migrate\source\SqlBase->getDatabase() at myproject/docroot/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php:221
 Drupal\migrate\Plugin\migrate\source\SqlBase->checkRequirements() at myproject/docroot/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php:112
 Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase->checkRequirements() at myproject/docroot/modules/contrib/metatag/src/Plugin/migrate/source/d7/MetatagFieldInstanceDeriver.php:69
 Drupal\metatag\Plugin\migrate\source\d7\MetatagFieldInstanceDeriver->getDerivativeDefinitions() at myproject/docroot/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php:101
 Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives() at myproject/docroot/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php:87
 Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions() at myproject/docroot/core/modules/migrate/src/Plugin/MigrationPluginManager.php:262
 Drupal\migrate\Plugin\MigrationPluginManager->findDefinitions() at myproject/docroot/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php:175
 Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() at myproject/docroot/core/modules/migrate/src/Plugin/MigrationPluginManager.php:109
 Drupal\migrate\Plugin\MigrationPluginManager->createInstances() at myproject/docroot/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php:697
 Drupal\migrate_tools\Commands\MigrateToolsCommands->migrationsList() at myproject/docroot/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php:135
 Drupal\migrate_tools\Commands\MigrateToolsCommands->status() at n/a:n/a
 call_user_func_array() at myproject/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
 Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at myproject/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
 Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at myproject/vendor/consolidation/annotated-command/src/CommandProcessor.php:176
 Consolidation\AnnotatedCommand\CommandProcessor->process() at myproject/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:302
 Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at myproject/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at myproject/vendor/symfony/console/Application.php:1005
 Symfony\Component\Console\Application->doRunCommand() at myproject/vendor/symfony/console/Application.php:255
 Symfony\Component\Console\Application->doRun() at myproject/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at myproject/vendor/drush/drush/src/Runtime/Runtime.php:118
 Drush\Runtime\Runtime->doRun() at myproject/vendor/drush/drush/src/Runtime/Runtime.php:49
 Drush\Runtime\Runtime->run() at myproject/vendor/drush/drush/drush.php:72
 require() at myproject/vendor/drush/drush/includes/preflight.inc:18
 drush_main() at phar:///usr/local/bin/drush/bin/drush.php:143
 require() at /usr/local/bin/drush:10

Update2: I have tried the whole process with a vanilla drupal 8.9.11, some manually created nodes with managed files (image) and all worked like a charm. So there must be something in my project going wrong.

7
  • 1
    That indicates a networking/DNS issue on your server. A common cause would be not defining 'localhost' properly ...
    – anonymous
    Dec 22 '20 at 21:58
  • I thought so too, but as i tested the migrate module also on the production server (with the same error result) and the fact that drush works otherwise lead me to the assumption it could be something related to the migrate process...
    – Volker
    Dec 22 '20 at 22:01
  • Try the --uri option to drush to specify the site URL. Check your settings.php and /etc/hosts to make sure your database host name is properly declared.
    – anonymous
    Dec 22 '20 at 22:17
  • 1
    If you uninstall the file to media module and your custom module, does the error still occur?
    – No Sssweat
    Dec 28 '20 at 14:19
  • @NoSssweat, i have uninstalled file to media and the custom module and the error still appears with the same message.
    – Volker
    Dec 28 '20 at 14:36
0

I have (finally!) resolved the problem:

  1. Starting from scratch
  2. I had setup a new Thunder distribution with Drupal 9.1.0 (Thunder 6.1.1)
  3. Instead of using the UI-version of migrate-update i did the migration from the d7 source with drush. For this the source database was additionally imported into the ddev-environment.
  4. After this was done, the file to media migration worked without database errors.

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.