GraphQL query stops working - seems cache issue

Created on 27 September 2024, 6 months ago

Problem/Motivation

GraphQL query suddenly stops working. After clearing all cache multiple time it starts working. It's happening in our prod environment.

Steps to reproduce

When I navigate to run query here `/admin/config/graphql/servers/manage/graphql_compose_server/explorer`. I'm seeing so many errors:
{
"errors": [
{
"message": "Interface field Connection.nodes expects type [EdgeNode!]! but BlockContentAlertConnection.nodes is type [BlockContentAlert!]!.",
"stack": "GraphQLError: Interface field Connection.nodes expects type [EdgeNode!]! but BlockContentAlertConnection.nodes is type [BlockContentAlert!]!.\n at t.reportError (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at w (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at E (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...\n at h (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...\n at Object.Xa [as useMemo] (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at t.useMemo (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at SchemaContextProvider (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at ka (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)"
},
{
"message": "Interface field Edge.node expects type EdgeNode! but BlockContentAlertEdge.node is type BlockContentAlert!.",
"stack": "GraphQLError: Interface field Edge.node expects type EdgeNode! but BlockContentAlertEdge.node is type BlockContentAlert!.\n at t.reportError (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at w (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at E (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...\n at h (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...\n at Object.Xa [as useMemo] (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at t.useMemo (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at SchemaContextProvider (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at ka (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)"
},
{
"message": "Interface field Connection.nodes expects type [EdgeNode!]! but BlockContentAuthorSBlockConnection.nodes is type [BlockContentAuthorSBlock!]!.",
"stack": "GraphQLError: Interface field Connection.nodes expects type [EdgeNode!]! but BlockContentAuthorSBlockConnection.nodes is type [BlockContentAuthorSBlock!]!.\n at t.reportError (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at w (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at E (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...\n at h (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...\n at Object.Xa [as useMemo] (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at t.useMemo (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at SchemaContextProvider (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at ka (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)"
},
{
"message": "Interface field Edge.node expects type EdgeNode! but BlockContentAuthorSBlockEdge.node is type BlockContentAuthorSBlock!.",
"stack": "GraphQLError: Interface field Edge.node expects type EdgeNode! but BlockContentAuthorSBlockEdge.node is type BlockContentAuthorSBlock!.\n at t.reportError (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at w (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at E (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...\n at h (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...\n at Object.Xa [as useMemo] (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at t.useMemo (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at SchemaContextProvider (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)\n at ka (https://wwwassets.tuftshealthplan.com/modules/contrib/graphql/assets/exp...)"
},
}

Proposed resolution

When I clear Drupal cache multiple times, not sure it suddenly starts working. Issue is bit strange but not sure why it's happening.

Remaining tasks

NA

User interface changes

NA

API changes

NA

Data model changes

NA

🐛 Bug report
Status

Needs work

Version

4.8

Component

Code

Created by

🇮🇳India pradeepjha

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

Comments & Activities

  • Issue created by @pradeepjha
  • 🇮🇳India pradeepjha

    It's breaking our prod site when GraphQL suddenly stops giving response. Lower environment it looks good. That's why increasing priority.

  • 🇺🇸United States cruno NJ

    Confirming that this is an issue we are also experiencing. We use graphql_compose to generate schema.

  • 🇬🇧United Kingdom james.south

    I need to debug further but I'm observing the same behaviour on a site with GraphQL 8.x-4.9 and GraphQL Compose 2.2.1.

    In our case all queries fail until the cache is rebuilt (a single cache clear consistently fixes the issue temporarily). Issue is sporadic and we haven't identified a consistent trigger for it.

  • 🇮🇳India shabana.navas

    We're running GraphQL 8.x-4.8 and are seeing the same issue w/ GraphQL queries not working after each deploy to production. We don't use GraphQL Compose.

    A query to get the Commerce Orders in the GraphQL explorer, returns errors like this:

    {
        "errors": [
            {
                "message": "Cannot query field \u0022derivative\u0022 on type \u0022FieldItemTypeImage\u0022.",
                "extensions": {
                    "category": "graphql"
                },
                "locations": [
                    {
                        "line": 88,
                        "column": 25
                    }
                ]
            },
            {
                "message": "Cannot query field \u0022derivative\u0022 on type \u0022FieldItemTypeImage\u0022.",
                "extensions": {
                    "category": "graphql"
                },
                "locations": [
                    {
                        "line": 121,
                        "column": 25
                    }
                ]
            },
    ...
    

    After clearing cache a couple of more times, it starts working again.

  • 🇧🇪Belgium matthieu_collet

    Any update on this error ?
    We suddenly have it too since this morning, our production site is broken, and clear cache doesn't solve anything :(

  • 🇧🇪Belgium davidiio

    Hello,

    We face the same issue here once with an apdated site (we restored backups to make it work again) and now we face it with a new dev website with Drupal 11.1.5 and GraphQL 8.x-4.11 and Graphql_compose 2.3.0.

    We noticed this error GraphQL\Error\SyntaxError : Syntax Error: Cannot parse the unexpected character "\uc9". dans GraphQL\Language\Lexer->readToken()

    And realized that this bug happend only after translation updates, if we revert our prod site, enable a new module that updates translation we have this bug again.
    Are any of you using multilingual sites? Maybe this is a lead to find out what is wrong here?

  • 🇧🇪Belgium davidiio

    After some disabling and enabling of graphQL and GraphQL Compose and returning to the explorer page between modifications we also notice that unticking the "Enable Singuliarize" checkbox in the "String inflector" tab of graphql_compose settings produces the same bug.
    Maybe this issue is a graphql_compose issue and not a graphql issue.

Production build 0.71.5 2024