expo: expo-updates must be configured with a valid update URL or scope key

šŸ› Bug Report

I created a project with expo,but want to eject it.

everthing looks very well,but i run the project in xcode,finally,it report ā€œexpo-updates must be configured with a valid update URL or scope keyā€

package.json

{
  "scripts": {
    "start": "react-native start",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "expo": "~40.0.0",
    "expo-splash-screen": "~0.8.0",
    "expo-status-bar": "~1.0.3",
    "expo-updates": "~0.4.0",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "~0.63.4",
    "react-native-gesture-handler": "~1.8.0",
    "react-native-reanimated": "~1.13.0",
    "react-native-screens": "~2.15.0",
    "react-native-unimodules": "~0.12.0",
    "react-native-web": "~0.13.12"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0",
    "babel-jest": "~25.2.6",
    "jest": "~25.2.6",
    "react-test-renderer": "~16.13.1"
  },
  "private": true,
  "name": "expo-eject-test",
  "version": "1.0.0"
}

image

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (1 by maintainers)

Most upvoted comments

I just ran into this issue with a new project created and ejected today. In my case I had ios/<AppName>/Supporting/Expo.plist. I tried setting the EXUpdatesEnabled key to false, but the app still crashed with this error. I did notice I did not have a key for EXUpdatesURL so I added one with a fake value of https://example.com and that step worked for me. My app now loads correctly.

ok after investigating I found the reason why , the update url is put in the android manifest generated by expo eject ONLY if you have done expo login before , so adding a expo login step before solved my issue

Just ran into this issue myself but in android. I never logged in via expo, and I’ve already ejected. The most frustrating thing was that I didn’t see a build error nor an error during debugging. Only when I listened to my device using adb logcat did I find out about the issue:

02-20 13:34:15.401 10040 10040 E AndroidRuntime: java.lang.AssertionError: expo-updates must be configured with a valid update URL or scope key.
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at expo.modules.updates.UpdatesConfiguration.maybeSetDefaultScopeKey(UpdatesConfiguration.java:200)
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at expo.modules.updates.UpdatesConfiguration.loadValuesFromMetadata(UpdatesConfiguration.java:99)
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at expo.modules.updates.UpdatesController.initialize(UpdatesController.java:89)
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at com.heythere.heythere.MainApplication.onCreate(MainApplication.java:84)
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1190)
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7127)
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7077)
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at android.app.ActivityThread.access$1500(ActivityThread.java:273)
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2096)
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:107)
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:237)
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:8107)
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
02-20 13:34:15.401 10040 10040 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)

I built a fresh expo ejected app and I still got the error. Follow this guide and make sure expo-updates has been configured properly. In my case, only the AndroidManifest.xml lacked the following 2 lines

<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/@my-expo-username/my-app" />
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="38.0.0" />

Hence the most likely reason is the fact that I never logged in to Expo.

For me the fix was in app.json

I was missing the url in the expo updates object. Not sure why it never broke builds before, but this change helped me.

"expo": 
    "updates": {
       "url": "YOUR-APP-URL-HERE"
     }
}

Would be nice if expo didn’t let you eject without logging in, or at least handled this case correctly.

Does anyone know how to do this without expo login? I’m only using expo eject in the pipeline build process on Github Actions and I’m not sure if I should add expo login action there just for having the correct file or I can do something else, because I’m still using expo in the project.

I was able to get around this issue without doing expo login by editing ios/<AppName>/Supporting/Expo.plist and adding a key for EXUpdatesURL like so:

<key>EXUpdatesURL</key>
<string>https://example.com</string>

This causes the update check to fail, but the build to succeed. I tried setting EXUpdatesEnabled to false and EXUpdatesCheckOnLaunch to NEVER, but I didn’t find those had any impact on the process.

@byCedric was it closed because there’s a workaround ?

because as the other said, that’s a pitfall really easy to fall in, and at least the documentation should mention it, at best expo eject should warn or forbid from doing it without expo login

Hi @chinavane, thanks for writing in. I’m not sure why the expo-updates configuration isn’t applied on eject, I can’t reproduce that when I eject a new project from expo init.

One thing to check is the ios/<AppName>/Supporting/Expo.plist file. This file is the (missing) configuration this error is telling you about. Over here you can find an example file that you can copy if it’s not there. You should use 40.0.0 for EXUpdatesSDKVersion and your expo username + app name for EXUpdatesURL.

Hope this helps!