You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm submitting a ...
[x] bug report
[] feature request
[ ] support request
Current behavior:
Using the @ionic-native/httpd wrapper and cordova-httpd results in this error message:
Native: tried calling Httpd.startServer, but the Httpd plugin is not installed.
[ng] [console.warn]: Install the Httpd plugin: ‘ionic cordova plugin add cordova-plugin-httpd’
even though the plugin is installed and exists on the window object.
The @ionic-native/httpd class uses getUrl but cordova-httpd uses getURL (capitalization differences).
The reason it says it’s not installed is because Ionic checks if the window object contains the plugin, which passes, and then it does an additional check to see if the called methodName exists on the plugin object, which fails.
It looks like the method name has always been getURL on the cordova-httpd plugin repo, so the only way the plugin works with the native wrapper is if getUrl is never used.
Expected behavior:
Plugin wrapper httpd class should match the method name of the plugin. This will allow the httpd plugin to start up without throwing a warning that says it's not installed.
Steps to reproduce:
Install wrapper and httpd plugin as described here.
Follow the Angular setup as described in the previous link but call this.httpd.getUrl() instead of startServer().
Check the logs and there will be an error about the plugin not being installed.
Other information:
To fix this, the httpd wrapper will have to be restored to this repo as it was removed in this commit.
The issue can be fixed by updating the plugin wrapper httpd class to use getURL instead of getUrl.
I've submitted a PR to the cordova-httpd repo to add support for capacitor builds. It also includes a temporary fix to allow usage of both getUrl and getURL until this PR fixes its usage. See floatinghotpot/cordova-httpd#79.
Also, if the httpd plugin was removed because of incompatibility, I was able to get it working by patching a portion of cordova-httpd. I've filed an issue with the cordova-http repo to actually implement a fix for it. For the most part though, it looks like the repo is no longer maintained.
colossatr0n
changed the title
Restore httpd plugin and update interface
Restore httpd plugin and update interface for getUrlOct 11, 2021
colossatr0n
changed the title
Restore httpd plugin and update interface for getUrl
Restore httpd plugin and update the Httpd interface for getUrlOct 11, 2021
colossatr0n
changed the title
Restore httpd plugin and update the Httpd interface for getUrl
Restore httpd plugin and update the Httpd class to use getURLOct 11, 2021
`getUrl`. Their declaration is for `getURL`. This commit adds
compatibility for both methods and can be reverted once the following
case has a fix:
danielsogl/awesome-cordova-plugins#3805
I'm submitting a ...
[x] bug report
[] feature request
[ ] support request
Current behavior:
Using the
@ionic-native/httpd
wrapper andcordova-httpd
results in this error message:even though the plugin is installed and exists on the
window
object.The
@ionic-native/httpd
class usesgetUrl
butcordova-httpd
uses getURL (capitalization differences).The reason it says it’s not installed is because Ionic checks if the
window
object contains the plugin, which passes, and then it does an additional check to see if the calledmethodName
exists on the plugin object, which fails.That logic can be found here:
awesome-cordova-plugins/src/@awesome-cordova-plugins/core/decorators/common.ts
Line 208 in a1eaeb2
It looks like the method name has always been
getURL
on thecordova-httpd
plugin repo, so the only way the plugin works with the native wrapper is ifgetUrl
is never used.Expected behavior:
Plugin wrapper httpd class should match the method name of the plugin. This will allow the httpd plugin to start up without throwing a warning that says it's not installed.
Steps to reproduce:
Install wrapper and httpd plugin as described here.
Follow the Angular setup as described in the previous link but call
this.httpd.getUrl()
instead ofstartServer()
.Check the logs and there will be an error about the plugin not being installed.
Other information:
To fix this, the httpd wrapper will have to be restored to this repo as it was removed in this commit.
The issue can be fixed by updating the plugin wrapper httpd class to use
getURL
instead ofgetUrl
.I've submitted a PR to the
cordova-httpd
repo to add support for capacitor builds. It also includes a temporary fix to allow usage of bothgetUrl
andgetURL
until this PR fixes its usage. See floatinghotpot/cordova-httpd#79.If the
cordova-httpd
repo doesn't merge the changes, those changes can be found on the ionic-native-capacitor-compatability branch.Also, if the
httpd
plugin was removed because of incompatibility, I was able to get it working by patching a portion ofcordova-httpd
. I've filed an issue with thecordova-http
repo to actually implement a fix for it. For the most part though, it looks like the repo is no longer maintained.Ionic info:
The text was updated successfully, but these errors were encountered: