Is it normal that the context
function of apollo-server-express
is constantly executed in an interval?
const server = new ApolloServer({
typeDefs,
resolvers,
context: ({ event, context, express }) => {
console.log('context')
}
})
I can see a new log output in the console every 2 seconds or so.
Cheers
Do you have playground open and running introspection against your graph at an interval? (it does this by default)
1 Like
OMG, you are right @trevor.scheer
Yes, I use the Graphql Playground and as soon as I stopped it, the invocation of the context
function stopped as well.
Thanks for the clarification.
2 Likes
Bobby
June 28, 2022, 7:06pm
4
Thanks @trevor.scheer , this answer is also very helpful to me!
1 Like
Same issue, in my case i must not close the playground because im trying to log in my user in playground by supplying the arguments.
in my case obviously i cannot continue due to this context continous running
try to authenticate the user, in my case because im not yet log in, i cannot get the access token result upon successful log in, and it gives me invalid access token as the context continiously executing
This is a setting you can configure in the UI or in your playground settings.
const server = new ApolloServer({
// ... your other settings here
playground: {
settings: {
"schema.polling.enable": false,
}
}
});
While I’m here, I recommend upgrading to Apollo Server v3 and trying out Explorer. More info on our server landing pages can be found here: API Reference: Landing page plugins - Apollo GraphQL Docs
hi, I want to know how to trigger a function when the subscription starts in the apollo server. I mean when the listener stared?
I don’t see how your question pertains to this topic, can you please ask a new question?