urql-graphql / urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
https://urql.dev/goto/docs
MIT License
8.54k stars 444 forks source link

Syntax Error: Unexpected token in SelectionSet #3554

Closed gineika closed 3 months ago

gineika commented 3 months ago

Describe the bug

import { gql } from 'urql'

gql`
  {
    user: getUser (id: 1) {
      id
    }
  }
`
GraphQLError: Syntax Error: Unexpected token at 23 in SelectionSet
      at new GraphQLError (/node_modules/.pnpm/@0no-co+graphql.web@1.0.5/node_modules/@0no-co/graphql.web/dist/graphql.web.js:7:5)
      at error (/node_modules/.pnpm/@0no-co+graphql.web@1.0.5/node_modules/@0no-co/graphql.web/dist/graphql.web.js:53:10)
      at selectionSet (/node_modules/.pnpm/@0no-co+graphql.web@1.0.5/node_modules/@0no-co/graphql.web/dist/graphql.web.js:404:13)
      at operationDefinition (/node_modules/.pnpm/@0no-co+graphql.web@1.0.5/node_modules/@0no-co/graphql.web/dist/graphql.web.js:522:21)
      at document (/node_modules/.pnpm/@0no-co+graphql.web@1.0.5/node_modules/@0no-co/graphql.web/dist/graphql.web.js:743:31)
      at parse (/node_modules/.pnpm/@0no-co+graphql.web@1.0.5/node_modules/@0no-co/graphql.web/dist/graphql.web.js:752:5)
      at keyDocument (/node_modules/.pnpm/@urql+core@5.0.0/node_modules/@urql/core/dist/urql-core-chunk.js:289:30)
      at gql (/node_modules/.pnpm/@urql+core@5.0.0/node_modules/@urql/core/dist/urql-core.js:263:18)
      at /test.mjs:3:1

Urql version

urql v4.0.7

Works with urql v4.0.6 AND @0no-co/graphql.web v1.0.4

Validations

kitten commented 3 months ago

Hiya 👋 Thanks for the prompt report! As far as I can tell, this seems to be a small regression in graphql.web@1.0.5 with field arguments after an aliased field name not respecting ignored tokens.

This should be fixed with the hotfix I just published with @0no-co/graphql.web@1.0.6