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

clientAppUnavailable from getDetails #640

Open
tristan-morris opened this issue Jan 16, 2022 · 6 comments
Open

clientAppUnavailable from getDetails #640

tristan-morris opened this issue Jan 16, 2022 · 6 comments

Comments

@tristan-morris
Copy link

Describe the bug
After calling await window.getDigitalGoodsService('https://play.google.com/billing'), getDetails(['pro']) returns a clientAppUnavailable error. I Googled "clientAppUnavailable" and got a single result. I've poked around a bit but don't appear to have made much progress, however, I'll continue to poke around.

I've had a PWA published in the Google Play Store for close to 18 months now. With the hopeful stabilisation of the Digital Goods and Payment APIs I'm trying to add in-app play billing support. Since my TWA codebase has remained fairly stable and has aged, I re-built from scratch using bubblewrap 1.15 late last week, followed the various prompts, reinstalled android and other deps as prompted (honestly, a very sweet experience - this is amazing!!! Well done guys!) I ticked yes to billing, alpha, notifications (the other clientAppUnavailable error) etc. Built the apk. Verified asset links remained correct. Joined v1 and v2 origin programs etc.

To Reproduce
Steps to reproduce the behavior:

  1. Bubblewrap 1.15 init
  2. Accept prompts for billing, alpha features etc.
  3. Digital links already in place. TWA/PWA delivered over HTTPs into newly built app
  4. Configured subscriptions within Play Billing. Setup Payments profile, verified, tax status etc. All the things afaik. "pro" is the Product ID of the subscription, and it's marked active.
  5. Deployed to test device.
  6. Call per screen shot

image

  1. Have made zero progress unpicking what might be going on. Also pushed a version to internal track (in addition to existing)

Expected behavior
Returns a list of products.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Linux/WSL2
  • Browser N/A
  • Version: Node 16.13.1, NPM 8.1.2

Smartphone (please complete the following information):

  • Device: Pixel 4A 5G
  • OS: Android 12
  • Browser: Chrome
  • Version 97.0.4692.87

Additional context
Add any other context about the problem here.

Any pro-tips would be great! Thanks and awesome product!

@tristan-morris
Copy link
Author

tristan-morris commented Jan 16, 2022

It looks like DelegationService in AndroidManifest.xml is templated relatively as .DelegationService. I changed this to DelegationService without the period, rebuilt, and the call to getDetails(..) came alive.

However, what is insane is that after I made that single change I haven't been able to break it again. I've reverted every change I made, and it still works. Even the known broken build I pushed to the Play Store Internal Track yesterday is working, and it also works on a different device too. So either something was very sad on my dev device (despite many uninstalls, reboots etc.), there was a transient issue with the Play Store, or perhaps there's some kind of trust relationship between the app and play store which needed to expire(?) or take effect. Very strange - but seems to be working for me now.

@tristan-morris
Copy link
Author

As another update, I just installed my app onto another phone with a separate play account but which has access to the Internal Track and I receive the same error.

I'm not sure if users have to be added to the Licence Testing configs as well, so I've tried that and am waiting to see what happens in the morning after some time passes.

@Stevie-Ray
Copy link

What helped me was using: adb logcat -v brief | grep -e TWAConnectionPool and adb logcat -v brief | grep -e OriginVerifier -e digital_asset_links it displayed a scoping issue that was causing the "clientAppUnavailable" issue.

@monstermac77
Copy link

@Stevie-Ray @tristan-morris, we also are hitting this error and have detailed it in #805, and using Stevie's logcat command we see that we also have a scoping issue, but we have no idea what needs fixing? Could you take a look?

Failed to connect to TWA to execute command
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: No service exists for scope
	at K0.c(chromium-TrichromeChromeGoogle6432.aab-stable-573513033:21)
	at K0.get(chromium-TrichromeChromeGoogle6432.aab-stable-573513033:115)
	at vC3.run(chromium-TrichromeChromeGoogle6432.aab-stable-573513033:9)
	at android.os.MessageQueue.nativePollOnce(Native Method)
	at android.os.MessageQueue.next(MessageQueue.java:335)
	at android.os.Looper.loopOnce(Looper.java:186)
	at android.os.Looper.loop(Looper.java:313)
	at android.app.ActivityThread.main(ActivityThread.java:8757)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: java.lang.IllegalArgumentException: No service exists for scope
	at tC3.b(chromium-TrichromeChromeGoogle6432.aab-stable-573513033:67)
	at bg1.a(chromium-TrichromeChromeGoogle6432.aab-stable-573513033:311)
	at yC3.run(chromium-TrichromeChromeGoogle6432.aab-stable-573513033:28)
	at F60.a(chromium-TrichromeChromeGoogle6432.aab-stable-573513033:29)
	at C60.onResult(chromium-TrichromeChromeGoogle6432.aab-stable-573513033:58)
	at gB.run(chromium-TrichromeChromeGoogle6432.aab-stable-573513033:5)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:226)
	at android.os.Looper.loop(Looper.java:313) 
	at android.app.ActivityThread.main(ActivityThread.java:8757) 
	at java.lang.reflect.Method.invoke(Native Method) 
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) 
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067) 

@joelhockey
Copy link

joelhockey commented Jan 12, 2024

I just ran into a problem similar to this. The problem was that my TWA was using 'http', but the app was registered to scope 'https'. I was running my TWA at http://127.0.0.1:8080.

It looks like bubblewrap always assumes scope of https:

            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="https"
                    android:host="@string/hostName"/>
            </intent-filter>

I fixed things by manually editing <data android:scheme="https" to be http (delete the s) in my local app/src/main/AndroidManifest.xml and re-run bubblewrap build

@bulbigood
Copy link

I faced this problem and found out that in my case the problem was linked to Deep Link intent-filter. I removed android:autoVerify and android:sspPattern options, replacing the last one with android:pathPrefix. Also, check that android:host is specified correctly.

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

No branches or pull requests

5 participants