Problem/Motivation

Have Drupal 9 site with custom migrations defined with shared configuration (Using MigrationGroup configuration provided by Migrate Plus module)

migrate 9.1.10
migrate_plus 8.x-5.1
migrate_tools 8.x-5.0
migrate_source_csv 8.x-3.4

All migrations will fail if status of migrations are listed or performing any of the migration processes with following error message:

In DiscoveryTrait.php line 53:

The "" plugin does not exist. Valid plugin IDs for Drupal\migrate\Plugin\MigrateSourcePluginManager are: embedded_data, empty, table, url, csv, d7_responsive_image_styles

Root cause for the error is MigrationHelper::alterPlugins() method introduced in 8.x-1.0-rc9 that assumes that every migration includes full set of configuration in its config file. MigrationHelper::alterPlugins() fails if $migration['source']['plugin'] is missing from the config file.

It's quite common when migrating content from csv file (as an example) that most of the migration configuration is handled using MigrationGroup configuration entities provided by Migrate Plus module.

Steps to reproduce

- Install (at least) migrate, migrate_plus, migrate_tools
- Create custom migration that has migration_group defined
- Add source related configuration to group config as shared_configuration.
- Enable custom migration
- Try to check status of migration

Status check of migration will fail if actual migration config file does not have ['source']['plugin'] defined (included in shared_configuration instead)

Proposed resolution

See attached patch that integrates shared group configuration into the migration.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mitrpaka created an issue. See original summary.

Status: Needs review » Needs work

The last submitted patch, MigrationHelper_alterPlugins.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

mitrpaka’s picture

Status: Needs work » Needs review
FileSize
2.28 KB
1.68 KB

Patch updated.

mitrpaka’s picture

geek-merlin’s picture

Thanks a lot! I added some related issues and it seems one of the latest patches did a regression.

Tbh i don't grok the migration plugin descriptor structure you're handling, but the code looks like you know what you are doing.
Tests are green. So LGTM.

Does this fix the issue for you?
I also pointed people in the related issues (with some suppress-only patches) to this one to maybe get additional feedback.

Also, if you can push to an issue branch, it will significantly make it easier to merge ;-).

brockfanning’s picture

Just wanted to say that I also got hit by the bug, and this patch fixed it for me. Thank you!

matslats’s picture

Still not working for me I'm afraid, the patch makes no difference at all to the error or to the process plugins.
The new function getMigrationWithSharedConfiguration runs and it seems to me that the problems is with the altered structure of migration processes.

    [inline_entity_form] => Array
        (
            [plugin] => inline_entity_form_field_instance_settings
        )

    [1] => Array
        (
            [0] => Array
                (
                    [plugin] => d7_field_instance_settings
                    [source] => Array
                        (
                            [0] => settings
                            [1] => widget
                            [2] => field_definition
                        )

                )

            [inline_entity_form] => Array
                (
                    [plugin] => inline_entity_form_field_instance_settings
                )

        )

Do I need this to work to upgrade from D7 Ubercart?

IT-Cru’s picture

Patch from #3 also works for us to fix this issue.

  • Do we really need to provide an own getMigrationWithSharedConfiguration() or does migrate module provide such method in some way?
  • Should we add a isset($migration['source']['plugin']) before $source_plugin_manager->createInstance() ?
rescandon’s picture

Status: Needs review » Reviewed & tested by the community

The patch is fixing the error. Thank you.

KarlShea’s picture

Status: Reviewed & tested by the community » Needs work

It's also breaking migrations for me in a similar way as #7.

greenSkin’s picture

I ran into a similar issue described in #7. Inline Entity Form module doesn't cover the case if the migration already defines the additional settings process for inline_entity_form, or more specifically whether the settings process array is a plugin or is an array of plugins. This patch checks to see if "plugin" key exists, if it does then it is wrapped inside an array prior to merging the addition rather than always wrapping the result inside an array.

nginex’s picture

Here is small improvement for #3 patch

junaidpv’s picture

Patch from #11 helped. Thanks!

thatguy’s picture

Patch from #11 fixed the issue for me

geek-merlin’s picture

