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

GraphiQL doesn't load documents (example queries) anymore (cli v0.64.0) #3739

Closed
JustusNBB opened this issue Mar 22, 2022 · 13 comments
Closed
Assignees

Comments

@JustusNBB
Copy link
Contributor

Describe the bug

When pressing "Play" in the GraphiQL Playground after mesh:start, it throws/shows

{  "errors": "Syntax Error: Unexpected <EOF>.\n\nGraphQL request:1:1\n1 |\n  | ^"}

To Reproduce
Steps to reproduce the behavior: Any sandbox with example queries should do:
e.g. JavaScript Wiki Example Sandbox

Expected behavior

It should run the default query (or select an example query) when pressing "Play"

Environment:

  • OS: irrelevant Sandbox
  • @graphql-mesh/cli: 0.63.0/0.64.0
  • NodeJS: 14/16

Additional context

It seems to be a new GraphiQL version, probably its config changed a bit(?).

@acao
Copy link

acao commented May 12, 2022

@JustusNBB I'm not able to reproduce this in the sandbox you linked to, perhaps this issue was addressed in the guild's fork of graphiql? would like to know how to address it in graphiql as well

@JustusNBB
Copy link
Contributor Author

JustusNBB commented May 13, 2022

@JustusNBB I'm not able to reproduce this in the sandbox you linked to, perhaps this issue was addressed in the guild's fork of graphiql? would like to know how to address it in graphiql as well

Can you please be more specific? When I open the sandbox I still get the error (mesh-cli is version 0.70.2 now).
I don't think graphql/graphiql#2399 is really related either, because it has a query and this is just about the preconfigured example queries having dissappeard.

image

documents:
  - example-queries/*.graphql

Documents are not loaded. It should allow two run the two queries in that folder.
E.g. here <untitled> should be viewsInPastMonth or views-in-past-month.graphql, and there should be a second tab in GraphiQL for the second query (wikipedia-metrics).

@JustusNBB
Copy link
Contributor Author

@TuvalSimha @dotansimha
Is it intended to start without the example queries in new playground tabs?

Querying does still work when using a query from the explorer (e.g.viewsInPastMonth), so this is not about querying somehow being broken.

the guild's fork of graphiql

Is there such a thing? That would explain why I don't recognise GraphiQL anymore. The tabs (which are empty instead of containing the example queries) look like they are from the Apollo Playground instead(?!).

At the beginning when I started, I could not decide between the playgrounds, that's why I have both GraphiQL as well as Apollo. The latter still works as expected, it is configured like this:

const { schema, meshContext } = await getBuiltMesh();

  const apolloServer = new ApolloServer({
    schema,
    context: meshContext,
    plugins: [
      ApolloServerPluginLandingPageGraphQLPlayground({
        tabs: [
          {
            endpoint: '/graphql',
            query: readFileSync(join(__dirname, './src/queries/productprice.example.graphql'), 'utf-8'),
          },
        ],
      })
    ]
  });

Please explain further plans for GraphiQL within GraphQL Mesh!

@JustusNBB
Copy link
Contributor Author

Bump, please give me a hint how I can help here?

@ardatan
Copy link
Owner

ardatan commented Jul 11, 2022

This is not an issue with GraphiQL. We stopped showing concatenated version of all defined operations in GraphiQL because it causes performance issues if you have too many operations.

@JustusNBB
Copy link
Contributor Author

JustusNBB commented Jul 12, 2022

This is not an issue with GraphiQL. We stopped showing concatenated version of all defined operations in GraphiQL because it causes performance issues if you have too many operations.

Ok makes sense, the preconfigured default query/queries should not be hundreds of lines...
But how do I preconfigure any query for the graphiql playground now?
https://www.graphql-config.com/docs/user/user-documents
I can't find my (example) queries in the explorer or schema either.

Can you give a reference to the referred code change please @ardatan, I'd like to have a look, maybe I have an idea to just impose arbitrary limits for query tabs (graphiql has new tabs right?), so existing document definitions will be shown again if not too long...

@Urigo Urigo mentioned this issue Aug 11, 2022
22 tasks
@JustusNBB
Copy link
Contributor Author

JustusNBB commented Sep 5, 2022

Seems this has been implemented/fixed again, as I now have a Tab with my Example Query within GraphiQL? (cli v77)

@ardatan ardatan closed this as completed Sep 5, 2022
@JustusNBB
Copy link
Contributor Author

JustusNBB commented Sep 9, 2022

Sorry for the misleading report, but that could also be the reason why it was/is difficult to reproduce - GraphiQL caches queries, so when you reopen with a query in the browser cache, it will be shown when reopening GraphiQL the next time.

The original issue persists, when I open the GraphiQL playground mesh dev (v0.77) inside an anonymous tab, there is no example query preconfigured.
Please reopen.

@ardatan
Copy link
Owner

ardatan commented Sep 9, 2022

The original issue persists, when I open the GraphiQL playground inside an anonymous tab, there is no example query preconfigured.

This is not an issue. It's been removed because it causes issues when a project has too many documents defined.

@JustusNBB
Copy link
Contributor Author

JustusNBB commented Sep 9, 2022

This is not an issue. It's been removed because it causes issues when a project has too many documents defined.

Then should I request a new feature instead, so I can define those Examples again under a different mesh config instead of considering this a regression (but it is still one for me :()?

What about the idea above to impose arbitrary limits instead?

@ardatan
Copy link
Owner

ardatan commented Sep 9, 2022

Maybe you can try contributing with a PR?

@JustusNBB
Copy link
Contributor Author

Yes that was what I was considering. But since I have redundancy with the Apollo Playground (updated my setup from the current examples), I'll rather be watching how you continue to develop GraphiQL instead of continueing this discussion (and finding arbitray limits that fit everyone, need code and other references...).

@JustusNBB
Copy link
Contributor Author

Another workaround:
Append the example query to the graphiql playground url, then it will show that query in the editor - so now example queries can be stored in URLs.

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

No branches or pull requests

4 participants