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.
Hi,
I want to report a bug when using the Metatag module.
- I do a clean install of Drupal 8.
- When I use composer to install Metatag and drush to enable Metatag there is no problem
- When I try to install other modules like admin_toolbar and devel I run in to this error:
Fatal error: Class 'Drupal\serialization\Normalizer\NormalizerBase' not found in /path/modules/contrib/metatag/src/Normalizer/FieldItemNormalizer.php on line 10
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Class 'Drupal\serialization\Normalizer\NormalizerBase' not
found in /path/modules/contrib/metatag/src/Normalizer/FieldItemNormalizer.php,
line 10
When I uninstall Metatag the problems are gone, when I try to enable Metatag again the error appears again.
I found one issue also talking about this Normalize problem but that was when using the JSON api module. And I'm not using this so I was wondering what I can do to solve this problem.
Comments
Comment #2
DamienMcKennaWe're also discussing the problem in #2901253: Add normalization support for metatag module.
The weird thing is that the system shouldn't be trying to load normalizer plugins unless necessary. I honestly wonder if there's a bug in Devel.
Can you please let me know what versions of Drupal core and Devel you're using? Thanks.
Comment #3
zebda CreditAttribution: zebda commentedHi,
Thanks for your reply. Yes I found that string but since I'm not using the JSON Api I wanted to mention it anyway.
I'm using Drupal 8.3.7 and Devel 8.x-1.0
Keep me updated.
Joost
Comment #4
attheshow CreditAttribution: attheshow at FleetThought commentedI was receiving normalize errors trying to get JSON API output while having Metatag installed (see: https://www.drupal.org/node/2903261). I just wanted to make everyone aware. Thanks!
Comment #5
DamienMcKennaI think there are two separate problems here and they're getting confused.
The problem with the Devel module should be fixed thanks to 1.0 being released.
Is there anything left to fix with this?
Comment #6
Blanca.Esqueda CreditAttribution: Blanca.Esqueda at Portage CyberTech commentedHi,
Metatag didn't implement their FieldItemNormalizer correctly. The normalize() function should return an instance of the $supportedInterfaceOrClass which is Drupal\metatag\Plugin\Field\FieldType\MetatagFieldItem, but instead a Translation object is returned;
Implementation fail
Instead of just saying normalization is not supported, they should've implemented the method made for that exact purpose;
As per amenzou and webfaqtory comments on the following discussion:
https://www.drupal.org/project/content_sync/issues/2908064#comment-12518866
Regards,
Blanca
Comment #7
mlncn CreditAttribution: mlncn at Agaric for Drutopia commentedI think we might be running into some variant of this; the error we're getting is that class 'Drupal\metatag\Normalizer\FieldItemNormalizer itself is not found.
This is happening after an update of config_normalizer from 8.x-1.0-alpha4 to 8.x-1.0-alpha5, and it completely breaks any use of Drush and even core/update.php.
Comment #8
mlncn CreditAttribution: mlncn at Agaric for Drutopia commented... adding the code Blanca.Esqueda recommended to
modules/contrib/metatag/src/Normalizer/MetatagNormalizer.php
and doingdrush cr
fixed it for me.Unfortunately, removing the code didn't reproduce the problem, and now i'm sitting here shocked that there's a possibility i didn't try reloading the cache before editing the code. Dropping back to normal priority but i think there may still be something here for Metatag to fix.
Comment #9
DamienMcKennaLet's focus our efforts on #2945817: Support JSON API, REST, GraphQL and custom normalizations via new computed field and create additional issues if further work is needed after that.