core: 2.4.0 beta is not compatible with symfony 4.2

I was too excited to test 2.4.0 so I updated it, but it failed:

In CheckExceptionOnInvalidReferenceBehaviorPass.php line 86:
                                                                                                                 
  The service "api_platform.messenger.data_persister" has a dependency on a non-existent service "message_bus".           

We are using

symfony/symfony                      v4.2.1           The Symfony PHP framework

(yes, no flex, because it’s an “old” application, but we get new releases anyway)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 17 (15 by maintainers)

Commits related to this issue

Most upvoted comments

For anyone getting error The service "api_platform.messenger.data_persister" has a dependency on a non-existent service "message_bus". like I did, just add

api_platform:
    mapping:
        paths: ['%kernel.project_dir%/src/Entity']
    messenger:
        enabled: false

To config/packages/api_platform.yaml, to tell API Platform not to use messenger.

My comments

Class exist is different from service exist

Is still relevant 😃

I don’t think that fix is enough. It still requires the user to manually disable Messenger integration. Things should not be broken out of the box.

Thanks @ragboyjr !

@soyuka @lyrixx messenger_bus is a private service. When running off of the latest api-platform 2.4, this fails to load the messenger component, since $container->has('message_bus') is always false.

Checking how symfony’s FrameworkBundle works, they don’t ever check if a service exists, instead they do an interface exists check (like what we currently have and what was there previously), and in some cases, they check a config value to see if the module should be enabled or not.

@lyrixx correct me if i’m wrong, but if if you were getting that error, that means that you had symfony/messenger component installed but due to some configuration, the message bus service didn’t exist.

I think we should revert the $container->has('messenger.message_bus') since it doesn’t work, and possibly see about adding a config option to enable/disable messenger integration entirely since messenger isn’t a stable component.

I’ll fix this asap