Enabling metatags submodule generates error "Interface field MetaTagInterface.metatag expected.."

Created on 20 September 2023, about 1 year ago
Updated 6 November 2023, about 1 year ago

Problem/Motivation

When enabling the module "graphql_compose_metatags" I get a list of errors in Graphql explorer upon initial loading:

{
  "errors": [
    "Interface field MetaTagInterface.metatag expected but MediaVideo does not provide it.",
    "Interface field MetaTagInterface.metatag expected but MediaImage does not provide it.",
    "Interface field MetaTagInterface.metatag expected but NodeArticle does not provide it.",
    "Interface field MetaTagInterface.metatag expected but NodeContentPage does not provide it."
  ]
}

I also cannot select the field field_metatags on the required content types under /admin/config/graphql_compose

Do you guys experience the same issue? Any ideas how to solve this issue?

Tested with 2.0.0-beta9 and 2.0.x-dev

💬 Support request
Status

Fixed

Version

2.0

Component

Code

Created by

🇳🇱Netherlands mhmhartman

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

Comments & Activities

  • Issue created by @mhmhartman
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺

    How frustrating!

    The metatag field is hidden, as its automatically added to every entity once the the module is enabled. Just in your case, its automatically giving you errors, and sucks.

    Lets fix that
    What version of the metatag module are you using?

  • 🇦🇺Australia almunnings Melbourne, 🇦🇺
  • Status changed to Postponed: needs info about 1 year ago
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺
  • 🇳🇱Netherlands mhmhartman

    Hi Almunnings,

    At least in my situation the metatags are not automatically added. I have verified that the "GraphQL Compose: Metatags" module is enabled and the content does have metatags entered.

    This is my query:

    query PageQuery {
      route(path: "/test-page") {
        ... on RouteInternal {
          __typename
          entity {
            ... on NodeArticle {
              id
              title
              path
              changed {
                time
              }
              mediaImage {
                __typename
                ... on MediaContentImage {
                  id
                  name
                  mediaImage {
                    variations(styles: HEADER_IMAGE) {
                      url
                    }
                  }
                }
              }
              
            }
          }
        }
      }
    }

    And this is the result:

    {
      "data": {
        "route": {
          "__typename": "RouteInternal",
          "entity": {
            "id": "4d9a8e9a-6dc0-43c3-813a-0cfebc2952f4",
            "title": "Test page",
            "path": "/test-page",
            "changed": {
              "time": "2023-09-21T14:34:03+02:00"
            },
            "mediaImage": {
              "__typename": "MediaContentImage",
              "id": "5def8848-20e2-456d-a2af-0b0d3c67a547",
              "name": "pyramids-egypt-banner-header_0.jpg",
              "mediaImage": {
                "variations": [
                  {
                    "url": "http://localhost/sites/default/files/platform/styles/header_image/public/content/2023-09/pyramids-egypt-banner-header_0.jpg?itok=dS2kOMS5"
                  }
                ]
              }
            }
          }
        }
      }
    }

    Used versions:

    • Core: 9.5.10
    • Metatag module: 2.0.0
    • Metatag schema: 3.0.1
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺

    Apologies for the automatic misunderstanding. It automatically adds the field to your entity via the MetaTagInterface.

    You still need to query it.

    I’ll try and recreate your initial issue.

  • 🇳🇱Netherlands mhmhartman

    Thanks Almunnings,

    using the following query I get the required results:

    metatag {
                ... on MetaTag {
                  tag
                }
                ... on MetaTagLink {
                  attributes {
                    rel
                    href
                  }
                }
                ... on MetaTagValue {
                  attributes {
                    name
                    content
                  }
                }
                ... on MetaTagProperty {
                  attributes {
                    property
                    content
                  }
                }
              }
            }

    After execution I don't get any errors, so from my side there are no more issues.

    The warnings like "Interface field MetaTagInterface.metatag expected but MediaVideo does not provide it." may still cause unexpected problems though.

    Thank you for your help.

  • 🇦🇺Australia almunnings Melbourne, 🇦🇺

    Out of interest, did you only see the error on initial install?
    Do you still see it?

    It could just be cache if you non longer see it.

  • 🇳🇱Netherlands mhmhartman

    No I had it for a while, even after fresh install and cache clears. I cant reproduce the errors anymore either..

    Sorry I cant be more helpful, I'll let u know when I discover something.

  • Status changed to Fixed about 1 year ago
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺

    I was able to reproduce it on another install with paragraphs.

    Interestingly MetatagDefaultsForm::getSupportedEntityTypes() doesn't apply the same logic as the way they actually add the metatag field in metatag_entity_base_field_info.

    I'm probably missing something, but to me it seem like just checking if the metatag field is on the basefields is all the check I need here.

    Added check to dev for next release.

  • 🇳🇱Netherlands mhmhartman

    Thanks mate :)

  • 🇮🇳India er.garg.karan Chandigarh

    I am using "2.0.0-beta11" version of graphql_compose and still see this issue. When can we have this fix released in a stable version?

  • 🇦🇺Australia almunnings Melbourne, 🇦🇺

    Looking to get 2.0.0 out the door this week. Even if its still got issues, at least its in the semantic versioning range. RC is for wimps.

    Did a heap of refactoring, so just a bit paranoid on the next release.

  • Status changed to Fixed about 1 year ago
  • 🇦🇺Australia almunnings Melbourne, 🇦🇺

    In 2.0.0 thanks all

Production build 0.71.5 2024