Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In CheckExceptionOnInvalidReferenceBehaviorPass.php line 31:
The service "viewsreference.normalizer.views_reference_item.hal" has a dependency on a non-existent service "hal.link_manager".
Not really sure what would cause this. Forcing composer to go back to 8.2.0-alpha4 fixes the issue and the site becomes usable again.
Comment | File | Size | Author |
---|---|---|---|
#40 | 3096956-38.patch | 2.02 KB | seanB |
#17 | 3096956-17.Unmet-service-dependencies.patch | 555 bytes | reevo |
Comments
Comment #2
yovincesame issue.
Comment #3
demonde CreditAttribution: demonde commentedI confirm this error. It breaks the whole system. I cannot even run drush commands.
Comment #4
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedHaving the same issue, Even newly built sites
Comment #5
reevo CreditAttribution: reevo commentedQuick note on this: alpha5 includes #2900315: Normalizer for viewsreferencefield, which introduces a dependency on services from the hal and serialization modules but doesn't add them as actual dependencies. If you don't have these modules installed prior to installing or updating to alpha5 you'll see the above error.
I can confirm that rolling back to alpha4 as the OP states makes the site usable again. It's then possible to enable hal - which in turn enables serialization. After that, alpha5 can be installed.
Comment #6
vmiron CreditAttribution: vmiron as a volunteer commented@reevo, works, thank you!
Comment #7
hudriSame here, @revoo's workaround from #5 worked for me too
Comment #8
reevo CreditAttribution: reevo commentedPatch attached which a) adds hal and serialization as dependencies in .info.yml, and b) enables these modules in an update hook for sites which already have the module installed.
Comment #9
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedMade the same patch, only the older of enabling, and a hook update order
Comment #10
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedOh it is Paul's troubleshooting and fixes, only the order of enabling
Comment #11
reevo CreditAttribution: reevo commentedFor some reason, I couldn't get the patch to apply with composer when the dependencies were at the end of the info file, hence why I moved it in-between package and type
Also, the update hook threw an exception when I enabled serialization before hal.
Obviously both could be specific to my local environment :)
Comment #12
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedReevo you are right, the patch in #8 is working.
Comment #13
effortDee CreditAttribution: effortDee commentedI messed up my website a handful of times before finding out it was views reference.
I installed HAL and Serialization and views reference updates fine.
I do have anotehr issue though that when I update a module, any module, any page with a views reference on it gives me a "page not found" but its still there in admin > content.
I have to edit it and then resave for it to reappear.
Comment #14
RedEight CreditAttribution: RedEight at 95Visual commentedIs there any specific reason that HAL and Serialization must be enabled in order to use Views Reference? I can see needing it if I was using views reference to generate a serialized version of the view... but it seems like a largely unnecessary requirement for a module that won't necessarily be used in that manner. My understanding is that this service, 'viewsreference.normalizer.views_reference_item.hal', is only used when generating a JSON or otherwise serialized view output. Am I mistaken for thinking this?
Is there a way to set up the service to give a warning if the service is being configured (selected view is serialized) and HAL + Serialization is NOT available? Or some other soft dependency on HAL + Serialization. Fortunately it's a fairly innocuous dependency since both are core modules, but I would still rather not be required to enable modules whose functionality I definitely won't use.
Comment #15
saschaeggiBoth the patch and #5 worked for me.
Comment #16
reevo CreditAttribution: reevo commentedGood point, @RedEight. I think it's possible to declare services as optional dependencies, which would - I assume - remove the need to add HAL and Serialization as dependent modules.
Setting this back to needs review as, although it does fix the issue, there's likely a better way.
Comment #17
reevo CreditAttribution: reevo commentedNew patch attached which declares the services as optional dependencies.
Comment #18
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedAgrees with Reevo
An optional service could be better, we thought of that it could had been don by a sub-module.
as we had a big question yesterday to the development leads.
I like the optional service fix.
Comment #19
AnybodyAgree with #17 - just ran into the same problem. I guess we should create a new release asap, before many more people run into the problem?
#17 works fine and is a great solution!
Comment #20
effortDee CreditAttribution: effortDee commentedI have already installed HAL and Serialization then updated viewsreference.
When the next update comes can I uninstall those two modules?
Comment #21
AnybodyIF #17 will be committed, yes!
Comment #22
saschaeggi+1 on what Anybody said. Applied patch from #17 and works for me – without installing HAL and Serialization.
Comment #23
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedPatch in #17 is working with Drupal 8.7.x and Drupal 8.8.x
Comment #24
reevo CreditAttribution: reevo commentedI'm marking this as 'Needs work' - the patch in #17 worked fine for the site I was working on during the week, but another site I'm working on today is kaput after patching.
One difference between the two sites is that site A (working with patch #17) doesn't use HAL or Serialization, site B (not working) uses Serialization, but not HAL.
Comment #25
RedEight CreditAttribution: RedEight at 95Visual commentedRegarding #24, it sounds like the site that is failing is trying to use the service. Since the patch in #17 makes both services optional arguments (meaning a null is passed if they aren't present) the subscriber to the service then fails when it tries to use the Serialization service. Is there a way to modify the service class,
Drupal\viewsreference\Normalizer\ViewsReferenceItemNormalizer
, to recognize the null being passed to one or both of its arguments and send a message to enable the HAL and Serialization modules if the service is needed? Instead of just hard failing.Comment #26
jedgar1mx CreditAttribution: jedgar1mx commentedStill getting error after applying #17
Comment #27
jedgar1mx CreditAttribution: jedgar1mx commentedIt seems enabling
hal
fixed the issue. I find it odd that i need to enable a module to get a site up.🤔Comment #28
codechefmarc CreditAttribution: codechefmarc commentedConfirmed #17 worked for me too. Thanks!
Comment #29
RedEight CreditAttribution: RedEight at 95Visual commentedI can confirm that patching with #17 has been fixing my issues all day. I will note however that I do not use HAL or Serialization for anything currently on any of my sites so I can only attest to this fixing it for people not using those two modules.
It seems there is still an issue with sites that have only one or the other installed (strange because HAL requires Serialization, not sure if the reverse is also the case)
Comment #30
jedgar1mx CreditAttribution: jedgar1mx commentedI had to remove this patch in order to upgrade to 8.8. Anyone else having this issue?
Comment #31
Ruslan PiskarovComment #32
Ruslan PiskarovI noticed, the patch does not resolve the issue for 404's pages. For example /test404page-blablabla...
Comment #33
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedSeems 8.x-2.0-alpha4 is more stable option at this time.
Comment #34
kualeeI can confirm that the workaround in #5 works for me. And the patch in #17 works too!
Comment #35
kualeeNot sure why the title was changed when I commented
Comment #36
flocondetoileAnother approach could be to register the service conditionnally as CommerceLog does with a ServiceProvider
For example
Comment #37
reevo CreditAttribution: reevo commented@flocondetoile, that looks like the right approach to take.
Just to recap, the Normalizer introduced in #2900315: Normalizer for viewsreferencefield depends on HAL and Serialization. Making the dependencies optional as in #17 only works if Serialization is not enabled.
I wonder, then, if we should:
Comment #38
reevo CreditAttribution: reevo commentedAttached patch which:
Thanks @flocondetoile for the pointer! :)
I don't have a use case for the Normalizer so cannot verify whether it's still working as expected. Hoping that someone with working knowledge of #2900315: Normalizer for viewsreferencefield can contribute to this issue.
Any input on appropriate code comments/hook_requirements() messaging would be welcome.
Comment #39
RedEight CreditAttribution: RedEight at 95Visual commentedJust tested #38 on a site that didn't use HAL or Serialization and can confirm that it fixes the error. Unfortunately, I also do not have any use case for the normalizer so I can't confirm if this fixes those issues as well.
Comment #40
seanBI think we should go for a service provider indeed! Patch is attached. Could someone test this and confirm this fixes the issue without breaking denormalization for views reference fields?
Comment #41
c_archer CreditAttribution: c_archer as a volunteer and commentedI can confirm the patch in #40 works.
Comment #42
DesignWork CreditAttribution: DesignWork commentedI also can confirm that patch #40 works for me.
Comment #44
seanBThanks for testing it out! Since it is such an important fix I've committed the latest patch. Tagged and released an alpha6 version. Also had some tests for using the viewsreference normalizer in a client project which still passed with the patch applied.
Sorry this slipped through and hopefully everything now works as expected.
If anyone wants to (or has time to) help add test coverage for the module that would really help prevent stuff like this in the future (and also improves the chances of tagging a stable release sooner).