Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK51][Dev Client] Development client on android fails to open eas update from updates list with "Failed to open app" #28888

Open
romanonthego opened this issue May 15, 2024 · 17 comments

Comments

@romanonthego
Copy link

romanonthego commented May 15, 2024

Summary

Development client on android fails to open an update from the updates list with "Failed to open app" message:


Update itself also seems fine as you could open it just fine from direct url:

image

iOS seems fine, no issues encountered as well no issues had been seen with SKD49 and SDK50;

Managed or bare workflow?

bare

What platform(s) does this occur on?

Android

Package versions

"expo-dev-client": "~4.0.13",
"expo-updates": "~0.25.11",
"expo": "~51.0.4",
"react-native": "0.74.1",

Environment

expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 14.4.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 21.7.3 - /opt/homebrew/bin/node
      Yarn: 1.22.21 - /opt/homebrew/bin/yarn
      npm: 10.5.0 - /opt/homebrew/bin/npm
      Watchman: 2024.04.15.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.15.2 - /opt/homebrew/lib/ruby/gems/3.0.0/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
    IDEs:
      Android Studio: 2021.1 AI-211.7628.21.2111.8139111
      Xcode: 15.3/15E204a - /usr/bin/xcodebuild
    npmGlobalPackages:
      eas-cli: 9.0.5
      expo-cli: 6.3.10
    Expo Workflow: bare

Reproducible demo

https://github.com/romanonthego/empty-app

Stacktrace (if a crash is involved)

No response

@romanonthego romanonthego added Development Builds needs validation Issue needs to be validated labels May 15, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels May 15, 2024
@romanonthego romanonthego changed the title Development client on android fails to open eas update from updates list [SDK51] [Dev Client] Development client on android fails to open eas update from updates list May 15, 2024
@romanonthego romanonthego changed the title [SDK51] [Dev Client] Development client on android fails to open eas update from updates list [SDK51][Dev Client] Development client on android fails to open eas update from updates list May 15, 2024
@romanonthego romanonthego changed the title [SDK51][Dev Client] Development client on android fails to open eas update from updates list [SDK51][Dev Client] Development client on android fails to open eas update from updates list with "Failed to open app" May 15, 2024
@romanonthego
Copy link
Author

romanonthego commented May 15, 2024

More information: it appears that expo server is responding with 406 status code for https://u.expo.dev/update/:uuid

this is the request from the android network inspector:

curl 'https://u.expo.dev/update/:update_id:' \
  -H 'accept: application/expo+json,application/json' \
  -H 'accept-encoding: gzip' \
  -H 'connection: Keep-Alive' \
  -H 'expo-dev-client-id: :client_id:' \
  -H 'expo-platform: android' \
  -H 'host: u.expo.dev' \
  -H 'user-agent: okhttp/4.11.0' \
  --compressed

> EAS Update clients must accept "multipart/mixed" responses

adding multipart/mixed fixes the issue with the request:

curl 'https://u.expo.dev/update/:update_id:' \
  -H 'accept: application/expo+json,application/json,multipart/mixed' \
  -H 'accept-encoding: gzip' \
  -H 'connection: Keep-Alive' \
  -H 'expo-dev-client-id: :client_id:' \
  -H 'expo-platform: android' \
  -H 'host: u.expo.dev' \
  -H 'user-agent: okhttp/4.11.0' \
  --compressed

> -------ExpoManifestBoundary-LQ4Qq5LDR7qrETeHacn_3A
> Content-Disposition: form-data; name="manifest"
> Content-Type: application/json
> .....

@brentvatne
Copy link
Member

hi there! can you share a link to the full update url to secure@expo.dev? thanks

@romanonthego
Copy link
Author

romanonthego commented May 16, 2024

btw, I have tried to apply patch to the expo-dev-launcher

