question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Argument of #import passed to parser was not a valid GraphQL DocumentNode

See original GitHub issue

document is the raw file plain text. which throws


query PersonQuery(
  $id: ID!
) {
  person(id: $id) {
    ...personFragment
  }
}
 passed to parser was not a valid GraphQL DocumentNode. You may need to use 'graphql-tag' or another method to convert your operation into a document

parser
    react-apollo.browser.umd.js:229:4
graphql
    react-apollo.browser.umd.js:374:20
<unknown>
    index.js:12:10
loadModuleImplementation
    require.js:212:4
guardedLoadModule
    require.js:146:11
_require
    require.js:130:2
<unknown>
    registerScreens.js:3
loadModuleImplementation
    require.js:212:4
guardedLoadModule
    require.js:146:11
  function parser(document) {
    var variables, type, name
    invariant$2(
      !!document && !!document.kind,
      'Argument of ' +
        document +
        " passed to parser was not a valid GraphQL DocumentNode. You may need to use 'graphql-tag' or another method to convert your operation into a document"
    )

screen shot 2018-03-09 at 11 55 27 am

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
james-ffcommented, Mar 9, 2018

Just applied one of the caveats: “Applying changes to GraphQL files” and it seems to have fixed it (might have been reloading the project etc that fixed it, probably one of the two).

tldr: It seems fixed for me now =]

1reaction
james-ffcommented, Mar 9, 2018

@detrohutt Thanks for the ping! Just a note: bable-plugin-inline-import-graphql-ast@^2.3.2 should be babel-plugin-inline-import-graphql-ast@^2.3.2 I got a 404 and took me a while to realise why =P

Read more comments on GitHub >

github_iconTop Results From Across the Web

Argument of undefined passed to parser was not a valid ...
I do import graphQL query as: import {getStudents} from'./../graphql/Queries.graphql' Queries.graphql file: query getStudents($schoolID: ...
Read more >
passed to parser was not a valid GraphQL DocumentNode ...
No need to add graphql. import gql from 'graphql-tag'; const listMessages = gql query listMessages { listMessages { id text createdAt sentBy ...
Read more >
passed to parser was not a valid GraphQL DocumentNode ...
Coding example for the question passed to parser was not a valid GraphQL DocumentNode.you ... import gql from 'graphql-tag'; const listMessages = gql...
Read more >
Argument of undefined passed to parser was not a valid ...
Argument of undefined passed to parser was not a valid GraphQL DocumentNode. ... I do import graphQL query as: import {getStudents} from'.
Read more >
Compiling queries with Babel - Apollo GraphQL Docs
Now any import statements importing from a GraphQL file type will return a ready-to-use GraphQL DocumentNode object. JavaScript.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found