Syntax Error: Expected Name, found }

Created on 26 December 2022, almost 2 years ago
Updated 21 November 2023, about 1 year ago

Problem/Motivation

GraphQL\Error\SyntaxError: Syntax Error: Expected Name, found } in GraphQL\Language\Parser->expect() (line 366 of /opt/vendor/webonyx/graphql-php/src/Language/Parser.php).

> Drupal 9.5.0
> php 8.1

Steps to reproduce

1. Uninstall graphql version 3.1
2. Install graphql version 4.4
3. Install graphql_core_schema version 1.0.0 beta 3
4. Created graphql server with endpoint http://localhost/graphql
6. Getting error on Explorer page.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine alex.mazaltov

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡­Switzerland dulnan

    I have fixed this (and other similar issues). They happened because by default, if no extensions are enabled, there are no fields on the Query type. This results in the following (invalid) schema:

    type Schema {
      query: Query
    }
    
    type Query
    

    The module now implements a ping query and mutation by default, so that it's not possible anymore to generate a schema with empty Query or Mutation types.

  • πŸ‡¨πŸ‡­Switzerland ayalon

    This will be part of the 1.0.0-beta5 release.

  • Status changed to Fixed almost 2 years ago
  • πŸ‡¨πŸ‡­Switzerland ayalon
  • πŸ‡©πŸ‡ͺGermany Naitschi

    Hello the Error occurs again:

    GraphQL\Error\SyntaxError: Syntax Error: Expected Name, found } in GraphQL\Language\Parser->expect() (line 366 of /var/www/html/vendor/webonyx/graphql-php/src/Language/Parser.php).

    I reproduced it like mentioned in "Steps to reproduce" in the Issue.

    Versions:
    Drupal 10.1.6
    Graphql 4.6
    graphql_core_schema 1.0.0-beta7

Production build 0.71.5 2024