diff --git a/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/manifest/DevLauncherManifestParser.kt b/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/manifest/DevLauncherManifestParser.kt
index 714891a..7b0835d 100644
--- a/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/manifest/DevLauncherManifestParser.kt
+++ b/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/manifest/DevLauncherManifestParser.kt
@@ -42,7 +42,7 @@ class DevLauncherManifestParser(
   private fun getHeaders(): Headers {
     val headersMap = mutableMapOf(
       "expo-platform" to "android",
-      "accept" to "application/expo+json,application/json"
+      "accept" to "application/expo+json,application/json,multipart/mixed"
     )
     if (installationID != null) {
       headersMap["expo-dev-client-id"] = installationID

which in turn lead to another error:

My current theory is that during upgrade to SDK51 we somehow have not properly updated some internal dependencies of expo-dev-launcher? Any tips would help at this point :)

@romanonthego
Copy link
Author

hi there! can you share a link to the full update url to secure@expo.dev? thanks

will do

@romanonthego
Copy link
Author

@brentvatne sorry to bother you, but did you by any chance have time to check update?

@romanonthego
Copy link
Author

for comparison:
this is request going to the server with SDK49:

curl 'https://u.expo.dev/update/:uuid:' \
  -H 'accept: multipart/mixed,application/expo+json,application/json' \
  -H 'accept-encoding: br,gzip' \
  -H 'connection: Keep-Alive' \
  -H 'eas-client-id: :uuid:' \
  -H 'expo-accept-signature: false' \
  -H 'expo-api-version: 1' \
  -H 'expo-dev-client-id: :uuid:' \
  -H 'expo-json-error: true' \
  -H 'expo-platform: android' \
  -H 'expo-protocol-version: 1' \
  -H 'expo-release-channel: default' \
  -H 'expo-runtime-version: 7.3.1' \
  -H 'expo-updates-environment: DEVELOPMENT' \
  -H 'host: u.expo.dev' \
  -H 'user-agent: okhttp/4.11.0' \
  --compressed

this is after update:

curl 'https://u.expo.dev/update/:uuid:' \
  -H 'accept: application/expo+json,application/json' \
  -H 'accept-encoding: gzip' \
  -H 'connection: Keep-Alive' \
  -H 'expo-dev-client-id: :uuid:' \
  -H 'expo-platform: android' \
  -H 'host: u.expo.dev' \
  -H 'user-agent: okhttp/4.11.0' \
  --compressed

so somehow during the upgrade path I lost relevant headers?..

@expo-bot
Copy link
Collaborator

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@github-actions github-actions bot removed the needs review Issue is ready to be reviewed by a maintainer label May 20, 2024
@brentvatne
Copy link
Member

@romanonthego - can you try to share a minimal reproducible example of this? i can't reproduce this in a new project.

@romanonthego
Copy link
Author

I am in process of creating new project with the same versions.

@wschurman
Copy link
Member

My best guess at a PR that could've affected this is #28662 though a repro is needed to verify definitively.

This occurs when a EAS update is being loaded without using expo-updates to do the loading. Before that PR, this was only done if updatesInterface == null, which if I had to guess also meant that we didn't display the updates extension in the dev client. After this PR it's possible that we still show the updates extension even if the updates configuration is invalid, but when the updates configuration is invalid we don't use expo-updates to load the update.

@romanonthego
Copy link
Author

@brentvatne here is a public repo https://github.com/romanonthego/empty-app (basically the same repo I send you in email)

@romanonthego
Copy link
Author

romanonthego commented May 22, 2024

@wschurman will check, thank you.
here is public repo romanonthego/empty-app

@Kudo
Copy link
Contributor

Kudo commented May 22, 2024

@romanonthego thanks for having the repro. i tried it and it works for me though. could you clarify if i did something differently than your?

  1. patch to use my eas project
diff --git a/android/app/src/development/AndroidManifest.xml b/android/app/src/development/AndroidManifest.xml
index d0bd782..49efcc5 100644
--- a/android/app/src/development/AndroidManifest.xml
+++ b/android/app/src/development/AndroidManifest.xml
@@ -36,7 +36,7 @@
     <meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
     <meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
     <meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
-    <meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://u.expo.dev/0d4825d6-c926-4ccf-87a2-199cafa37ec9"/>
+    <meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://u.expo.dev/04e358b1-adf0-48b8-8f3e-58e4905fbbb3"/>
     <meta-data android:name="expo.modules.updates.EXPO_RUNTIME_VERSION" android:value="@string/expo_runtime_version"/>
     <activity
       android:name=".MainActivity"
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 782b0fb..1ed4a9f 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -28,7 +28,7 @@
     <meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
     <meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
     <meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
-    <meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://u.expo.dev/0d4825d6-c926-4ccf-87a2-199cafa37ec9"/>
+    <meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://u.expo.dev/04e358b1-adf0-48b8-8f3e-58e4905fbbb3"/>
     <meta-data android:name="expo.modules.updates.EXPO_RUNTIME_VERSION" android:value="@string/expo_runtime_version"/>
     <activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/AppTheme" android:exported="true" android:screenOrientation="portrait">
       <intent-filter>
diff --git a/app.json b/app.json
index ab57804..a28ebc1 100644
--- a/app.json
+++ b/app.json
@@ -2,7 +2,7 @@
   "expo": {
     "name": "empty-app",
     "slug": "empty-app",
-    "owner": "romanonthego",
+    "owner": "kudochien",
     "privacy": "hidden",
     "jsEngine": "hermes",
     "platforms": ["android"],
@@ -15,7 +15,7 @@
       "fallbackToCacheTimeout": 0,
       "checkAutomatically": "ON_LOAD",
       "enabled": true,
-      "url": "https://u.expo.dev/0d4825d6-c926-4ccf-87a2-199cafa37ec9"
+      "url": "https://u.expo.dev/04e358b1-adf0-48b8-8f3e-58e4905fbbb3"
     },
     "assetBundlePatterns": ["**/*"],
 
@@ -25,7 +25,7 @@
     },
     "extra": {
       "eas": {
-        "projectId": "0d4825d6-c926-4ccf-87a2-199cafa37ec9"
+        "projectId": "04e358b1-adf0-48b8-8f3e-58e4905fbbb3"
       }
     },
     "runtimeVersion": "1.0.0",
  1. eas build -e development -p android
  2. change something in index.js and run eas update -m "update" --branch development -p android

@romanonthego
Copy link
Author

romanonthego commented May 23, 2024

@Kudo that's very interesting, and maybe key to something here.I did check reproducibility before moving app from org account to personal one:

I will track my steps and recreate build with error;

@romanonthego
Copy link
Author

you are right, this example does not present error anymore when building on EAS, but does so when you run ./gradlew assembleDevelopmentDebug and install apk from there.

@sync
Copy link
Contributor

sync commented May 27, 2024

I am also seeing a similar issue on my side with Android the the expo sdk 51 when running eas build locally:

The HEAD requests all fail with a 406 not acceptable (missing the multipart/mixed content-type and other headers) and the other request success leading to a crash on boot if CI=true when running eas build --local

HEAD

Screenshot 2024-05-27 at 7 03 45 PM

GET

Screenshot 2024-05-27 at 7 05 04 PM

Edit:

Actually get the same behaviour with expo 50, so my 51 crash is unrelated to this apologies.

Reading through the expo-updates protocol here: https://github.com/expo/expo/blob/main/docs/pages/technical-specs/expo-updates-1.mdx. I don't see anything regarding HEAD requests.

@romanonthego
Copy link
Author

romanonthego commented May 29, 2024

sorry, was caught up in some work stuff.
So far I can confirm what:

  • bug indeed is not reproducible on build builded by EAS Build CI;
  • bug is reproducible on build builded locally with ./gradlew assembleDevelopmentDebug (the same command as in eas.json: "gradleCommand": ":app:assembleDevelopmentDebug");

it was not the case before the upgrade and my best guess right now is that EAS Build does something during Configure expo-updates phase what is missing in local setup and thous making expo-updates configuration invalid?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants