Questions tagged [axios-retry]

Axios plugin that intercepts failed requests and retries them whenever possible.

axios-retry: Axios plugin that intercepts failed requests and retries them whenever possible.

25 questions
7
votes
2 answers

How can I change the result status in Axios with an adapter?

The why We're using the axios-retry library, which uses this code internally: axios.interceptors.response.use(null, error => { Since it only specifies the error callback, the Axios documentation says: Any status codes that falls outside the range…
TrueWill
  • 25,132
  • 10
  • 101
  • 150
4
votes
1 answer

Retry Axios POST requests with timeout for each retry attempt

I have a use case where i need to retry a Axios request for 3 times in case of any error and each retry attempt should timeout in 3 seconds if it doesnt get any response within 3 seconds. Below is the code i am using. It retries for 3 times but it…
vignesh d
  • 235
  • 3
  • 6
  • 15
4
votes
1 answer

axios retry with timeout

I have a use case where i need to retry Axios POST requests in case of API timeout while trying to POST the request. I need to retry 3 times in case of API timeout and each retry request should timeout in 4 secs if the POST operation cant be…
vignesh d
  • 235
  • 3
  • 6
  • 15
3
votes
0 answers

When onRejected in axios.interceptors.request.use will be triggered?

I've been trying for two hours to figure out when onRejected will work in axios.interceptors.request.use. I searched everywhere, but I didn't find an answer. I want to handle all cases where the request fails. Basically my goal is to find out if the…
Sanasar Yuzbashyan
  • 599
  • 1
  • 5
  • 17
3
votes
2 answers

How to do retry on status 200 using axios-retry

I am using axios-retry I am trying that it will do retry on response condition and not on response status. My status is 200 I think because of that it not going to retry, My code is raxConfig: { retry: retry, …
Vitaly Menchikovsky
  • 7,684
  • 17
  • 57
  • 89
2
votes
0 answers

How to retry using axios-retry for POST request on 5XX error

Here is my implementation- import axiosRetry from 'Axios-retry' axiosRetry(axios, { retries: 3 }); axios.post('http://localhost:3005/post',{name: "abc"}) // The first request fails and the second returns 'ok' .then(result => { result.data;…
2
votes
2 answers

axios-retry not working as expected. What is wrong with my config?

I have configured axios-retry in my nodejs application as per https://www.npmjs.com/package/axios-retry Following is my code import axios from 'axios'; import axiosRetry from 'axios-retry'; export class RetryRoute { public async testRetry( …
Gnik
  • 7,120
  • 20
  • 79
  • 129
1
vote
0 answers

why axios response becomes slower as the rate of request becomes faster and longer the request keeps calling

I am using artillery to send different rate of request to an nodejs API that makes an axios post request, and the response time seems to be increasing as time goes by. e.g. when sending 10 req/sec to the API, the response time are around 100-300ms…
Yuan
  • 11
  • 1
1
vote
1 answer

Error [ERR_REQUIRE_ESM]: require() of ES Module when using retry-axios

const rax = require('retry-axios'); Error [ERR_REQUIRE_ESM]: require() of ES Module I was trying to implement a retry mechanism with retry-axios. After installing the package I got the Error [ERR_REQUIRE_ESM]: require() of ES Module error. I’m…
Sufail Kalathil
  • 558
  • 6
  • 21
1
vote
1 answer

How do I get axios-retry to work within my async api function? If there is a rate hit, I want to pause the function and retry

I'm unable to get axios-retry to work at all no matter where I put the code. Can someone help out? I want to be able to wait and retry in case of rate-limiting or any other errors. For testing purposes, I put a bad API key in to force a 403 and all…
1
vote
0 answers

How can I cover Axios-retry failure unit testing using Mocha chai Nodejs?

How can we unit test the following code (axios-retry logic) AxiosRetryClass.ts import { AxiosInstance, AxiosRequestConfig } from 'axios'; import axiosRetry from 'axios-retry'; export class AxiosRetryClass { constructor() { } public…
Gnik
  • 7,120
  • 20
  • 79
  • 129
1
vote
0 answers

axios-retry with custom retry option

I'm having issues with axios retry. It is not retrying, it returns response after first time it fails. await axios.get(`${URL}/test`, { 'axios-retry': { retries: 3 }, headers: { 'Content-Type': 'application/json', …
myTest532 myTest532
  • 2,091
  • 3
  • 35
  • 78
1
vote
0 answers

Axios GET request timeouts randomly

We are working on a React app, which makes REST API calls using Axios. And we are randomly seeing request timeouts. We checked the network connection and it was fine (100 MBPS connection). We checked our server logs, the request reached the server…
MetalJr
  • 302
  • 4
  • 14
1
vote
2 answers

Axios Retry for success response interceptor

I have situation where I want to retry the request if status code for API response is 202 after the specified time. In axios success interceptor, I am doing like function axiosRetrySuccessInterceptor(response) { const { status, config }…
Shyam Kumar
  • 586
  • 3
  • 17
1
vote
1 answer

How to use axios client to retry on 5xx errors

I am trying add retry to my api call using axios-retry module. In order to test I am using mockoon macosx client. I have setup the endpoint in mockoon to return 502 response all the time. So that I can test the retry. import axios from…
Arun Kamalanathan
  • 8,107
  • 4
  • 23
  • 39
1
2