apollo-link-logger icon indicating copy to clipboard operation
apollo-link-logger copied to clipboard

When used with apollo-link-ws it throws error for apolloLogger

Open schavaLogi opened this issue 7 years ago • 2 comments

  • apollo-link-logger version: ^1.2.3
  • node version: v8.9.3
  • npm (or yarn) version: yarn 1.6.0

Relevant code or config

      const webSocketLink = from(webSocketChain);
      this.linkWS = split() // to decide HTTP or WS

What you did: Added apollo-logger before wsLink in chain

What happened: TypeError: forward(...).map is not a function

schavaLogi avatar Aug 30 '18 15:08 schavaLogi

This issue still exists. It happens when you have mutations and queries running in WS

veeramarni avatar Nov 16 '18 21:11 veeramarni

same here; took me a while to find the culprit. In detail, I have a setup like this:

const link = from([
  stateLink,  // withClientState(...)
  errorLink,  // onError(...)
  ...(__DEV__ ? [apolloLogger] : []),  // <-- removing this fixes the error
  split(
    ({ query }) => {
      const { kind, operation } = getMainDefinition(query);
      return kind === 'OperationDefinition' && operation === 'subscription';
    },
    wsLink,  // new new WebSocketLink(...)
    httpLink,  // new new HttpLink(...)
  ),
]);

and I use subscribeToMore somewhere. Result is TypeError: forward(...).map is not a function and the subscription not working.

SillyFreak avatar Apr 18 '19 12:04 SillyFreak