Post EAS Build - Env URL Configuration - App not making requests to staging api

Hello everyone,
Unfortunately, I am unable to get my app (preview/staging build) to connect to the staging server. I am able to successfully create the build for my staging profile, but I suspect the env URL is not being configured correctly at build time, but I am not sure (this does begs the question… how do I even debug a build configuration without using dev-client? Another thing to add is based on my error messages on the login, I know the message is coming from the client side, so the request is not getting to the backend.

The eas.json is configured with channels, and my env vars are configured dynamically using the app.config.js looking at the APP_ENV key in the eas.json. Below is the config.

CURRENT CONFIG
eas.json

{
  "cli": {
    "version": ">= 3.12.0",
    "appVersionSource": "remote"
  },
  "build": {
    "development": {
      "channel": "development",
      "developmentClient": true,
      "distribution": "internal",
      "ios": {
        "resourceClass": "m1-medium"
      }
    },
    "development-simulator": {
      "extends": "development",
      "ios": {
        "simulator": true
      },
      "channel": "development-simulator"
    },
    "preview": {
      "channel": "staging",
      "distribution": "internal",
      "ios": {
        "resourceClass": "m1-medium"
      },
      "android": {
        "gradleCommand": ":app:bundleRelease"
      },
      "env": {
        "APP_ENV": "staging"
      }
    },
    "production": {
      "channel": "production",
      "autoIncrement": true,
      "ios": {
        "resourceClass": "m1-medium"
      },
      "env": {
        "APP_ENV": "production"
      }
    }
  },
  "submit": {
    "production": {}
  }
}

app.config.js
For this post I am using dummyurls

let Config = {
    apiUrl: "dev.url",
    enableHiddenFeatures: true,
};

if (process.env.APP_ENV === "production") {
    Config.apiUrl = "production.url";
    Config.enableHiddenFeatures = false;
} else if (process.env.APP_ENV === "staging") {
    Config.apiUrl = "staging.url";
    Config.enableHiddenFeatures = true;
}

module.exports = {
   ...
    extra: {
        ...Config,
       ... 
    },
};

What works/what I have tried …

  • Staging build is created. Here is the command -eas build -p android --profile preview
  • Dev build for my iOS simulator and Android Emulator and the physical device connects to my dev server
  • Postman successfully makes requests to the staging server
  • In my dev env, within my app I am able to console.log and see the dev apiURL using the Constants import from “expo-constants”
  • If I hardcode my staging url the app does work in a dev environment (npx expo start).

Other Project info
Expo managed project
CLI 0.7.3

Please let me know if I am missing something, or how to debug this problem. Any help is greatly appreciated!

The app is working with the staging server!

I removed the gradleCommand, and I realized my app.config.js was included in the gitignore.