Upgrading from expo build to eas build: build passes but app crashes when opened: how to debug??

Hello! I’ve been trying to troubleshoot this for over a day now so I think it’s time for some help.

I am trying to upgrade our managed workflow project to eas build from a working expo build setup. I have successfully fixed all issues with the builds for both ios and android, and the app also runs perfectly from Expo Go in the simulator.
However, when I open a simulator/emulator EAS build on either ios or android, the app immediately crashes (well… right after the splash screen). The error from the native OS (on ios) is EXC_CRASH (SIGABRT) which indicates as far as I understand that this is an Expo/JavaScript/React Native issue, not a native code issue.
I still don’t have a Javascript or React error message, which is why I’m having a hard time fixing/troubleshooting the problem.

I haven’t done as much debugging on Android because I can’t get that emulator to work.

I have tried many things already:

  • debugging in expo go, there are no errors there
  • using Sentry to look for the error - the app doesn’t seem to get this far on startup as no errors are shown
  • adding an error boundary around everything in index.js, to catch & display the Javascript error - the app still crashes with this
  • removing all dependencies, React code, etc from my app to try to determine the source of the issue - it still won’t start when built with EAS even if it is basically just <Text>hello world</Text> with no dependencies beyond what’s needed to build/run that.
  • deleting my .gitignore file - this didn’t change the behaviour at all
  • tried to do an ios prebuild to debug in XCode - this failed to build for me because I’m on an M1 Mac, and I’m not going to go down a rabbit hole trying to fix that

I suspect that the issue is with environment variables or other configuration accessed when you start the app, just because it works in Expo Go and as a web app, and it builds with EAS successfully.

Here are the technical details about our setup:

I am using expo-cli version 6.0.5, and Expo SDK 45.

I had to upgrade to 45 as part of this process of switching to EAS build, because I was getting this error on SDK 43 when building android: The minCompileSdk (3*) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-30).
I am new to expo (this is a project that I’m taking over from someone else who disappeared), so maybe I messed something up while upgrading?

Here’s my eas.json file, and I am running eas build -p ios --profile preview.

{
  "cli": {
    "version": ">= 2.1.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "distribution": "internal",
      "ios": {
        "simulator": true
      },
      "android": {
        "buildType": "apk"
      }
    },
    "production": {},
  },
  "submit": {
    "production": {}
  }
}

I know our dependency list is very long. We have a monorepo-ish setup where the backend & frontend (+ some other packages) share a package.json. I have added the relevant files in the frontend folder to deal with this according to expo’s tutorial as far as I understand.

The main things that the expo app must integrate with are: Firebase, Sentry, and Apollo.

Here are the dependencies from package.json:

