Problems upgrading Metatag and Schema_Metatag to current releases

Created on 13 August 2024, 3 months ago
Updated 9 September 2024, 2 months ago

Problem/Motivation

I'm trying to upgrade Metatag v1.26 & Schema_Metatag v2.6 to the current release (v2.0.2 & v3.0.3 respectively). However, each time I try to do the upgrade via composer, I get the following message in my browser:

The website encountered an unexpected error. Try again later.
Error: Class "Drupal\metatag\Normalizer\MetatagHalNormalizer" not found in Drupal\Component\DependencyInjection\Container->createService() (line 261 of core/lib/Drupal/Component/DependencyInjection/Container.php).

Steps to reproduce

[fedora@ns tomthorp-me.d11]$ composer require drupal/metatag:^2 --no-update
./composer.json has been updated
[fedora@ns tomthorp-me.d11]$ composer require drupal/schema_metatag:^3 --no-update
./composer.json has been updated
[fedora@ns tomthorp-me.d11]$ /opt/php83/bin/php /usr/local/bin/composer.phar update && restorecon -Rv . && sudo chown -R fedora:apache web && drush updatedb && drush cr && drush core:cron
Gathering patches for root package.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 2 updates, 0 removals
  - Upgrading drupal/metatag (1.26.0 => 2.0.2)
  - Upgrading drupal/schema_metatag (2.6.0 => 3.0.3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 2 updates, 0 removals
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Upgrading drupal/metatag (1.26.0 => 2.0.2): Extracting archive
  - Upgrading drupal/schema_metatag (2.6.0 => 3.0.3): Extracting archive
Generating autoload files
90 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
phpstan/extension-installer: Extensions installed
No security vulnerability advisories found
 [success] No pending updates.
 [success] Cache rebuild complete.
[fedora@ns tomthorp-me.d11]$ 

I have also tried disabling Opcache and APCU, including restarting PHP-FPM and Apache services, all without success.

Is there a workaround to this issue? I am trying to prepare a copy of my website for Drupal 11, and Metatag / Schema_Metatag is becoming a sticky issue.

πŸ’¬ Support request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia tomthorp

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @tomthorp
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Were you using the MetatagHalNormalizer plugin on your site?

    Did you rebuild the caches?

  • πŸ‡¦πŸ‡ΊAustralia tomthorp

    I don't believe I have used the MetatagHalNormalizer plugin. It is not listed in the list of plugins.

    The list of plugins that are enabled on my site are :

    Metatag Plugins
    Facebook
    Hreflang
    Open Graph
    Pinterest
    Twitter Cards
    Verification
    Views

    Schema_Metatag Plugins
    Article
    Metatag
    Organization
    Person
    WebPage
    WebSite

    I did rebuild the caches, as outlined in my "steps to reproduce". ( using "drush updatedb", "drush cr" and "drush core:cron" ) .

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    For clarification - the MetatagHalNormalizer plugin was part of the main module, it wasn't a submodule. It was only actually needed if it was being used by another module to build JSON or GraphQL output of meta data for entities, usually for sharing data to another system.

    Were you using any JSON or GraphQL output on your site to interact with other systems?

  • πŸ‡¦πŸ‡ΊAustralia tomthorp

    The only JSON that's generated is via the Article Plugin in Schema_Metatag. Thus :

    <script type="application/ld+json">{
        "@context": "https://schema.org",
        "@graph": [
            {
                "@type": "Article",
                "headline": "PHP cURL error HTTP/2 stream 0 was not closed cleanly",
                "name": "TomThorp.me",
                "description": "When using PHP\u0027s cURL function, you may come across this error in your website log when the cURL function fails to retrieve information back. Here is the solution to this problem.",
                "about": [
                    "PHP",
                    "cURL"
                ],
                "image": {
                    "@type": "ImageObject",
                    "representativeOfPage": "True",
                    "url": "https://d11.tomthorp.me/sites/default/files/styles/summary_card_large/public/BlogImages/2000px-PHP-logo.svg__0_0.png?itok=FPDNjVBA",
                    "width": "600",
                    "height": "300"
                },
                "datePublished": "2024-01-24T16:59:37+1000",
                "dateModified": "2024-01-24T17:13:03+1000",
                "author": {
                    "@type": "Person",
                    "@id": "https://d11.tomthorp.me/about/biography",
                    "name": "Tom Thorp",
                    "url": "https://d11.tomthorp.me/about/biography"
                },
                "publisher": {
                    "@type": "Organization",
                    "@id": "https://d11.tomthorp.me/",
                    "name": "TomThorp.me",
                    "url": "https://d11.tomthorp.me/",
                    "logo": {
                        "@type": "ImageObject",
                        "url": "https://d11.tomthorp.me/sites/default/files/TomThorp_0.png"
                    }
                },
                "mainEntityOfPage": "https://d11.tomthorp.me/blog/php-curl-error-http2-stream-0-was-not-closed-cleanly"
            }
        ]
    }</script>
    
  • πŸ‡¦πŸ‡ΊAustralia tomthorp

    I've successfully been able to install Metatag v2 & Schema_Metatag v3 on my Drupal 10 site. I haven't fully tested it yet, but I think the blocker was the module yoast_seo, which had a dependency on metatag.

    BTW, I discovered your Mediacurrent Youtube channel. Have been able to apply the 'lenient' plugin to my composer.json, in order to get some modules that were not well maintained, Drupal 11 ready, in order for the upgrade to proceed. I'll have to review those out-of-date modules in the not too distant future.

  • Status changed to Fixed 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Ah! Good to know there was another module causing the problem, I'm glad you were able to get it all solved.

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

Production build 0.71.5 2024