Showing results for 
Show  only  | Search instead for 
Did you mean: 

Capacitor HTTP/Native HTTP not working with Cordova-Plugin


We have a case where we instrument our Cordova/Capacitor Mobile App with Dynatrace.

Cordova Plugin v 2.279.2.

However if we have the following Setting

  "plugins": {
    "CapacitorHttp": {
      "enabled": true

we experience error messages in the Angular part.  

Error when sending batch of logs to server TypeError: Ze.addEventListener is not a function TypeError: Ze. addEventListener is not a function
at d. <anonymous> (http.mis:2176:21)
at d._zoneSubscribe ( 68:50)
at d. trySubscribe (Observable. js: 37:25) 
at Observable. js: 31:30 
at K (errorContext.js: 19:9) 
at d. subscribe (Observable. is: 22:9) 


Once we disable CapacitorHttp  we don't have any issues, however the Application requires this setting to run properly.



Capacitor Version 5.5.0

Cordova Plugin v 2.279.2


Tested combinations

  • JS Agent with Native http -> Throws JS Error (In Angular Core, http.mjs)
  • o Object instance is window.XMLHttpRequest -> Object
  • JS Agent without Native http -> Works
  • o Object instance is XMLHttpRequest -> XMLHttpRequestEventTarget -> EventTarget
  • Native http alone -> Works
  • o Object instance is XMLHttpRequest -> XMLHttpRequestEventTarget -> EventTarget



 JS Agent also uses monkey patching and gets in the way with Native-http plugin.

Anyone has the encountered a similar issue? any solutions? Thanks in advance 🙂



I've run into a similar issue between Capacitor, the Dynatrace Cordova plugin and cordova-plugin-wkwebview-file-xhr for native requests. The injected Dynatrace JS on the index page will throw a series of RangeErrors that prevent requests from completing. No solution yet, however cordova-plugin-advanced-http seems to play nicely with the Capacitor and the Dynatrace Cordova plugin.

Please open a support ticket and we will take a look. This is way to complex for the community board here. 

Featured Posts