apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.38k stars 2.66k forks source link

networkInterface.use is not a function #2013

Closed groundmuffin closed 7 years ago

groundmuffin commented 7 years ago

Intended outcome: When using ApolloClient on full WebSocket transport, the subscriptions-transport-ws\SubscriptionClient instance is used as client's networkInterface. Trying to use Apollo Client with middleware and networkInterface.use() Followed instructions from http://dev.apollodata.com/core/network.html#networkInterfaceMiddleware

Actual outcome: The problem is when AppolloClient constructor applies networkInterface config to 'this' instance, it assigns config properties to some empty object, but prototype properties are ignored. It results, for example, to networkInterface "use" method is not applied to client's networkInterface.

So, we got Warning: ApolloClient.js:106 The Observable Network interface will be deprecated Error: networkInterface.use is not a function

How to reproduce the issue:

Version

danieljvdm commented 7 years ago

Is this live in any version? It's still happening with the latest react-apollo.