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.

Bug with axios.create and baseURL option?

See original GitHub issue

First let me just say thanks for creating a great little library.

I think I’ve found a bug.

I set my JWT TTL to 60 seconds but the refresh TTL longer so that I can debug this JWT stuff and get it working.

So, I log into my application and then wait > 60 seconds, then I hit an authenticated route /api/auth/me and get a 401.

The interceptor kicks in and hits the refresh token route (/api/auth/refresh), which returns a new token and all that jazz.

After that, I see the original route that triggered the 401 getting hit again… except for one slight problem - It’s hitting /api/api/auth/me. The api part is now doubled.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jacobmllr95commented, Dec 9, 2019

Resetting the baseURL works for the initial failing request but queued requests have the same issue and there is currently no solution to adjust those.

IMHO there should be a global baseURL handling or a config option to define a callback for queued requests to be able transform their configs too.

1reaction
Flyrellcommented, Jun 18, 2019

As I said earlier, I’m not sure if that’s a bug or desired behavior. Either way, it feels like it shouldn’t be like that, so it might be worth opening the issue and see what axios team has to say about it.

If you do so, please, refer to this issue, so anyone with the same problem can see the thread.

Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting baseURL in default configuration · Issue #175 - GitHub
This sounds like a bug. I will have to dig in a bit deeper to confirm, but at a glance the code looks...
Read more >
Setting baseUrl for Axios in Vue js sends out request
Does anyone know how to cancel this request or is there a better way to set the baseUrl without this 'bug? javascript ·...
Read more >
Secure and Easy Axios integration with Nuxt.js.
Automatically set base URL for client & server side. ✓ Exposes setToken function to $axios so we can easily and globally set authentication ......
Read more >
Request Config | Axios Docs
These are the available config options for making requests. ... It can be convenient to set `baseURL` for an instance of axios to...
Read more >
Understanding Axios POST requests - LogRocket Blog
Sending requests to a web server is one of the most common things we do on the frontend side of web development. Creating...
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