Node.js app with axios external requests only loads correctly on first load

My app loads correctly the first time it starts. If it gets a second request, all the external api requests it makes return “undefined” and it eventually times-out. If I make a small edit, like adding a space, it forces the app to reload, which will allow it to render correctly again, but only once. This process repeats consistently. Not sure if this is caused by my code or by glitch. It doesn’t seem to be related to the API.

Solved. It was my code. I was polling an external api which uses a timestamp for login. I was saving the timestamp to a variable outside of the get request. This made requests look old and get rejected by the api. Solution? I set the variable inside the get request.

4 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.