Problem/Motivation

After updating from 2.1.0-beta1 to 2.1.0-beta4, when i tried to access my endpoint or use the explorer i got the following warning.

Warning: Undefined array key "extensions" in Drupal\graphql\Plugin\GraphQL\Schema\ComposableSchema->getExtensions() (line 34 of /app/cms/web/modules/contrib/graphql/src/Plugin/GraphQL/Schema/ComposableSchema.php)
And following error
TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in array_filter() (line 34 of /app/cms/web/modules/contrib/graphql/src/Plugin/GraphQL/Schema/ComposableSchema.php).

Might be related to https://github.com/drupal-graphql/graphql/issues/1395.

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.

abhishek_gupta1’s picture

Assigned: Unassigned » abhishek_gupta1

abhishek_gupta1’s picture

Assigned: abhishek_gupta1 » Unassigned
Status: Active » Needs review

@CedricL, I have fixed the issue and created MR. please review it once

almunnings’s picture

Not sure thats it, `getDefinitions` should always return an array. I feel we have a bigger issue with merging non graphql_compose schemas into the final result.

Hmm.
I booted up a little external schema using the graphql SdlSchemaExtensionPluginBase, and it worked.

@cedric do you have any custom SchemaExtension plugins?
What base classes are you extending?

almunnings’s picture

Ok, it probably boils down to...
$this->getConfiguration()['extensions']

I'll take a look deeper there tonight after everyone goes to bed :)

There was some schema changes upstream in GraphQL which I had to try work with.

Can you try going to the GraphQL schema in the GraphQL admin interface, and just clicking "save" ?

Eg URL: /admin/config/graphql/servers/manage/YOUR-CORE-ID

almunnings’s picture

If I put in a sneaky little dump($this->getConfiguration()); in web/modules/contrib/graphql/src/Plugin/GraphQL/Schema/ComposableSchema.php in the method getExtensions

I get the following:

  /**
   * {@inheritdoc}
   */
  protected function getExtensions() {

    dump($this->getConfiguration());

    return array_map(function ($id) {
      return $this->extensionManager->createInstance($id);
    }, array_filter($this->getConfiguration()['extensions']));
  }
 array:2 [▼
  "extensions" => array:16 [▼
    0 => "graphql_compose_entity_schema_extension"
    1 => "graphql_compose_language_schema_extension"
    2 => "graphql_compose_information_schema_extension"
    3 => "graphql_compose_blocks_schema_extension"
    4 => "graphql_compose_comments_schema_extension"
    5 => "graphql_compose_edges_schema_extension"
    6 => "graphql_compose_image_style_schema_extension"
    7 => "graphql_compose_layout_builder_schema_extension"
    8 => "graphql_compose_layout_paragraphs_schema_extension"
    9 => "graphql_compose_layout_schema_extension"
    10 => "graphql_compose_menus_schema_extension"
    11 => "graphql_compose_metatags_schema_extension"
    12 => "graphql_compose_preview"
    13 => "graphql_compose_route_schema_extension"
    14 => "graphql_compose_views_schema_extension"
    15 => "example_extension"
  ]
  "enabled" => true
]

What do you get? (Plugin IDs might vary between dev and beta4)

And I guess like the obvious one, did you try clear cache?

almunnings’s picture

Looks like its the schema changes.

schema_configuration: {}

Should be

schema_configuration:
  graphql_compose:
    enabled: true

I'll create an update function to check for graphql compose schemas and update that.

almunnings changed the visibility of the branch 3441242-undefined-array-key to hidden.

almunnings’s picture

@CedricL Please pull dev at hash, or apply patch

https://git.drupalcode.org/project/graphql_compose/-/commit/3377d6294360...

Let me know if that is fixed after running drush updatedb or the database updates via the Drupal UI.

Thanks!

(For anyone else, just re-saving the server config page should fix this)

cedricl’s picture

Status: Needs review » Reviewed & tested by the community

The patch file fixed the issue. Thanks for the fast responses.

almunnings’s picture

Sweet. The update will rerun next release due to a number change, but glad that’s the issue found.

Will push up b5 now.

almunnings’s picture

Status: Reviewed & tested by the community » Fixed

Tagged and released

Thanks all

almunnings’s picture

Status: Fixed » Closed (fixed)