EAS build works, but the app crashes when loading from Test Flight

My environment: Managed workflow, expo-cli v5.0.2, eas-cli v0.41.1

We have been building and deploying builds of our mobile app just fine using “expo build”. In fact, I deployed one yesterday to the app stores and it’s working great.

Using that exact same code base, when I use “eas build”, the build succeeds but when I load it up in Test Flight, the app crashes immediately.

We have Sentry installed, and I see the following error reported before the crash:

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
    See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

Pretty sure we are using hooks properly, and we have matching React versions since we are able to deploy with “expo build” and run in the “expo go” client just fine. Could something in the “eas build” process be messing this up?

If any of the Expo team sees this, here is my build link: Build Details — 8a2cb150-3d0b-4331-a824-7057637bf6d0 — mobile — Expo

Hi @lehresman

That’s a weird one. The following might give you a hint. Why does my app work in Expo Go and expo build:[android|ios] but not with EAS Build?

Otherwise maybe try building an Internal Distribution version of the app and see if you have more luck debugging that locally.

If the above doesn’t help, try cutting down the app to see if you can figure out which part of it or which dependency the error is coming from. Or try creating a new app and adding dependencies and code from your real app until it also starts having the same problem.