apollographql / meteor-integration

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

Does optics code break context? #61

Closed lorensr closed 7 years ago

lorensr commented 7 years ago

reported by @davidboom95

Hi, it seems this code breaks the meteor context, it should pass context.userId and context.user, when I try to reverse changes, context is still undefined. I tried meteor reset, and re-install apollo-server but it does not work

https://github.com/apollostack/meteor-integration/issues/47#issuecomment-271150413

lorensr commented 7 years ago

Hey @davidboom95 I'm not sure why this is happening. If you'd like to try debugging, here is where the first function arg of createApolloServer is called:

https://github.com/apollostack/meteor-integration/blob/master/main-server.js#L52

and then the user data is added to that options variable further down.

davidboom95 commented 7 years ago

Hi.

This is my req.headers.authorization when I debug main-server.js, conclusion, header is not even passing from the client, but I dont know why. I use apollo-react, graphql-tools and apollo-client.

headers: Object
accept: "*/*"
accept-encoding: "gzip, deflate, br"
accept-language: "es,es-419;q=0.8,en;q=0.6,gl;q=0.4,fr;q=0.2"
connection: "keep-alive"
content-length: "142"
content-type: "application/json"
host: "localhost:3000"
origin: "http://localhost:3000"
referer: "http://localhost:3000/"
user-agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36"
x-forwarded-for: "127.0.0.1"
x-forwarded-port: "3000"
x-forwarded-proto: "http"

I tried to debug the main-client.js file but I cant enter the applyMiddleware function, even with debugger.

Graphiql passes the meteor auth token header. My react query doesnt

Safari Console: Refused to connect to ws://localhost:3000/sockjs/159/nkw8_y8m/websocket because it does not appear in the connect-src directive of the Content Security Policy.

davidboom95 commented 7 years ago

I Found the problem

Double definition of Apollo Client, once inimport/ and once in redux reducers. Please... add a console warning or something when a double creation is made.

lorensr commented 7 years ago

On Mon, Jan 9, 2017 at 6:56 PM, davidboom95 notifications@github.com wrote:

add a console warning or something.

You could make this suggestion over at https://github.com/apollostack/apollo-client/issues

Glad you figured it out!