A NestJS module (v1.0.7) that integrates axios-retry with NestJS's HttpModule, providing configurable retry logic for HTTP requests. It supports retry count, delay strategies (exponential backoff), custom retry conditions, and on-retry callbacks. Differentiates from manual axios-retry usage by offering a declarative NestJS module setup with forRoot configuration. Uses axios-retry v4 and requires @nestjs/common and @nestjs/core v10. Release cadence is low; last update 2023.
npm install nestjs-axios-retryNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Registers AxiosRetryModule with exponential backoff, 3 retries, and a condition to retry on HTTP 429. Then uses HttpService in a service.
Ensure axios-retry version is compatible (v4 recommended). If TypeScript errors, manually define config type.
Use forRoot() only in root module. For feature modules, import the same forRoot configuration or use global module.
Use axios-retry v4 (peer dependency). With v3, the config key is different ('retry' instead of 'axios-retry').Update to v1.0.7 or later, or manually check peer version compatibility.
Upgrade axios-retry to v4. See migration guide for axios-retry v4 changes.
Always use firstValueFrom() or lastValueFrom() to execute the HTTP call.
Specify all needed retry options in per-request config; module-level defaults are ignored.
Run npm install nestjs-axios-retry axios-retry && ensure tsconfig.json includes node_modules types.
Use import axiosRetry from 'axios-retry'. If using CommonJS, use const axiosRetry = require('axios-retry').default.Add null check: (error) => error.response?.status === 429.
Import AxiosRetryModule and add it to imports array with forRoot() call.
Extend AxiosRequestConfig type with 'axios-retry' property, or cast to any: this.httpService.get(url, { 'axios-retry': {...} } as any)