Registry / devops / apollo-link-retry

apollo-link-retry

JSON →
library2.2.16jsnpmunverified

Apollo Link Retry is an Apollo Link for retrying GraphQL operations on network/server errors, not GraphQL errors. Version 2.2.16 is stable and ships TypeScript types. It uses exponential backoff with jitter by default to avoid thundering herd. Compared to manual retry logic, it integrates seamlessly into Apollo Client's link chain. Release cadence is low (last release 2019). Deprecated in favor of @apollo/client/link/retry.

npm install apollo-link-retry
INSTALL
IMPORT
SIG · APOLLO-LINK-RETRY
A
apollo-link-retry
devopsjavascriptv2.2.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RetryLink
import { RetryLink } from 'apollo-link-retry'
const RetryLink = require('apollo-link-retry')
ESM import is standard; CJS require also works but TypeScript types may not be recognized. This package is deprecated; use @apollo/client/link/retry instead.
default
import RetryLink from 'apollo-link-retry'
import { default as RetryLink } from 'apollo-link-retry'
Default export is the same as named export RetryLink, but named import is preferred.
type
import { RetryLink } from 'apollo-link-retry'
import { default as RetryLink } from 'apollo-link-retry'
TypeScript types are included; no separate type import needed.

Setup RetryLink in an Apollo Client chain with exponential backoff and jitter.

import { ApolloClient, InMemoryCache, HttpLink } from '@apollo/client'; import { RetryLink } from 'apollo-link-retry'; const retryLink = new RetryLink(); const httpLink = new HttpLink({ uri: 'https://api.example.com/graphql' }); const client = new ApolloClient({ link: retryLink.concat(httpLink), cache: new InMemoryCache() }); // Use client as usual
Debug
Known issues
deprecatedPackage 'apollo-link-retry' is deprecated. Use '@apollo/client/link/retry' from '@apollo/client' package instead.
fix
Replace 'apollo-link-retry' with import { RetryLink } from '@apollo/client/link/retry' and remove 'apollo-link-retry' from dependencies.
affects: >=2.2.0
gotchaRetryLink does NOT retry GraphQL errors in the response; it only retries on network errors.
fix
To retry on GraphQL errors, implement a custom 'retryIf' function that inspects the response.
affects: >=2.0.0
gotchaRetryLink does not retry operations by default if the server returns a successful response with GraphQL errors. Ensure you configure 'retryIf' appropriately.
fix
Use attempts: { retryIf: (error, operation) => !!error || (response and response.errors) }
affects: >=2.0.0
gotchaThe 'delay' and 'attempts' configuration is ignored if you pass a custom function for either; the full options object must be used.
fix
Ensure consistency: if you provide a function for 'delay', you must also provide a function for 'attempts' (or use object config).
affects: >=2.0.0
Errors
Common errors & fixes
Module not found: Can't resolve 'apollo-link-retry'
Package not installed or removed from node_modules.
fix
npm install apollo-link-retry or switch to @apollo/client/link/retry.
TypeError: Invalid link or undefined link
RetryLink instantiation incorrectly or not composing links correctly.
fix
Ensure you create new RetryLink() and use concatenation: const link = new RetryLink().concat(httpLink);
Error: RetryLink: Improperly configured delay option
Passing invalid delay configuration (e.g., string instead of number).
fix
Ensure delay.initial is a number, not a string.
Upgrade
Version history
2.2.16latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
24 hits · last 30 days
node
22
OpenAI (training)
1
Resources
apollo-link-retry — npm install apollo-link-retry · libregistry