Error: The GraphQL schema is not provided (Express)
amerikan opened this issue · comments
Screenshot
Expected Behaviour
I followed the recipe from https://github.com/graphql/graphql-http#recipes for migration from express-graphql
. When I run the server I would expect it to work as with express-graphql (no errors).
Actual Behaviour
When starting the server I get:
0|www | Internal error occurred during request handling. Please check your implementation. Error: The GraphQL schema is not provided
0|www | at handler (/Users/e/Desktop/projects/my/node_modules/graphql-http/lib/handler.js:202:23)
0|www | at processTicksAndRejections (node:internal/process/task_queues:96:5)
0|www | at async requestListener (/Users/e/Desktop/projects/my/node_modules/graphql-http/lib/use/express.js:28:34)
Debug Information
Help us debug the bug?
Further Information
Using:
graphql-http 1.7.0
@graphql-tools/schema 9.0.4
to create my schema (is this not supported?)
Hey thanks for reporting. Can you please share your server implementation code? Are you sure you're providing a schema?
@enisdenjo noticed that I was using a callback with express-graphql
and it had been working. However, that way it doesn't work with graphql-http
since it's not a valid argument as it seems to expect an object.
graphqlHTTP((req) => ({
schema
}));
graphqlHTTP({
schema
});
At least now I know what's the problem and it's on my end.