Secret works in EAS builds but is wrong locally (401 in dev only)
ExpoConfirmed fix
@expo/env (dotenv-expand)
There is no error message for this one, only the symptom in the title.
Cause
Expo's .env loader expands $name inside values as variable references, so a secret containing $ loses characters locally. EAS-hosted env vars are not expanded, so production gets the right value.
Fix
Escape it as \$ in .env. Check what Expo actually loads:
shell
node -e "require('@expo/env').load('.',{force:true,silent:true});console.log(process.env.MY_VAR.length)"Then restart Metro with --clear.
More Expo errors
- Dev client red screen: No script URL provided (launcher never appears)No script URL provided
- Bundle fails with Invalid expression encountered after supabase-js updateInvalid expression encountered
- After upgrading to SDK 57, expo-font / expo-image / expo-asset config is missing
- SDK upgrade: export dies with SyntaxError after expo install --fixSyntaxError: ... Unable to determine event arguments for "onModeChange"
- expo-doctor wants TypeScript 6 but tsc reports hundreds of errors