-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Apollo 3 Type Error with SubscriptionServer #5851
Comments
Hi @berkaey. It's definitely possible there's an error in our doc example that explains how to continue to use the unmaintained |
I also face same issue when the graphql is upgrades to v16.x with the latest graphql the support of execute and subscribe is depricated |
@glasser something like this helps? import { execute, GraphQLError, subscribe, TypeDefinitionNode } from "graphql";
import { SubscriptionServer } from "subscriptions-transport-ws";
// setup subscription server
this.apolloSubscrtipions = SubscriptionServer.create(
{
schema,
// @ts-ignore
execute,
// @ts-ignore
subscribe,
async onConnect(
connectionParams: Object,
webSocket: WebSocket,
context: any,
) {
if (this.onConnect) {
await this.clientDidConnect(connectionParams, webSocket, context);
}
this.log.info("CONNECTED");
return context;
},
async onDisconnect(webSocket: any, connectionContext: any) {
if (connectionContext) {
const context = await connectionContext.initPromise;
await this.clientDidDisconnect(
webSocket,
connectionContext,
context,
);
this.log.info("DISCONNECTED");
}
},
},
{
server: this.httpServer,
path: this.config.paths.graphqlSubscription,
},
); I had to use // @ts-ignore. |
My belief is that if you upgrade to the newly-released |
I'm trying to setup an Apollo 3 + Typescript project, when I follow the subscription example on docs, I'm getting these errors.
both execute and subscribe has different type on GraphQL package.
Btw, I'm importing those from
graphql
.Any suggestions?
The text was updated successfully, but these errors were encountered: