Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It looks like the onMaxRetryTimesExceeded function is not triggered #282

Open
hoekstrajan opened this issue Jul 4, 2024 · 1 comment
Open

Comments

@hoekstrajan
Copy link

hoekstrajan commented Jul 4, 2024

I have implemented axios-retry which works very well for retrying a API endpoint in my Vue application if for instance the accessToken is expired and a new one is requested. I'm trying this 5 times, before triggering the onMaxRetryTimesExceededHandler in my code. But somehow this function is not triggered. What am i doing wrong:

axiosRetry(axiosInstance, {
	retries: 5,
	retryDelay: axiosRetry.exponentialDelay,
	retryCondition: retryConditionHandler,
	onMaxRetryTimesExceeded: onMaxRetryTimesExceededHandler,
	onRetry: onRetryHandler,
})

function onMaxRetryTimesExceededHandler(_error: AxiosError<unknown, any>, _count: number) {
	console.log('onMaxRetryTimesExceededHandler')
	forceLogout()
}
@obscurecat64
Copy link
Contributor

@hoekstrajan could it be that you have a timeout set and exceeded the timeout?

if so you could try:

axiosInstance.defaults.timeout = 20000;

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

No branches or pull requests

2 participants