-
Notifications
You must be signed in to change notification settings - Fork 23
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
type mismatch #89
Comments
I can't seem to replicate. Could you share your code, or even better, a reproduction? |
Thank you! The error happens because you're setting |
It looks like your |
I just had the same error and I fixed it by duplicating the context type definition of my server as follows: // v-- previously always been there
const apolloServer = new ApolloServer<GraphQLContext>({
// ...
});
// v-- has to be added explicitly now
const handler = startServerAndCreateNextHandler<NextRequest, GraphQLContext>(apolloServer, {
context: createGraphQLContext
}); My error message was that |
Thank you! I've managed to reproduce it. With API Routes it seems you don't need to pass the context type to the handler, but if you're using context with Route Handlers you'll need to specify both the request type and the context type. Since we're using the same handler for both API Routes and Route Handlers I don't think we can make it so you don't need to pass the context type, but what we can do is add a note to the README explaining it's necessary. |
const handler = startServerAndCreateNextHandler(server, { context: async req => ({ req }) });
In typescript:
--> ApolloServer is not assignable to type ApolloServer
Another thing is,
return handler required two parameters
The text was updated successfully, but these errors were encountered: