expo / expo-github-action

Expo GitHub Action makes it easy to automate EAS builds or updates
MIT License
795 stars 77 forks source link

`dev-client` qr code scheme does not work for underscores in app slug #251

Closed homburg closed 10 months ago

homburg commented 10 months ago

Description of the bug

If you have underscores in your app slug and are using expo-dev-client builds, the pr preview QR codes will not work.

To Reproduce

  1. Create expo project with underscore in app slug, eg: https://github.com/homburg/HelloExpo/pull/1
  2. Use expo preview action to generate QR code
  3. scan QR code to load EAS update in dev-client app build

Expected behavior

Expected the installed dev-client app to load the update from the QR code

Actual behavior

Received a system error message, (paraphrased): "No apps are registered for this url"

Additional context

As seen in this example pull-request: https://github.com/homburg/HelloExpo/pull/1:

The app with app slug: hello_expo generates an url scheme registration in AndroidManifest.xml as <data android:scheme="exp+helloexpo"/> (without underscore).

The preview action generates a qr code with the appScheme query variable set verbatim from the slug config value.

The mismatch between registered scheme and QR code scheme results in an error.

homburg commented 10 months ago

Actually seems like an issue that appScheme for the QR code is generated from the slug value instead of scheme value(s) compared to this: https://github.com/expo/expo-github-action/issues/214#issuecomment-1599383864 unless I'm misunderstanding @byCedric

byCedric commented 10 months ago

Hi @homburg! Thanks for creating this issue. There seems to be some confusion around the slug, schemes, and how they relate to the QR codes from expo/expo-github-action/preview.

One thing that seems to be missing or incorrect, is that the plugin removes specific characters from this generated exp+<slug> scheme (here). I think this is affecting you right now.

To answer this question:

Actually seems like an issue that appScheme for the QR code is generated from the slug value instead of scheme value(s) compared to this: https://github.com/expo/expo-github-action/issues/214#issuecomment-1599383864 unless I'm misunderstanding @byCedric

Yep, that's correct, because the expo-dev-client plugin uses the slug for the generated exp+helloworld scheme in your Android manifest. I know it's a bit confusing 🙈

byCedric commented 10 months ago

I'll release a patch version soon for v8 that fixes this

expo-bot commented 10 months ago

:tada: This issue has been resolved in version 8.2.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

byCedric commented 10 months ago

Let me know if this doesn't fix your issue @homburg! 😄 If you are using expo/expo-github-action/preview@v8, you can just rerun everything. The tag has been updated.

homburg commented 10 months ago

Thanks @byCedric that fixes my QR codes!

And thanks for the great explanation. Makes sense that dev-client scheme is independent of scheme config (by using the app slug)

byCedric commented 10 months ago

Awesome, glad we could resolve it fast. And again, sorry for the confusing property names.