Fatal Error in latest alpha

Created on 18 August 2025, 11 days ago

Problem/Motivation

The latest alpha release has an assignment error which causes a fatal PHP error:
PHP Fatal error: Uncaught TypeError: Cannot assign null to property Drupal\graphql\Entity\Server::$query_depth of type int in /app/docroot/core/lib/Drupal/Core/Entity/EntityBase.php:63

Steps to reproduce

  1. Install latest alpha release
  2. Try to clear cache - via drush or UI
  3. Get fatal error warning

I'm running Drupal 10.5.2 on PHP 8.3.15

πŸ› Bug report
Status

Active

Version

5.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States superfluousapostrophe

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

Comments & Activities

  • Issue created by @superfluousapostrophe
  • πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna

    Thanks for reporting!

    I had the same problem in our installation because the 2 int properties were missing in our graphql entity server config:

    query_depth: 20
    query_complexity: 0
    

    I wrote a custom update function to work around that:

    /**
     * Set the missing query_depth and query_complexity values.
     */
    function jobiqo_graphql_update_10103(): void {
      \Drupal::configFactory()
        ->getEditable('graphql.graphql_servers.jobiqo_schema')
        ->set('query_depth', 20)
        ->set('query_complexity', 0)
        ->save();
    }
    

    The int values were introduced in πŸ› 5.x fatal error creating new severs Active .

    We have 2 options to solve this:
    1. Implement constructor on the Server entity and always cast those 2 to int
    2. Write an update function to update all graphql server entities that miss those 2 properties, where they are not int.

    I'm inclined to go with option 2, so that we don't have to maintain workaround code in the constructor.

  • πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna
  • πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna
  • @klausi opened merge request.
  • πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna

    merge request created.

  • πŸ‡ΊπŸ‡¦Ukraine andriy khomych

    Thanks, Klausi. Looks good to me.

  • πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna

    Merged.

  • πŸ‡¦πŸ‡ΉAustria klausi πŸ‡¦πŸ‡Ή Vienna
    • klausi β†’ committed 21b5d37f on 5.x
      fix(server): Fix error when query_depth or query_complexity is not...
  • πŸ‡ΊπŸ‡ΈUnited States superfluousapostrophe

    This is still happening for me with alpha3. I initially thought it was the same issue as before, but now it seems to only happen when I try to clear the views cache (or as part of a drush cr command)

    For what it's worth, I am getting a success message for the views cache being cleared, but then the error prints out immediately after.

    Here's my full stack trace:

    TypeError: Cannot assign null to property Drupal\graphql\Entity\Server::$query_depth of type int in /app/docroot/core/lib/Drupal/Core/Entity/EntityBase.php on line 63 #0 /app/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(112): Drupal\Core\Entity\EntityBase->__construct(Array, 'graphql_server')
    #1 /app/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(418): Drupal\Core\Config\Entity\ConfigEntityBase->__construct(Array, 'graphql_server')
    #2 /app/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(186): Drupal\Core\Entity\EntityStorageBase->mapFromStorageRecords(Array)
    #3 /app/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(312): Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple(NULL)
    #4 /app/docroot/modules/contrib/graphql/src/RouteProvider.php(45): Drupal\Core\Entity\EntityStorageBase->loadMultiple()
    #5 [internal function]: Drupal\graphql\RouteProvider->routes()
    #6 /app/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php(146): call_user_func(Array)
    #7 /app/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php(210): Drupal\Core\Routing\RouteBuilder->rebuild()
    #8 /app/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php(222): Drupal\Core\Routing\RouteBuilder->rebuildIfNeeded()
    #9 /app/docroot/core/lib/Drupal/Core/DrupalKernel.php(723): Drupal\Core\Routing\RouteBuilder->destruct()
    #10 /app/vendor/drush/drush/src/Boot/DrupalBoot8.php(314): Drupal\Core\DrupalKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse))
    #11 [internal function]: Drush\Boot\DrupalBoot8->terminate()
    #12 {main}
    TypeError: Cannot assign null to property Drupal\graphql\Entity\Server::$query_depth of type int in Drupal\Core\Entity\EntityBase->__construct() (line 63 of /app/docroot/core/lib/Drupal/Core/Entity/EntityBase.php).
    
    
Production build 0.71.5 2024