graphql / graphql-playground

🎮 GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration)
MIT License
8.77k stars 735 forks source link

Schema tab not working #1243

Closed EthanSK closed 4 years ago

EthanSK commented 4 years ago

This issue pertains to the following package(s):

What OS and OS version are you experiencing the issue(s) on?

MacOS

What version of graphql-playground(-electron/-middleware) are you experiencing the issue(s) on?

1.7.23 , latest

What is the expected behavior?

Schema tab shows blank screen

What is the actual behavior?

It should show the schema

brandondoran commented 4 years ago

I'm seeing this too with the graphql-playground-middleware-express. It looks it may be a problem with prettier.

Screen Shot 2020-06-22 at 9 55 43 AM
joffrey-bion commented 4 years ago

Same problem here. In my case I had this error: image

I think it may be linked to this issue: https://github.com/prisma-labs/graphql-playground/issues/1115

A workaround is to set schema.disableComments to false in the playground settings (cog in the top-right hand corner).

benkimball commented 4 years ago

I'm also seeing this behavior, and the workaround @joffrey-bion mentions fixes it for me.

Here's the syntax error it's throwing:

Uncaught SyntaxError: Syntax Error: Unexpected Name "now" (5:3)
  3 | 
  4 |   
> 5 |   now: DateTime
    |   ^
  6 | 
  7 |   
  8 |   me: User!
    at n (parser-graphql.js:1)
    at Object.parse (parser-graphql.js:1)
    at Object.parse (standalone.js:13721)
    at coreFormat (standalone.js:17145)
    at format (standalone.js:17381)
    at formatWithCursor (standalone.js:17397)
    at standalone.js:32917
    at Object.format (standalone.js:32926)
    at Object.prettify (utils.js:184)
    at Object.getSDL (createSDL.js:105)

Here's the part of my schema that is failing inside prettier-graphql.js:

#
directive @cacheControl(
  maxAge: Int
  scope: CacheControlScope
) on FIELD_DEFINITION | OBJECT | INTERFACE
#
type Query {
  # Retrieve the current server time in UTC.
  now: DateTime
}
acao commented 4 years ago

dupe, fixed in last release