title: Random 404 errors on axios api call
body: <p>I'm changing somethings from a react project made by someone else, I found that the api calls return 404 not found every now and then even though I know the object I'm looking for exist because after sometime the error dissapears and I get the respone.
  It's a random error that comes and goes on its own and that makes it impossible for me to test the code.</p>
  <p>The front is connected to a middleware where all the api calls are made, here's the part of the middleware where the call is made.</p>
  <pre><code>
  
  async getSpecialties(jwtToken){
          try {
              const response = await axios.get(
                  config.api.parametrics.PARAMETRICS_SPECIALITIES_ENDPOINT,
                  {headers: {...this.commonHeaders, authorization: `Bearer ${jwtToken}`}}
              );
              return response;
          } catch (error) {
              error.message = `Error mdw getSpecialties: ${error.message}`;
              throw error;
          }
      };
  
  </code></pre>
  <p>And this is where it's called from the front.</p>
  <pre><code>
  import UserWrapper from &quot;./middleware/src/wrappers/user.wrapper&quot;;
  
  const usrw = new UserWrapper();
  
  export const GetSpecialtiesProfessional = async (token, displayError = null) =&gt;
      usrw.getSpecialties(token, displayError);
  </code></pre>
  <pre><code>await GetSpecialtiesProfessional(userToken, showError)
              .then((response) =&gt; {
                 if (!response.data.error &amp;&amp; isMounted) {
                    setSpecialtiesList(response.data);
                 } else {
                    showError(
                       'Ocurrió un error en la búsqueda de especialidades',
                    );
                 }
              })
              .catch((err) =&gt; {
                 showError(err.message);
              });
  
  </code></pre>
  <p>I spoke to the company that handles the api and they said that there was nothing wrong with it, so it must be this code. I didn't write it myself but I can't see anything wrong with it. And what's more, this error appears in another api call, so wathever the error is it must be from the way the first programmers handled the call.</p>
  <p>Can anyone help me?</p>