5.x fatal error creating new severs

Created on 16 July 2025, 11 days ago

Problem/Motivation

Create a new server, get fatal error

TypeError: Cannot assign string to property Drupal\graphql\Entity\Server::$query_depth of type ?int in Drupal\Core\Config\Entity\ConfigEntityBase->set() (line 173 of core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php).

Steps to reproduce

  1. /admin/config/graphql/servers/create
  2. Add label
  3. Add endpoint (eg /testing123)
  4. Click save

Proposed resolution

web/modules/contrib/graphql/src/Form/ServerForm.php
copyFormValuesToEntity()

  $form_state->setValue('query_depth', (int) $form_state->getValue('query_depth') ?: NULL);
  $form_state->setValue('query_complexity', (int) $form_state->getValue('query_complexity') ?: NULL);

query_depth and query_complexity should possibly be nullable in the schema yml also?

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

5.0

Component

Code

Created by

🇦🇺Australia almunnings Melbourne, 🇦🇺

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

Comments & Activities

  • Issue created by @almunnings
  • First commit to issue fork.
  • @ankitv18 opened merge request.
Production build 0.71.5 2024