No API-call from app after build, but everything's fine on emulator


#1

Hi everyone,

I’m building an application with React-Native / Expo. Which is calling a NodeJS backend API.

I use Axios and everything works fine on iOS simulator, and Android emulator (route are correctly called, and I get my responses etc). For example, the first action is to signUp by clicking on a button. This button is POST on /api/signup, and like I said, everything works fine on emulator / simulator.

So I build the EXACT same app (expo build:ios and expo build:android), then I uploaded that on the store.
On AppStore : rejected because of the first button unresponsive.
On GooglePlay : approved, but the first button is unresponsive too.

When I download the application from the GooglePlay, and I try the application, the first button, is, indeed, unresponsive. I click on it, but nothing happen, no call, no response, nothing. I can not log anything from the backend, like if nothing happened. However, like I said, this is the exact same app, working properly on emulator.

Do you have any idea of what could happen ? The build are doing sneaky things or ?..

Here is a screen of the app (from GooglePlay), the purple button (which POST on /api/signup) is unresponsive :

This exact same screen work properly on the emulator (which is calling /api/signup on the URL-backend server too).

Thank you.


#2

I found the solution, I was registering user based on the deviceID with this code :slight_smile:

try {
    if (Expo.Constants.appOwnership === "expo") {
      uniqueDeviceID = Expo.Constants.installationId;
    } else {
      uniqueDeviceID = DeviceInfo.getUniqueID();
    }
  } catch (error) {
    console.warn(error);
  }

And after building the app, getUniquerID() was catching an error.
Solved it by using Expo.Constants.installationId in each case (even with standalone app).

Thanks.