question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Type 'TokenRefreshLink' is missing the following properties from type 'ApolloLink': onError, setOnError ts(2739)

See original GitHub issue

Hi there,

Just wondering if anyone has encountered this issue.

When trying to use TokenRefreshLink, I get the following error when building up the link property…

Type 'TokenRefreshLink' is missing the following properties from type 'ApolloLink': onError, setOnError ts(2739)
const refreshTokenLink = new TokenRefreshLink({
// etc... <omitted here for brevity>
// set proper values for 
accessTokenField:
isTokenValidOrUndefined:
fetchAccessToken:
handleFetch:
handleError:

I also build up a basic set of other links

Then…

// compose the links in sequence 
const link = from([refreshTokenLink, errorLink, authLink, httpLink]);
                              ^^^
                          error occurs here

Using the following

"apollo-link-token-refresh": "^0.2.7",
"@apollo/client": "^3.0.0-beta.44",
"@apollo/link-context": "^2.0.0-beta.3",
"@apollo/link-error": "^2.0.0-beta.3",

I have found the following similar type of issue over here and also here.

I have tried the following:

  • downgrading to an older version of “@apollo/client”: “^3.0.0-beta.37”. (didn’t solve it)
  • upgrading to a newer version “@apollo/client”: “^3.0.0-beta.48”, (made it worse, got additional errors)
  • casting (new TokenRefreshLink({ etc as unknown) as ApolloLink

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
alexbarksdalecommented, May 24, 2020

@miller-productions @maryschmidt A temporary solution that I’m using is just simply casting the new TokenRefreshLink({....}) as any.

Example:

....
new TokenRefreshLink({
    accessTokenField: '....',
    isTokenValidOrUndefined: () => {....},
    fetchAccessToken: () => {....},
    handleFetch: (accessToken) => {....},
    handleError: (err) => {....},
}) as any,
....
1reaction
miller-productionscommented, Oct 28, 2020

Closing this - confirmed it is no longer an issue in the latest versions of apollo-link-token-refresh and @apollo/client.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ApolloClient Type errors for ApolloLink - Stack Overflow
Answer to my own post: import { ApolloClient, ApolloProvider, InMemoryCache, split } from '@apollo/client'; import { setContext } from ...
Read more >
Error Link - Apollo GraphQL Docs
Options. The function you provide the onError link is passed an object with the following fields: Name / Type ...
Read more >
apollo-link-token-refresh - npm
Token Refresh Link npm version. Purpose. An Apollo Link that performs renew expired JWT (access tokens). Installation.
Read more >
Type error - Missing 200+ properties : r/typescript - Reddit
12 votes, 14 comments. Type error: Type '{ children: Element; className: string; closeButton: true; }' is missing the following properties ...
Read more >
apollo-link-token-refresh - npm package - Snyk
The Token Refresh Link does not use the context for anything. apollo-link-token-refresh development dependencies. @apollo/client@types/graphql@types/jest@ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found