Running Drupal 8.4.0 with the media_entity results in this error when running drush updb --uri=default

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException:
You have requested a non-existent service
"plugin.manager.media_entity.type". Did you mean this:
"plugin.manager.embed.type"? in
/mnt/www/html/swhr/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php:151
Stack trace:
#0 /mnt/www/html/swhr/docroot/core/lib/Drupal.php(158):
Drupal\Component\DependencyInjection\Container->get('plugin.manager....')
#1
/mnt/www/html/swhr/docroot/modules/contrib/media_entity/media_entity.install(45):
Drupal::service('plugin.manager....')
#2
/mnt/www/html/swhr/docroot/modules/contrib/media_entity/media_entity.drush.inc(39):
_media_entity_get_incompatible_modules()
#3 /mnt/www/html/swhr/vendor/drush/drush/includes/command.inc(422):
drush_media_entity_updatedb_validate()
#4 /mnt/www/html/swhr/vendor/drush/drush/includes/command.inc(231):
_drush_invoke_hooks(Array, Array)
#5 /mnt/www/html/swhr/vendor/drush/drush/includes/command.inc(199):
drush_command()
#6
/mnt/www/html/swhr/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67):
drush_dispatch(Array)
#7 /mnt/www/html/swhr/vendor/drush/drush/includes/preflight.inc(66):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#8 /mnt/www/html/swhr/vendor/drush/drush/drush.php(12): drush_main()
#9 {main}

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

craigandrews created an issue. See original summary.

craigandrews’s picture

Attached is a simple patch that checks if the service exists before working with it.

marcoscano’s picture

From the patch, it appears that you are using Media Entity 2.x branch, although this issue has been filed against 8.x-1.6. Can you point out what you are trying to do?

Media Entity 1.x is expected to be compatible with Drupal >= 8.4.x as long as you don't use the core Media module (which you shouldn't be allowed to enable, anyways).

Media Entity 2.x is only intended as a bridge to perform the upgrade path to Media in core. If you used Media Entity and want to test the upgrade path, then yes you can download the 2.x branch, follow these instructions, and test the upgrade process.

If you are trying to upgrade and it doesn't work, it could be an upgrade path bug. In this case, please change this issue to be agains 2.x-dev, and provide as many details as you can about your scenario and steps you performed to reach the bug.

Thanks!

craigandrews’s picture

Version: 8.x-1.6 » 8.x-2.x-dev

Ugh, so I made this mistake due to a confusing situation in Lightning 2.2.1. They include this block in their composer.json:

            "drupal/media_entity": {
                "Reset D.O packaging information so subsequent patches apply":
                "https://www.drupal.org/files/issues/media_entity-reset-packaging.patch",
                "2880334 - Add update path of media_entity config changes from 1.x to core media module":
                "https://www.drupal.org/files/issues/media-entity-1.6--c564fc4.diff",
                "2918172 - Media Entity upgrade -> core fails on absent column revision_uid":
                "https://www.drupal.org/files/issues/2918172-5.patch",
                "2918166 - Media Entity should uninstall itself after migration to core Media is complete":
                "https://www.drupal.org/files/issues/2918166-7.patch"
            },

This patch https://www.drupal.org/files/issues/media-entity-1.6--c564fc4.diff appears to basically replace media_entity 1.x with 2.x. (Which seems endlessly confusing to me... why depend on 1.6 then patch it to 2.x - why not just use 2.x to begin with?)

In short, I believe that yes, the patch I provided should be made against 2.x.

sinn’s picture

Issue is in media_entity.drush.inc - function drush_media_entity_updatedb_validate() is invoked by drush even if media_entity is disabled.

sinn’s picture

Quick workaround is attached

balsama’s picture

+1 to #6. This seems to be fixed in more recent versions of Drush (9.0.0-beta7 and beta8 at least) but is definitely reproducible using 8.1.15. We're pulling this into Lightning. Thanks.

marcoscano’s picture

sinn’s picture

Status: Needs review » Reviewed & tested by the community

Thanks. Tested with Drush 8.1.15 and Lightning 2.2.2-alpha2. It works now.

The last submitted patch, 2: non-existent-serivice-2919754-1.patch, failed testing. View results

marcoscano’s picture

Status: Reviewed & tested by the community » Postponed

Normally you shouldn't RTBC your own patches, but in any case, for this particular problem, I believe we should fix after the Drush refactoring on #2916947: Make sure the upgrade path works with Drush 8 and Drush 9 lands.

marcoscano’s picture

Status: Postponed » Needs review
FileSize
859 bytes

#6 doesn't apply anymore. This is just a re-roll with an improved documentation.

  • c447d90 committed on 8.x-2.x
    Issue #2919754 by craigandrews, marcoscano, sinn: non-existent service "...
phenaproxima’s picture

Status: Needs review » Fixed
Issue tags: +Media Initiative
+++ b/media_entity.drush.inc
@@ -18,6 +18,15 @@ function drush_media_entity_updatedb_validate() {
+  // circumnstances.

Fixed on commit.

Patch makes perfect sense to me. Thanks, all!

Status: Fixed » Closed (fixed)

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