Skip to content

fix(deps): update dependency retry-axios to v4#26

Open
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/retry-axios-4.x
Open

fix(deps): update dependency retry-axios to v4#26
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/retry-axios-4.x

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate Bot commented Oct 20, 2025

This PR contains the following updates:

Package Change Age Confidence
retry-axios ^3.0.0^4.0.0 age confidence

Release Notes

JustinBeckwith/retry-axios (retry-axios)

v4.0.3

Compare Source

Bug Fixes

v4.0.2

Compare Source

Bug Fixes
  • add require-specific declaration export for nodenext cjs consumers (5014853), closes #​335

v4.0.1

Compare Source

Bug Fixes

v4.0.0

Compare Source

⚠ BREAKING CHANGES

This major release includes several breaking changes that simplify the API and improve consistency. Please review the migration guide below for each change.

1. Node.js Version Requirements

This library now requires Node.js 20 or higher. Previous versions supported Node.js 6, 8, 12, and 14, which are all now end-of-life.

Migration Required: Upgrade your Node.js version to 20 or higher before upgrading to retry-axios 4.0.

# Check your Node.js version
node --version

# If below v20, upgrade Node.js first

# Visit https://nodejs.org or use a version manager like nvm
2. Removal of config.instance Option

The config.instance option has been removed. The axios instance is now automatically used from the interceptor attachment point.

This was confusing because users had to specify the instance twice - once in raxConfig and once in rax.attach(). Now you only specify it once in rax.attach().

Before (v3.x):

const myAxiosInstance = axios.create();
myAxiosInstance.defaults.raxConfig = {
  instance: myAxiosInstance,  // ❌ Remove this
  retry: 3
};
rax.attach(myAxiosInstance);

After (v4.0):

const myAxiosInstance = axios.create();
myAxiosInstance.defaults.raxConfig = {
  retry: 3  // ✅ Instance is automatically used from rax.attach()
};
rax.attach(myAxiosInstance);

Migration Required: Remove the instance property from your raxConfig objects.

3. Simplified Retry Configuration - Removal of noResponseRetries

The noResponseRetries configuration option has been removed. The retry option now controls the maximum number of retries for ALL error types (both response errors like 5xx and network errors like timeouts).

This simplifies the API to match industry standards. Popular libraries like axios-retry, Got, and Ky all use a single retry count.

Before (v3.x):

raxConfig: {
  retry: 3,              // For 5xx response errors
  noResponseRetries: 2   // For network/timeout errors
}

After (v4.0):

raxConfig: {
  retry: 3  // For ALL errors (network + response errors)
}

If you need different behavior for network errors vs response errors, use the shouldRetry callback:

raxConfig: {
  retry: 5,
  shouldRetry: (err) => {
    const cfg = rax.getConfig(err);

    // Network error (no response) - allow up to 5 retries
    if (!err.response) {
      return cfg.currentRetryAttempt < 5;
    }

    // Response error (5xx, 429, etc) - limit to 2 retries
    return cfg.currentRetryAttempt < 2;
  }
}

Migration Required:

  • If you used noResponseRetries, remove it and adjust your retry value as needed
  • If you need different retry counts for different error types, implement a shouldRetry function
4. onRetryAttempt Now Requires Async Functions

The onRetryAttempt callback must now return a Promise. It will be awaited before the retry attempt proceeds. If the Promise is rejected, the retry will be aborted.

Additionally, the timing has changed: onRetryAttempt is now called AFTER the backoff delay (right before the retry), not before. A new onError callback has been added that fires immediately when an error occurs.

Before (v3.x):

raxConfig: {
  onRetryAttempt: (err) => {
    // Synchronous callback, called before backoff delay
    console.log('About to retry');
  }
}

After (v4.0):

raxConfig: {
  // Called immediately when error occurs, before backoff delay
  onError: async (err) => {
    console.log('Error occurred, will retry after backoff');
  },

  // Called after backoff delay, before retry attempt
  onRetryAttempt: async (err) => {
    console.log('About to retry now');
    // Can perform async operations like refreshing tokens
    const token = await refreshAuthToken();
    // If this throws, the retry is aborted
  }
}

Common use case - Refreshing authentication tokens:

raxConfig: {
  retry: 3,
  onRetryAttempt: async (err) => {
    // Refresh expired token before retrying
    if (err.response?.status === 401) {
      const newToken = await refreshToken();
      // Update the authorization header for the retry
      err.config.headers.Authorization = `Bearer ${newToken}`;
    }
  }
}

Migration Required:

  • Change onRetryAttempt to be an async function or return a Promise
  • If you need immediate error notification (old onRetryAttempt timing), use the new onError callback instead
  • If your callback throws or rejects, be aware this will now abort the retry
Summary of All Breaking Changes
  1. Node.js 20+ required - Drops support for Node.js 6, 8, 12, and 14
  2. Remove config.instance - Axios instance is now automatically used from rax.attach()
  3. Remove noResponseRetries - Use retry for all error types, or implement shouldRetry for custom logic
  4. onRetryAttempt must be async - Must return a Promise, called after backoff delay (use onError for immediate notification)
Features
Bug Fixes
Miscellaneous Chores
Build System

v3.2.1

Compare Source

Bug Fixes
  • Fix potential exception when there is no response (#​258) (a58cd1d)

v3.2.0

Compare Source

Features

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot force-pushed the renovate/retry-axios-4.x branch from f495918 to 4d92951 Compare November 9, 2025 19:33
@renovate renovate Bot force-pushed the renovate/retry-axios-4.x branch from 4d92951 to 34f61e6 Compare April 10, 2026 02:47
@renovate renovate Bot force-pushed the renovate/retry-axios-4.x branch from 34f61e6 to 3b51d90 Compare April 11, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants