Problem/Motivation

"Failed to connect to your database server"

Steps to reproduce

Create migration group using UI. After final step, classic Drupal database connection error alert:

"Failed to connect to your database server. The server reports the following message: No database connection configured for source plugin variable.
Is the database server running?
Does the database exist, and have you entered the correct database name?
Have you entered the correct username and password?
Have you entered the correct database hostname?"

Log:

Warning: Undefined array key "migration" in Drupal\migrate\Plugin\Migration->findMigrationDependencies() (line 641 of /usr/local/www/apache24/data/newcognosce/web/core/modules/migrate/src/Plugin/Migration.php)
#0 /usr/local/www/apache24/data/newcognosce/web/core/includes/bootstrap.inc(305): _drupal_error_handler_real(2, 'Undefined array...', '/usr/local/www/...', 641)
#1 /usr/local/www/apache24/data/newcognosce/web/core/modules/migrate/src/Plugin/Migration.php(641): _drupal_error_handler(2, 'Undefined array...', '/usr/local/www/...', 641)
#2 /usr/local/www/apache24/data/newcognosce/web/core/modules/migrate/src/Plugin/Migration.php(614): Drupal\migrate\Plugin\Migration->findMigrationDependencies(Array)
#3 /usr/local/www/apache24/data/newcognosce/web/modules/wordpress_migrate/src/WordPressMigrationGenerator.php(327): Drupal\migrate\Plugin\Migration->getMigrationDependencies()
#4 /usr/local/www/apache24/data/newcognosce/web/modules/wordpress_migrate/src/WordPressMigrationGenerator.php(252): Drupal\wordpress_migrate\WordPressMigrationGenerator::createEntityFromPlugin('wordpress_comme...', 'my_wordpress_co...')
#5 /usr/local/www/apache24/data/newcognosce/web/modules/wordpress_migrate/src/WordPressMigrationGenerator.php(176): Drupal\wordpress_migrate\WordPressMigrationGenerator->createContentMigration('post')

In fact, database is running and site is otherwise behaving normally.

Something looks awry in the handoff from getMigrationDependencies to findMigrationDependencies during processing of comments.


Update: see #3390754: Undefined array key "migration" in findMigrationDependencies()

Comments

robballan created an issue. See original summary.

robballan’s picture

Appears to be fixed (at least, allows finished execution of migration group wizard) with the following change to (of all things) the settings.php file [from https://drupal.stackexchange.com/questions/227724/how-to-resolve-my-data...

$databases['migrate']['default'] = array (
'database' => 'NAME',
'username' => 'USER',
'password' => 'PASS',
'prefix' => '',
'host' => 'localhost',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);

Also, must be sure to install phpxx-xmlreader and phpxx-xmlwriter.

  • HongPong committed a6afd2b on 8.x-3.x
    #3214639 by HongPong, Add to README database connection settings.php...
hongpong’s picture

Title: "Undefined array key 'migration'" during comment processing » "Undefined array key 'migration'" during comment processing / "Failed to connect to your database server"
Status: Active » Fixed

Thanks I am adding this to the readme. The Undefined array key "migration" issue is probably separate from the database drop. See #3220304: The "migration" plugin does not exist. (on Drupal 9)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

djassie’s picture

Got this warning message - during - writing custom migration

id: custom_migration
label: Custom Migration

but label should be quoted, like `label: 'Custom Migration'

hongpong’s picture

Hello @djassie,

I have posted a new version alpha6 with ctools v4 and migrate_plus v6, can you give that a try? If the issue recurs please file a new issue.

UPDATE: It is still happening I opened #3390754: Undefined array key "migration" in findMigrationDependencies().

hongpong’s picture

Issue summary: View changes