rivantsov / ngraphql

GraphQL .NET Server and Client
MIT License
43 stars 5 forks source link

Empty schema #14

Closed jasonlaw closed 3 years ago

jasonlaw commented 3 years ago

@rivantsov ,

May I know what should I check if the schema cannot be shown in the GraphiQL or Altair? There is no error and I can't figure out what is going wrong.

Thanks.

rivantsov commented 3 years ago

they should fire introspection query. Set the breakpoint in GraphQLHttpServer.HandleGraphQLHttpRequestAsync, and trace step by step, see if exception is thrown. if breakpoint is not hit, start up Fiddler and see if request goes out, check URL, check endpoint URLs in setup. and check console log in browser (F12); it might be CORS by the way, see if there's pre-flight query and response. Did you setup CORS in Asp.NET core startup?

jasonlaw commented 3 years ago

I didn't setup CORS. From the debugging, it seems never goes into the handle schema document, what could be wrong?

image

rivantsov commented 3 years ago

no, it's not this point; /schema returns SchemaDoc, readable doc for humans; Tools like Graphiql use introspection query, smth like query { _types {name}}

jasonlaw commented 3 years ago

Thanks for the swift reply. I have just found the issue, I am missing an output type, surprisingly the framework doesn't complaint that. After registering the output type, is working now. Thanks.

jasonlaw commented 3 years ago

To be precise, I have wrongly registered the output type as input type.

rivantsov commented 3 years ago

hm.. interesting.. will have a look later, currently busy with some urgent stuff at work

rivantsov commented 3 years ago

could not repro it. It might be gone after refactoring. Let me know if you can repro it with new code

jasonlaw commented 3 years ago

can't reproduce with new code, probably fixed already. closing now, thanks!