You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm running a Meteor/React/Apollo/Graphql stack and I'm trying to get subscriptions working, I've looked through the Apollo docs and have tried to get it working with this library but I'm getting an error in my Graphiql console as such:
{
"error": "Could not connect to websocket endpoint ws://XXX.XXX.XX.XX:3000/subscriptions. Please check if the endpoint url is correct."
}
My server code is as follows:
import { ApolloServer, gql } from "apollo-server-express"
import { makeExecutableSchema } from "graphql-tools"
import { WebApp } from "meteor/webapp"
import { getUser } from "meteor/apollo"
import merge from "lodash/merge"
import SchemaA from "../../api/a/SchemaA.graphql"
import ResolverA from "../../api/a/resolvers"
import SchemaB from "../../api/b/SchemaB.graphql"
import ResolverB from "../../api/b/resolvers"
import SchemaC from "../../api/c/SchemaC.graphql"
import ResolverC from "../../api/c/resolvers"
import { GooglePubSub } from "@axelspringer/graphql-google-pubsub"
const pubsub = new GooglePubSub()
const typeDefs = [SchemaA, SchemaB, SchemaC]
const resolvers = merge(ResolverA, ResolverB, ResolverC)
const schema = makeExecutableSchema({ typeDefs, resolvers })
const server = new ApolloServer({
schema,
context: async ({ req }) => ({
user: await getUser(req.headers.authorization),
pubsub
}),
subscriptions : {
path: '/subscriptions'
}
})
server.applyMiddleware({
app: WebApp.connectHandlers,
path: "/graphql",
})
WebApp.connectHandlers.use("/graphql", (req, res) => {
if (req.method === "GET") {
res.end()
}
})
I had initially tried this exact setup with the Redis pubsub alternative but I was getting the following error in my terminal:
I'm not getting this error anymore with GooglePubSub, but the first error thrown in Graphiql still persists. Does anyone have any recommendations on how to go about fixing this? There's clearly some configuration/setup which I'm not doing correctly.
The text was updated successfully, but these errors were encountered:
Hi, I'm running a Meteor/React/Apollo/Graphql stack and I'm trying to get subscriptions working, I've looked through the Apollo docs and have tried to get it working with this library but I'm getting an error in my Graphiql console as such:
My server code is as follows:
I had initially tried this exact setup with the Redis pubsub alternative but I was getting the following error in my terminal:
I'm not getting this error anymore with GooglePubSub, but the first error thrown in Graphiql still persists. Does anyone have any recommendations on how to go about fixing this? There's clearly some configuration/setup which I'm not doing correctly.
The text was updated successfully, but these errors were encountered: