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

bug: Capacitor does not initialised when server.url uses ssl on Android #6291

Closed
adrigardi90 opened this issue Feb 11, 2023 · 5 comments
Closed

Comments

@adrigardi90
Copy link

Bug Report

Capacitor Version

4.6.2

Platform(s)

Android

Current Behavior

Given a project with appendUserAgent and server.url pointing to a https link:

  appendUserAgent: `test`,
  server: {
    url: "https://xxxx",
    cleartext: true,
    androidScheme: "https",
    allowNavigation: [`*`],
  },

Capacitor does not initialised, hence it's not available in the global window object:

android

Expected Behavior

Capacitor should get initialised and injected in the global window once the link gets rendered as it happens on iOS:
ios

Code Reproduction

Check here the steps to reproduce it.

Other Technical Details

npm --version output: 6.14.8

node --version output: v12.20.0

Additional Context

Worth to mention I explicitly need appendUserAgent property. In some cases it looks it works pointing to a different https link. But in some others, overrideUserAgent is the only way to make it work. So depending on the link and the userAgent value Capacitor gets available or not.

I check related issues: #3707, #7234, #5354 but I don't spot any similarity.

In this case I don't see any log related to a SSL issue nor to a problem on the Bridge at some point. In fact, I always see the plugins get registered without errors and the app gets started:

02-10 19:12:47.968  7838  7838 D Capacitor: Starting BridgeActivity
02-10 19:12:47.978  7838  7838 D Capacitor: Registering plugin: WebView
02-10 19:12:47.983  7838  7838 D Capacitor: Registering plugin: Camera
02-10 19:12:47.986  7838  7838 D Capacitor: Registering plugin: Device
02-10 19:12:47.989  7838  7838 D Capacitor: Registering plugin: Filesystem
02-10 19:12:47.993  7838  7838 D Capacitor: Registering plugin: SplashScreen
02-10 19:12:48.043  7838  7838 W Capacitor: Unable to read file at path public/plugins
02-10 19:12:48.045  7838  7838 D Capacitor: Loading app at https://xxxxx
02-10 19:12:48.050  7838  7838 E Capacitor: System WebView is not supported
02-10 19:12:48.054  7838  7838 D Capacitor: App started

("System WebView is not supported" is a debug log when the Android version is not the minimum one, but it does not prevent the app to get started. Other links with the same log work)

However, Capacitor is not available once the link is rendered, in contrast to iOS where it works seamlessly.

I tried with different Android devices on the emulator and BrowserStack but I always get the same issue.

@adrigardi90
Copy link
Author

Any update on this please? It's a blocker at the moment

@jcesarmobile
Copy link
Member

the sample app you provided requires user/password that are not provided on the steps to reproduce, can you provide them?

@jcesarmobile jcesarmobile added the needs reply needs reply from the user label Feb 22, 2023
@adrigardi90
Copy link
Author

Changed, it should work now without credentials

@Ionitron Ionitron removed the needs reply needs reply from the user label Feb 24, 2023
@jcesarmobile
Copy link
Member

the provided url doesn't return anything, Capacitor only injects itself in html pages with a head tag
it's mentioned here
https://capacitorjs.com/docs/getting-started#add-capacitor-to-your-web-app

@jcesarmobile jcesarmobile closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2023
@ionitron-bot
Copy link

ionitron-bot bot commented Mar 30, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Mar 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants