question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onRetry and retryInstance not working

See original GitHub issue

I have following code:

createAuthRefreshInterceptor(
      axios,
      async () => {
        localStorage.removeItem('accessToken');

        try {
          await store.dispatch('refreshToken', {
            refreshToken: localStorageService.getRefreshToken()
          });

          return Promise.resolve();
        } catch (error) {
            return Promise.reject(error);
        }
      },
      {
        onRetry: config => {
          console.log(config);

          return config;
        }
      }
    );

Refreshing the token works as expected, but when re-requested, the payload is sent in a wrong(string) format (2 image) instead fine(object) format (1 image). I tried to add a handler to the onRetry parameter but nothing happens. image image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Flyrellcommented, Aug 5, 2020

When you’re saving object to local storage, it needs to be “stringified”, which I believe your localStorageService is doing behind the scenes. When you get the token from the storage, it needs to be parsed in order to create the object…

// ...
try {
  await store.dispatch('refreshToken', {
    refreshToken: JSON.parse(localStorageService.getRefreshToken()),
  });
} catch () { ... }
// ...
0reactions
architawrcommented, Aug 6, 2020

The issue has been resolved, thanks. Helped point 2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error retries - Amazon Elastic Compute Cloud
The AWS SDKs implement automatic retry logic for requests that return error responses. You can configure the retry settings for the AWS SDKs....
Read more >
Resilience4j Retry does not retry - Stack Overflow
But I need to retry the createOrder(String orderId) method which fails some of the times. Although the annotation is different, but may be...
Read more >
Resilience4j retry not working for java.net.ConnectException
Hi we see that retry is not happening when our db connection is down but retry callback method is called without retrying. But...
Read more >
Transient fault handling - Azure - Microsoft Learn
While an occasional transient failure and retry are to be expected, and do not indicate a problem, regular and increasing numbers of retries...
Read more >
Retry tasks on different hosts - IBM
Ensure that you modify the application profile to keep the service instance alive for the Invoke method (Service > Control > Method >...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found