EAS build crashing in Release (production)

I’m using EAS build and submit in a react-native project (created with react-native init). If I build the app with npx react-native run-ios --configuration Release it works perfectly on both the simulator and a real device. When I use npx eas build --local the app crashes (the launch screen shows briefly and then crashes) on both the simulator, as well as on a real device using TestFlight (it was submitted using eas submit).

I added “simulator”: true to the production build section of eas.json and tried running the app on a simulator with the same results as with TestFlight. I was able to get a stack trace off the phone which shows nothing of value (that I can find).

I’m looking for other ways to debug this issue as we’d love to use was build/submit in our project.

Thread 3 Crashed::  Dispatch queue: com.facebook.react.ExceptionsManagerQueue
0   libsystem_kernel.dylib        	    0x7ff833de600e __pthread_kill + 10
1   libsystem_pthread.dylib       	    0x7ff833e3d1ff pthread_kill + 263
2   libsystem_c.dylib             	    0x7ff800132fe0 abort + 130
3   libc++abi.dylib               	    0x7ff800257742 abort_message + 241
4   libc++abi.dylib               	    0x7ff80024895d demangling_terminate_handler() + 266
5   libobjc.A.dylib               	    0x7ff800031fae _objc_terminate() + 96
6   libc++abi.dylib               	    0x7ff800256b65 std::__terminate(void (*)()) + 8
7   libc++abi.dylib               	    0x7ff800256b16 std::terminate() + 54
8   libdispatch.dylib             	    0x7ff80013ca4e _dispatch_client_callout + 28
9   libdispatch.dylib             	    0x7ff800144346 _dispatch_lane_serial_drain + 949
10  libdispatch.dylib             	    0x7ff800144fe3 _dispatch_lane_invoke + 400
11  libdispatch.dylib             	    0x7ff800151b46 _dispatch_workloop_worker_thread + 870
12  libsystem_pthread.dylib       	    0x7ff833e39fd0 _pthread_wqthread + 326
13  libsystem_pthread.dylib       	    0x7ff833e38f57 start_wqthread + 15

The project is using the latest versions of everything:

{
  "name": "rnseventytest",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "eas:login": "eas login",
    "eas:build-ios": "cd ios && xcrun agvtool next-version -all && cd .. && eas build --platform ios",
    "eas:build-android": "eas build --platform android",
    "eas:submit-ios": "eas submit --platform ios",
    "test": "jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "postinstall": "patch-package"
  },
  "dependencies": {
    "@hookform/resolvers": "^2.9.8",
    "@react-native-async-storage/async-storage": "^1.17.10",
    "@react-native-segmented-control/segmented-control": "^2.4.0",
    "@react-navigation/bottom-tabs": "^6.4.0",
    "@react-navigation/devtools": "^6.0.10",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.0",
    "@reduxjs/toolkit": "^1.8.5",
    "@rnmapbox/maps": "rnmapbox/maps#main",
    "@shopify/flash-list": "^1.2.2",
    "@stripe/stripe-react-native": "^0.19.0",
    "@supabase/supabase-js": "^1.35.7",
    "@tanstack/query-async-storage-persister": "^4.6.0",
    "@tanstack/react-query": "^4.6.0",
    "@tanstack/react-query-persist-client": "^4.6.0",
    "@turf/turf": "^6.5.0",
    "expo": "^46.0.0",
    "expo-linear-gradient": "~11.4.0",
    "lottie-react-native": "^5.1.4",
    "moti": "^0.19.0",
    "react": "18.1.0",
    "react-hook-form": "^7.36.1",
    "react-native": "0.70.1",
    "react-native-dotenv": "^3.3.1",
    "react-native-gesture-handler": "^2.6.2",
    "react-native-reanimated": "^2.10.0",
    "react-native-safe-area-context": "^4.3.4",
    "react-native-screens": "^3.17.0",
    "react-native-url-polyfill": "^1.3.0",
    "react-native-vector-icons": "^9.2.0",
    "react-redux": "^8.0.4",
    "rn-id-blurview": "^1.2.2",
    "zod": "^3.19.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "@tsconfig/react-native": "^2.0.2",
    "@types/jest": "^26.0.23",
    "@types/react-native": "^0.70.1",
    "@types/react-native-dotenv": "^0.2.0",
    "@types/react-native-vector-icons": "^6.4.12",
    "@types/react-test-renderer": "^18.0.0",
    "@typescript-eslint/eslint-plugin": "^5.36.2",
    "@typescript-eslint/parser": "^5.36.2",
    "add": "^2.0.6",
    "babel-jest": "^26.6.3",
    "eas-cli": "^2.1.0",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.72.1",
    "patch-package": "^6.4.7",
    "postinstall-postinstall": "^2.1.0",
    "react-native-flipper": "^0.163.0",
    "react-query-native-devtools": "^4.0.0",
    "react-test-renderer": "18.1.0",
    "typescript": "^4.8.2",
    "yarn": "^1.22.19"
  },
  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  }
}

I probably should have mentioned that there are no errors during the build step, everything seemingly works perfectly. The issue is at run time, when the app launches. Built using eas build = crash, built using react native cli’s standard way = no crash (everything else is equal).

1 Like

most likely there is some mismatch in the environment. do you have some environment variables set locally that you haven’t set on eas build, or are set to different values on eas build? what if you do a fresh clone of your repo and try running it, does that work?

given that your project deps include dotenv, missing or incorrect env vars on eas build is the most likely case i believe. Environment variables and secrets - Expo Documentation

Thanks for pointing me in the right direction. It turns out that EAS build respects the .gitignore file (even locally when the file exists), so my dotenv based environment viariables were not being loaded since I was ignoring *.env out of habit. Since there was nothing but publicly publishable keys and values in the .env, I just stopped ignoring it and that fixed the issue.

2 Likes

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