Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I don't know error in which line from error message #506

Closed
tokisakiyuu opened this issue Jun 2, 2021 · 7 comments · Fixed by #510
Closed

I don't know error in which line from error message #506

tokisakiyuu opened this issue Jun 2, 2021 · 7 comments · Fixed by #510

Comments

@tokisakiyuu
Copy link

package version: 0.18.1

[ graphql-let ] Processing 2 codegen...
[ graphql-let ] Syntax Error: Expected Name, found "}".
GraphQLError: Syntax Error: Expected Name, found "}".
    at syntaxError (/Applications/myspace/projects/writa-next/node_modules/graphql/error/syntaxError.js:15:10)
    at Parser.expectToken (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:1413:40)
    at Parser.parseName (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:98:22)
    at Parser.parseField (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:295:28)
    at Parser.parseSelection (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:284:81)
    at Parser.many (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:1523:26)
    at Parser.parseSelectionSet (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:271:24)
    at Parser.parseOperationDefinition (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:199:26)
    at Parser.parseDefinition (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:137:23)
    at Parser.many (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:1523:26)
[ graphql-let ] Something went wrong
ListrError: Something went wrong
    at /Applications/myspace/projects/writa-next/node_modules/listr/index.js:102:18
    at async executeCodegen (/Applications/myspace/projects/writa-next/node_modules/@graphql-codegen/cli/index.cjs.js:917:5)
    at async Object.generate (/Applications/myspace/projects/writa-next/node_modules/@graphql-codegen/cli/index.cjs.js:1214:25)
    at async processGraphQLCodegen (/Applications/myspace/projects/writa-next/node_modules/graphql-let/dist/lib/codegen.js:139:19)
    at async Object.processCodegenForContext (/Applications/myspace/projects/writa-next/node_modules/graphql-let/dist/lib/codegen.js:169:12)
    at async gen (/Applications/myspace/projects/writa-next/node_modules/graphql-let/dist/gen.js:82:9)
@piglovesyou
Copy link
Owner

Thanks for submitting that @tokisakiyuu. True. I'm suspecting it's a syntax error of gql() argument. I'll improve it.

@piglovesyou
Copy link
Owner

v0.18.1 out

[ graphql-let ] Syntax Error: Expected "$", found Name "currency".
GraphQLError: Syntax Error: Expected "$", found Name "currency".
    at syntaxError (/xxx/node_modules/graphql/error/syntaxError.js:15:10)
...

v0.18.2 will out:

[ graphql-let ] /xxx/src/App.tsx; Syntax Error: Expected "$", found Name "currency".
In line 2, column 11 of the following source:
  query 
    rates(currency: "USD") {
      ...Partial
    }
  }

    at syntaxError (/xxx/node_modules/graphql/error/syntaxError.js:15:10)

@piglovesyou
Copy link
Owner

Please try v0.18.2 and tell me what you think.

@tokisakiyuu
Copy link
Author

v0.18.1 out

[ graphql-let ] Syntax Error: Expected "$", found Name "currency".
GraphQLError: Syntax Error: Expected "$", found Name "currency".
    at syntaxError (/xxx/node_modules/graphql/error/syntaxError.js:15:10)
...

v0.18.2 will out:

[ graphql-let ] /xxx/src/App.tsx; Syntax Error: Expected "$", found Name "currency".
In line 2, column 11 of the following source:
  query 
    rates(currency: "USD") {
      ...Partial
    }
  }

    at syntaxError (/xxx/node_modules/graphql/error/syntaxError.js:15:10)

that looks great, thank you

@tokisakiyuu
Copy link
Author

sorry, after upgrade to v0.18.2, I got same error message. but I found where is my wrong.

file: article.graphql :

# ...
query OneArticle($id: String, $shorthand: String!) {
    # the cause of the error is here is nothing write
}
# ...

command line :

yuu:writa-next zhaoliping$ npx graphql-let
[ graphql-let ] Processing 2 codegen...
[ graphql-let ] Syntax Error: Expected Name, found "}".
GraphQLError: Syntax Error: Expected Name, found "}".
    at syntaxError (/Applications/myspace/projects/writa-next/node_modules/graphql/error/syntaxError.js:15:10)
    at Parser.expectToken (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:1413:40)
    at Parser.parseName (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:98:22)
    at Parser.parseField (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:295:28)
    at Parser.parseSelection (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:284:81)
    at Parser.many (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:1523:26)
    at Parser.parseSelectionSet (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:271:24)
    at Parser.parseOperationDefinition (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:199:26)
    at Parser.parseDefinition (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:137:23)
    at Parser.many (/Applications/myspace/projects/writa-next/node_modules/graphql/language/parser.js:1523:26)

@piglovesyou
Copy link
Owner

Thank you @tokisakiyuu, it seems I missed another path that writes your message! I'll reopen it.

@piglovesyou
Copy link
Owner

piglovesyou commented Jun 12, 2021

v0.18.4 must print the exact wrong line like this. I've missed e.toString() API of GraphQLError😣

[ graphql-let ] Syntax Error: Expected Name, found "}".

/path/to/pages/viewer.graphql:7:1
6 | query Viewerx {
7 | }
  | ^
8 |
GraphQLError: Syntax Error: Expected Name, found "}".
    at syntaxError (/path/to/node_modules/graphql/error/syntaxError.js:15:10)
    at Parser.expectToken (/path/to/node_modules/graphql/language/parser.js:1413:40)
    at Parser.parseName (/path/to/node_modules/graphql/language/parser.js:98:22)
    at Parser.parseField (/path/to/node_modules/graphql/language/parser.js:295:28)
    at Parser.parseSelection (/path/to/node_modules/graphql/language/parser.js:284:81)
    at Parser.many (/path/to/node_modules/graphql/language/parser.js:1523:26)
    at Parser.parseSelectionSet (/path/to/node_modules/graphql/language/parser.js:271:24)
    at Parser.parseOperationDefinition (/path/to/node_modules/graphql/language/parser.js:199:26)
    at Parser.parseDefinition (/path/to/node_modules/graphql/language/parser.js:137:23)
    at Parser.many (/path/to/node_modules/graphql/language/parser.js:1523:26)
[ graphql-let ] ListrError: Something went wrong
ListrError: Something went wrong
    at /path/to/node_modules/listr/index.js:102:18
    at async executeCodegen (/path/to/node_modules/@graphql-codegen/cli/index.cjs.js:884:5)
    at async Object.generate (/path/to/node_modules/@graphql-codegen/cli/index.cjs.js:1181:25)
    at async processGraphQLCodegen (/path/to/node_modules/graphql-let/dist/lib/codegen.js:140:19)
    at async Object.processCodegenForContext (/path/to/node_modules/graphql-let/dist/lib/codegen.js:168:12)
    at async gen (/path/to/node_modules/graphql-let/dist/gen.js:82:9)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants