Capacitor core plugins break when setting devServer to 'https'
I’m working on an Android app using Quasar and Capacitor. Everything has been going well until I needed to change the dev server to use https so I can access navigator.mediaDevices (only available over https). However, setting this option in the quasar.conf.js seems to break the core capacitor plugins. For example, the Permissions API plugin errors with ‘the Permissions API is not supported by the web browser’.
I’ve had a google around and found this issue and this issue (I am also getting the ‘window.Capacitor.triggerEvent is not a function’ on first load. Although the page is rendering). Both state issues with running the quasar app through https on Capacitor, however, they also state that this should be fixed in quasar/app v2 which I am using.
Turning off https on the Quasar devServer resolves the issue so I’m assuming it is related to that setting but could be wrong.
Is there be another I need to add to the Capacitor side of things to allow Quasar to run the devServer properly under https without breaking the Capacitor plugin’s functionality? Any help from anyone who may have more knowledge or has run into this before would be greatly appreciated
dobbel last edited by dobbel
What comes to my mind is: you can set https in the devServer but the certificates won’t be valid.( chrome firefox will give you a warning if you try to load the app on your dev machine). Also the phone’s webview/capacitor will see it’s not a valid ssl connection and could cripple things. This could be fixed by some thing like https://ngrok.com
I think you’re right that its to do with the certificates. I did some more research and if I’m reading correctly, setting devServer to https means that Quasar now modifies the webViewClient in Capacitor to allow self-signed certificates (as it originally broke the app). I get the security warning in Chrome as you suggest but not when running on the android device. Could Quasar be modifying the webView for https in a way that means it thinks it doesn’t support the Permissions API?
Looks like building the app is fine and all plugins work with the correct https settings for the mediaDevice access. So I can just work around the issue for now