Fetch request is ignored when running build [closed]

I’m working on a React application that has two requests:

  • One checking the existence of a document in my database. If the document is on my DB my request returns an ID that allow me to consult (GET) the data related with this document via API. Otherwise, I’ll register this document (POST) via API (I’m going with this approach because I have a limited amount of POST requests available, but I can make as many GET requests as I want)

  • The other one will fetch data from already registered documents on my DB using the consult ID returned from the first request

I’m just giving some context here because it might help.

When I execute my application with npm start (both on my local machine and also on my server) everything works completely fine. I make my request and all the data I need will be rendered on a table.

But when I run npm build and serve the application – the second request won’t occur.

I’m consulting this document that already exists on my DB and when executing the application with npm start my network session from dev tools show me:

POST 200 – route that check the existence of the document on my DB (response is the ID)

GET 200 – route that consult the document data based on ID (response is the data I need)

On the other hand, when serving the build application I only got:

POST 200 – route that check the existence of the document on my DB (response is the ID)

But the point is: no error appears. My request is just being ignored.

I have no idea of what is happening. Anyone has ever faced this scenario? How can I solve it?