Question

Expo: env variables undefined in production build

Solved · 8 views · asked by ben_mobile · edited

process.env.API_URL works in Expo Go, is undefined in the EAS build.

What I’ve tried

Set the variable in eas.json under env. Still undefined.

Comment

1 answer

Marked as helpful by the asker
ben_mobile · edited

Two rules for Expo: the variable must start with EXPO_PUBLIC_ to reach the app, and it is inlined at build time, so it has to exist when eas build runs (EAS secrets or eas.json). Anything without the prefix is server-only by design.

Comment