junaidpv’s picture

#11 no longer helps me! I required to apply change suggested in #3208995: Alter plugins results in empty string which is invalid plugin ID instead.

geek-merlin’s picture

> #11 no longer helps me!
What does this mean? Does it apply? What happens? What about #12?

junaidpv’s picture

> #11 no longer helps me!
What does this mean? Does it apply? What happens? What about #12?

It does apply, but it keeps throwing "The "" plugin does not exist." error.
Same for #12 as well.

Lysenko made their first commit to this issue’s fork.

Lysenko’s picture

Hi, I made this MR !49 in order to avoid creating the instance of the source plugin of the migration.
Because when we create an instance of the source plugin it inits the query to the source of the migration that
occurs issues when the migration source is not reachable.
For example, API is not available from the local machine.

The patch was created in contributing with @alt.dev it would be great if he will get a credit as well.

drupalam’s picture

Hello there

Can we reroll please? This patch is no longer working for me on Drupal 9.4.4.
https://www.drupal.org/files/issues/2021-11-19/3221074-12.patch

This is the reject file. There is an error given on composer update however most of the patch is applied.
MigrationHelper.php.rej

***************
*** 31,36 ****
        /** @var \Drupal\migrate\Plugin\MigrateSourcePluginManager $source_plugin_manager */
        $source_plugin_manager = \Drupal::service('plugin.manager.migrate.source');
        $source = NULL;
        $configuration = $migration['source'];
        $source = $source_plugin_manager->createInstance($migration['source']['plugin'], $configuration, $migration_stub);
        if ($source) {
--- 31,41 ----
        /** @var \Drupal\migrate\Plugin\MigrateSourcePluginManager $source_plugin_manager */
        $source_plugin_manager = \Drupal::service('plugin.manager.migrate.source');
        $source = NULL;
+       if (!empty($migration['migration_group'])) {
+         // Integrate shared group configuration into the migration, in order to
+         // have full migration definitions in place.
+         $this->getMigrationWithSharedConfiguration($migration);
+       }
        $configuration = $migration['source'];
        $source = $source_plugin_manager->createInstance($migration['source']['plugin'], $configuration, $migration_stub);
        if ($source) {
drupalam’s picture

I have updated this patch based on the newest version of the module 1.0.0@rc12

https://www.drupal.org/files/issues/2022-08-01/3221074-13.patch

drupalam’s picture

geek-merlin’s picture

Status: Needs review » Postponed (maintainer needs more info)

Too many migration issues, many of which look overlapping or duplicate.
Postponing on parent issue.

Anybody’s picture

Version: 8.x-1.0-rc9 » 8.x-1.0-rc12
Status: Postponed (maintainer needs more info) » Active

Hi @Axel,

settings this back to active as of #3275819: Provide useful error message for: The "" plugin does not exist on Drupal 6 / 7 migrations which we just ran into. The migrations were created with 8.x-1.0-rc12, so I'm updating the version. We can set this to 8.x-1.x-dev if they are same, @Grevil will check if 8.x-1.x-dev gives better results tomorrow.

I guess this might also be the root cause of: https://www.reddit.com/r/drupal/comments/of145l/the_plugin_does_not_exis...

Anybody’s picture

Priority: Normal » Major

This is major as it breaks migrations and is hard to find!

Anybody’s picture

Version: 8.x-1.0-rc12 » 8.x-1.x-dev

Ok we can safely set this to 8.x-1.x-dev. src/MigrationHelper.php is the same in rc12 and 8.x-1,x-dev (not changed since 12 months) so this is definitely still an issue!

With inline_entity_form enabled, this is what changes:

--- a/tmp/drush_tmp_1661935158_630f1e3676b3d/migrate_plus.migration.upgrade_d7_field_instance.yml
+++ b/tmp/drush_tmp_1661935158_630f1e36c8378/migrate_plus.migration.upgrade_d7_field_instance.yml
@@ -83,14 +83,12 @@ process:
           migration: upgrade_d7_taxonomy_vocabulary
           source: vid
   settings:
+    0:
-    -
       plugin: d7_field_instance_settings
       source:
         - settings
         - widget
         - field_definition
+    inline_entity_form:
+      plugin: inline_entity_form_field_instance_settings
   default_value_function:
     -
       plugin: get
geek-merlin’s picture

Priority: Major » Normal
Status: Active » Postponed

Please read the parent issue before acting.

Anybody’s picture

Thanks @geek-merlin, you're right. I'm going to help cleaning and clearing things up as good as possible.

Anybody’s picture

@geek-merlin: From my perspective, we should set this issue "Needs review", as after checking all sibling issues from the parent task, this one is separate and there's no duplicate for this issue anymore.

If you agree, would you do that?

Next steps are to compare the approach from #28 (3221074-14.patch) to the approach from MR!49, which use very different implementations!

@Lysenko wrote in #25:

Hi, I made this MR !49 in order to avoid creating the instance of the source plugin of the migration.
Because when we create an instance of the source plugin it inits the query to the source of the migration that occurs issues when the migration source is not reachable. For example, API is not available from the local machine.

Sorry, but I don't really get the point here. Could you or someone else please compare the outcome of both patches and tell, which one is better to proceed with?

Do we have an inline_entity_form maintainer with deeper migration knowledge, we could ask for having a look?

geek-merlin’s picture

Thanks Anybody for the thorough cleanup!

I have reviewed everything.
Short verdict: Move on with #28.

Triggered bot and #28 still applies and is green.
MRs 48/49 take the work of #28 and adds lots of unrelated changes. I doubt that something useful is in there, but if it is, it's not reviewable.
(Unrelated comment: People told me that there is a current discussion what the contribution point system encourages.)

Anybody’s picture

@everyone here, receiving this notification and anyone coming here with this issue, could you please check and confirm if the patch from #28 fixes the issue for you?

We didn't run into this situation and @geek-merlin also didn't, I guess, so we need someone to try, if this is the correct solution.
All related migration fixes are now in 8.x-1.x-dev, this is currently the last open migration issue here. Please help to fix it.

@geek-merlin, what do you think about a new 8.x-1.0-rc13 release from current dev? So less people may run into the fixed issues...
I don't think this issue will be solved on the short term...

geek-merlin’s picture

> @geek-merlin, what do you think about a new 8.x-1.0-rc13 release from current dev?

Agree once we have the other issue where you test on a migration ;-)

geek-merlin’s picture

@Anybody, you groked all the migration issues... We have this patch #11 which looks unrelated here, but relevant.
Can you cross-check if that's in one of the other migraiton patches?

geek-merlin’s picture

Also we have a relevant question in #8:
> Do we really need to provide an own getMigrationWithSharedConfiguration() or does migrate module provide such method in some way?

Anybody’s picture

@geek-merlin: Re #40: #11 looks to me like a duplicate of the already committed https://git.drupalcode.org/project/inline_entity_form/-/commit/748816b from #3213595: MigrationHelper::alterPlugins assumes settings isn't already an array

Re #41 I'm sadly not able to answer this. We didn't run into such issues, so I think someone else has to pick this up from here... or maybe this is magically solved by the other fixes, but I don't think that's realistic from a code perspective.

Over and out here (if we shouldn't run into these issues sooner or later).

geek-merlin’s picture

Thx! So we're at #38: Please someone(tm) test if the patch in #28 fixes the issue for them.

PCate’s picture

Status: Needs review » Reviewed & tested by the community

#28 fixed the migrated error for me. Tested with 8.x-1.0-rc12.

geek-merlin’s picture

  • geek-merlin committed 3d19dd9 on 8.x-1.x
    Issue #3221074 by mitrpaka, drupalam, nginex, greenSkin, geek-merlin,...
geek-merlin’s picture

Status: Reviewed & tested by the community » Fixed

So the last migration bug is hereby fixed, thanks all!
Tagging rc13 release.

Anybody’s picture

Thank you very much, Axel! :) I hope we'll see no regression. inline_entity_form was a huge part of our migration issues, so it's great to see this should be fixed now. Thanks for the important release!

Status: Fixed » Closed (fixed)

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