Validator: Undefined array key "server_id"

Created on 16 July 2025, 11 days ago

Problem/Motivation

Warning: Undefined array key "server_id" in Drupal\graphql\Plugin\GraphQL\Schema\SdlSchemaPluginBase->getCacheId() (line 312 of modules/contrib/graphql/src/Plugin/GraphQL/Schema/SdlSchemaPluginBase.php).

Drupal\graphql\Plugin\GraphQL\Schema\SdlSchemaPluginBase->getCacheId() (Line: 190)
Drupal\graphql\Plugin\GraphQL\Schema\SdlSchemaPluginBase->getSchemaDocument() (Line: 131)
Drupal\graphql\Plugin\GraphQL\Schema\SdlSchemaPluginBase->getSchema() (Line: 65)
Drupal\graphql\GraphQL\Validator->getMissingResolvers() (Line: 94)
Drupal\graphql\Controller\ValidationController->report()

Steps to reproduce

Error reporting on in PHP

Visit /admin/config/graphql/servers/manage/sadasdads/validate

Proposed resolution

src/GraphQL/Validator.php
getSchemaPlugin()

is missing the server_id bootstrapping.

  private function getSchemaPlugin(ServerInterface $server) : SchemaPluginInterface {
    $schema_name = $server->get('schema');
    $plugin_config = ['server_id' => $server->id()];
    /** @var \Drupal\graphql\Plugin\SchemaPluginInterface $plugin */
    $plugin = $this->pluginManager->createInstance($schema_name);
    if ($plugin instanceof ConfigurableInterface && $config = $server->get('schema_configuration')) {
      $schema_config = $config[$schema_name] ?? [];
      $plugin->setConfiguration($schema_config + $plugin_config);
    }

    return $plugin;
  }

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024