Laura Beatris
Laura Beatris

Reputation: 1922

Apollo Client - Calling concat on a terminating link, which will have no effect

I have the following Apollo Links:

 const link = ApolloLink.from([
    serializingLink,
    httpAuthLink,
    queueLink,
    retryLink,
    errorLink,
    uploadLink,
    httpLink
  ]);

And they are all with the correct setup After adding a new link, that error started to appear in the console:

Error: You are calling concat on a terminating link, which will have no effect

By reading another issue, I saw that this can be related with the order of the links inside of the array.

Upvotes: 1

Views: 1905

Answers (1)

Daniel Rearden
Daniel Rearden

Reputation: 84687

A terminating link is one that actually sends the request and receives the response. There should only ever be one terminating link at the very end of your chain. In the code you posted, there's at least two terminating links -- uploadLink and httpLink. Assuming uploadLink was created using createUploadLink, there's no need to include both it and httpLink. UploadLink is a drop in replacement for HttpLink, so you can just remove the httpLink alltogether.

Upvotes: 5

Related Questions