"dependencies": {
    "@apollo/client": "^3.4.10",
    "@babel/preset-env": "^7.10.0",
    "@brlja/react-native-slider": "^0.12.1",
    "@expo/metro-config": "^0.1.60",
    "@expo/vector-icons": "^13.0.0",
    "@expo/webpack-config": "~0.16.21",
    "@nestjs/common": "7.6.18",
    "@nestjs/config": "^1.0.0",
    "@nestjs/core": "7.6.18",
    "@nestjs/graphql": "^7.6.18",
    "@nestjs/platform-express": "7.6.18",
    "@nestjs/serve-static": "^2.2.2",
    "@ntegral/nestjs-sentry": "2.0.9",
    "@prisma/client": "^2.30.3",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/datetimepicker": "6.1.2",
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "8.2.0",
    "@react-native-picker/picker": "2.4.0",
    "@react-navigation/drawer": "^6.5.0",
    "@react-navigation/native": "^6.0.2",
    "@react-navigation/routers": "^6.0.1",
    "@react-navigation/stack": "^6.0.7",
    "@sendgrid/mail": "^7.4.4",
    "@sentry/node": "^6.10.0",
    "@sentry/react": "^6.10.0",
    "@sentry/tracing": "^6.10.0",
    "@sentry/types": "^6.13.2",
    "@sharcoux/slider": "^4.0.4",
    "@svgr/webpack": "^5.4.0",
    "@types/apollo-upload-client": "^14.1.0",
    "@types/color": "^3.0.1",
    "@types/enzyme": "^3.10.8",
    "@types/faker": "^4.1.12",
    "@types/graphql-upload": "^8.0.6",
    "@types/i18n-js": "^3.0.3",
    "@types/jsonwebtoken": "^8.5.0",
    "@types/lodash": "^4.14.159",
    "@types/mime": "^2.0.3",
    "@types/react-dom": "~17.0.11",
    "@types/react-native-svg-charts": "^5.0.7",
    "@types/sharp": "^0.28.4",
    "@types/supertest": "^2.0.10",
    "@types/uuid": "^8.3.0",
    "@welldone-software/why-did-you-render": "^4.2.0",
    "animate.css": "^4.1.1",
    "apollo": "^2.33.6",
    "apollo-cache-persist": "^0.1.1",
    "apollo-server-core": "^2.25.2",
    "apollo-server-express": "^2.25.2",
    "apollo-upload-client": "^16.0.0",
    "axios": "^0.20.0",
    "class-validator": "^0.12.2",
    "class-validator-formik": "^1.0.0",
    "color": "^3.1.3",
    "colors": "^1.4.0",
    "core-js": "^3.6.5",
    "csv-writer": "^1.6.0",
    "date-fns": "^2.23.0",
    "easy-peasy": "^3.3.1",
    "enzyme": "^3.11.0",
    "enzyme-to-json": "^3.5.0",
    "expo": "^45.0.0",
    "expo-application": "~4.1.0",
    "expo-blur": "~11.1.0",
    "expo-constants": "~13.1.1",
    "expo-contacts": "~10.2.0",
    "expo-device": "~4.2.0",
    "expo-firebase-analytics": "~7.0.0",
    "expo-firebase-recaptcha": "~2.2.0",
    "expo-font": "~10.1.0",
    "expo-image-picker": "~13.1.1",
    "expo-linear-gradient": "~11.3.0",
    "expo-linking": "~3.1.0",
    "expo-localization": "~13.0.0",
    "expo-location": "~14.2.2",
    "expo-network": "~4.2.0",
    "expo-notifications": "~0.15.4",
    "expo-permissions": "~13.2.0",
    "expo-splash-screen": "~0.15.1",
    "expo-status-bar": "~1.3.0",
    "expo-task-manager": "~10.2.1",
    "expo-updates": "~0.13.4",
    "expo-web-browser": "~10.2.1",
    "faker": "^4.1.0",
    "fast-crc32c": "^2.0.0",
    "firebase": "^9.10.0",
    "firebase-admin": "^9.7.0",
    "fireorm": "^0.16.0",
    "formik": "^2.1.5",
    "fuzzy": "^0.1.3",
    "google-geocode-parser": "^1.4.5",
    "google-maps-react": "^2.0.6",
    "graphql": "^15.3.0",
    "graphql-tools": "^6.0.15",
    "graphql-upload": "^12.0.0",
    "hex-to-rgba": "^2.0.1",
    "i18n-js": "^3.7.1",
    "jetifier": "^1.6.5",
    "jsonwebtoken": "^8.5.1",
    "libphonenumber-js": "^1.7.51",
    "locale-code": "^2.0.2",
    "lodash": "^4.17.19",
    "mime": "^3.0.0",
    "modal-enhanced-react-native-web": "^0.2.0",
    "nestjs-url-generator": "^1.0.1",
    "node-mocks-http": "^1.11.0",
    "prisma": "2.30.0",
    "purify-ts": "^0.16.3",
    "random-token": "^0.0.8",
    "react": "17.0.2",
    "react-datepicker": "^3.1.3",
    "react-dom": "17.0.2",
    "react-google-maps": "^9.4.5",
    "react-native": "0.68.2",
    "react-native-asset": "^2.0.0",
    "react-native-chart-kit": "^6.11.0",
    "react-native-expo-viewport-units": "^0.0.8",
    "react-native-gesture-handler": "~2.2.1",
    "react-native-google-autocomplete": "^0.1.9",
    "react-native-in-app-message": "^1.0.31",
    "react-native-inappbrowser-reborn": "^3.3.4",
    "react-native-indicators": "^0.17.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-map-link": "^2.7.10",
    "react-native-maps": "0.30.2",
    "react-native-maps-directions": "^1.7.3",
    "react-native-markdown-display": "^7.0.0-alpha.2",
    "react-native-modal-datetime-picker": "^8.1.0",
    "react-native-modal-selector": "^2.0.1",
    "react-native-notifier": "^1.3.2",
    "react-native-numeric-input": "^1.8.3",
    "react-native-picker-modal-view": "^1.3.2",
    "react-native-picker-select": "^7.0.0",
    "react-native-reanimated": "~2.8.0",
    "react-native-render-html": "^4.2.1",
    "react-native-safe-area-context": "4.2.4",
    "react-native-screens": "~3.11.1",
    "react-native-svg": "12.3.0",
    "react-native-svg-charts": "^5.4.0",
    "react-native-svg-web": "^1.0.9",
    "react-native-swipe-gestures": "^1.0.4",
    "react-native-swipe-list-view": "^3.2.5",
    "react-native-url-polyfill": "^1.3.0",
    "react-native-web": "0.17.7",
    "react-native-web-maps": "^0.3.0",
    "react-native-webview": "11.18.1",
    "react-spring": "^8.0.27",
    "reanimated-bottom-sheet": "^1.0.0-alpha.20",
    "reflect-metadata": "^0.1.13",
    "retry-axios": "^2.2.1",
    "rxjs": "6.5.5",
    "sentry-expo": "^4.2.0",
    "sharp": "^0.28.3",
    "styled-components": "5.2.1",
    "supertest": "^4.0.2",
    "testdouble": "^3.16.1",
    "toggle-switch-react-native": "^2.3.0",
    "tslib": "^2.0.0",
    "twilio": "^3.63.1",
    "use-deep-compare-effect": "^1.4.0",
    "use-file-picker": "^1.4.1",
    "utility-types": "^3.10.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/preset-typescript": "7.9.0",
    "@firebase/testing": "^0.20.9",
    "@nestjs/schematics": "7.3.1",
    "@nestjs/testing": "7.6.18",
    "@nrwl/cli": "12.5.7",
    "@nrwl/eslint-plugin-nx": "12.5.7",
    "@nrwl/jest": "12.5.7",
    "@nrwl/nest": "12.5.7",
    "@nrwl/node": "12.5.7",
    "@nrwl/nx-cloud": "12.2.7",
    "@nrwl/react": "12.5.7",
    "@nrwl/tao": "12.5.7",
    "@nrwl/workspace": "12.5.7",
    "@storybook/addon-actions": "^6.0.21",
    "@storybook/addon-essentials": "^6.0.21",
    "@storybook/addon-knobs": "5.3.9",
    "@storybook/addon-links": "^6.0.21",
    "@storybook/cli": "^6.0.21",
    "@storybook/react": "5.3.9",
    "@storybook/react-native": "^5.3.21",
    "@storybook/react-native-server": "^5.3.21",
    "@testing-library/react": "11.2.5",
    "@testing-library/react-hooks": "^3.4.2",
    "@types/googlemaps": "^3.39.13",
    "@types/jest": "26.0.8",
    "@types/node": "14.14.33",
    "@types/react": "~17.0.21",
    "@types/react-datepicker": "^3.1.0",
    "@types/react-native": "~0.67.6",
    "@typescript-eslint/eslint-plugin": "4.3.0",
    "@typescript-eslint/parser": "4.3.0",
    "babel-loader": "8.1.0",
    "babel-plugin-module-resolver": "^4.0.0",
    "babel-plugin-root-import": "^6.5.0",
    "dotenv": "8.2.0",
    "eas-cli": "^2.1.0",
    "enzyme-adapter-react-16": "^1.15.4",
    "eslint": "7.10.0",
    "eslint-config-prettier": "8.1.0",
    "eslint-plugin-cypress": "^2.10.3",
    "eslint-plugin-prettier": "^3.3.1",
    "expo-cli": "^6.0.5",
    "firebase-tools": "^9.10.0",
    "jest": "^26.6.3",
    "jest-expo": "^45.0.0",
    "jest-fetch-mock": "^3.0.3",
    "jest-mock-extended": "^1.0.16",
    "lint-staged": "^10.2.11",
    "prettier": "2.3.2",
    "pretty": "^2.0.0",
    "react-is": "17.0.2",
    "react-native-svg-transformer": "^0.14.3",
    "react-test-renderer": "^16.13.1",
    "ts-jest": "27.0.3",
    "ts-node": "9.1.1",
    "tsconfig-paths": "^3.9.0",
    "tslint": "6.1.3",
    "typescript": "~4.3.5",
    "uri-scheme": "~1.0.108"
  },

Any help or ideas would be much appreciated!

hi there! this guide recommends some steps to go through to debug this issue: Troubleshooting build errors and crashes - Expo Documentation

  • removing all dependencies, React code, etc from my app to try to determine the source of the issue - it still won’t start when built with EAS even if it is basically just <Text>hello world</Text> with no dependencies beyond what’s needed to build/run that.

this is a great step to take! it sounds like you’ve effectively narrowed down that there is an issue outside of your code and imported dependencies. it’s not clear here if you actually removed the dependencies from your package.json. that is a good next thing to do. fyi/manual-debugging.md at main · expo/fyi · GitHub

of course - this is a very slow process, and it’d be much quicker to iterate on this by using prebuild to play around with this locally. (clean up when you’re done or gitignore the native directories)

  • tried to do an ios prebuild to debug in XCode - this failed to build for me because I’m on an M1 Mac, and I’m not going to go down a rabbit hole trying to fix that

m1 works pretty well with most tools these days. not sure what failed for you but you can likely google and find a quick solution for the issue.

another tip - if you do a simulator build it’s fairly easy to see your logs, so you can get information about the crash by opening up Console.app, selecting the device, and hitting the “Start” button