apollographql / meteor-integration

🚀 meteor add apollo
http://dev.apollodata.com/core/meteor.html
108 stars 45 forks source link

Error with context #101

Closed cbilotta closed 7 years ago

cbilotta commented 7 years ago

Hello, I have this error on every request when the user is not authenticated...

[Meteor Apollo Integration] Something bad happened when handling a request on the GraphQL server. Your GraphQL server is not working as expected: [ReferenceError: context is not defined]

What can I do about it ?

cbilotta commented 7 years ago

I found that I'm supposed to do this to ensure that context is defined :

createApolloServer({ schema, context: {}, });

But it doesn't change a thing... :(

By the way, it works completely fine when I'm connected.

xavxyz commented 7 years ago

Thanks @iRayzer for opening an issue! 👍

Which version of meteor/apollo do you use? v0.9.0? That may be related to this line.

Let me publish a patch.

carlosbergfeld commented 7 years ago

And out of curiosity, tests don't catch that because context is a global variable in Mocha's BDD interface.

cbilotta commented 7 years ago

Yes I'm on 0.9.0 :)

Thanks for your help!

xavxyz commented 7 years ago

0.9.1 published! It should be better @iRayzer!

@carlosbergfeld yeah just noticed that! I was wtf the context is 😨 :

{ [Function] skip: [Function], only: [Function] }
cbilotta commented 7 years ago

Yes it works! Thanks a lot!