apollo-link-logger
apollo-link-logger copied to clipboard
When used with apollo-link-ws it throws error for apolloLogger
apollo-link-loggerversion: ^1.2.3nodeversion: v8.9.3npm(oryarn) 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
This issue still exists. It happens when you have mutations and queries running in WS
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.