Problem/Motivation

ComposeConfig::config() declares a nullable return type (?ImmutableConfig). It returns null when ComposeContext::getServerId() cannot resolve the server —
which happens in any CLI/Drush context because there is no active HTTP route to extract the graphql_server parameter from.

Steps to reproduce

  1. Have graphql_compose with graphql_export enabled
  2. Run drush graphql-export:schema or drush config:export
  3. Observe the fatal error

Proposed resolution

Add a guard clause at the top of registerResolvers():

  $settings = ComposeConfig::config();
  if (!$settings) {
    return;
  }
  
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

cedricl created an issue. See original summary.

cedricl’s picture

Status: Needs work » Closed (won't fix)

Actually this won't fix the entire problem. Real issue is here: https://www.drupal.org/project/graphql_compose/issues/3592509

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.