# Capacitor HTTP/Native HTTP not working with Cordova-Plugin

**URL:** <https://community.dynatrace.com/t/capacitor-http-native-http-not-working-with-cordova-plugin/43498>\
**Category:** Real User Monitoring\
**Tags:** cordova, mobile-monitoring\
**Created:** [January 8, 2024, 1:43pm UTC](https://community.dynatrace.com/t/capacitor-http-native-http-not-working-with-cordova-plugin/43498 "2024-01-08T13:43:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarcoCritti](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marcocritti/32/8974_2.png) [@MarcoCritti](https://community.dynatrace.com/u/MarcoCritti)\
**Post date:** [January 8, 2024, 1:43pm UTC](https://community.dynatrace.com/t/capacitor-http-native-http-not-working-with-cordova-plugin/43498/1 "2024-01-08T13:43:43Z")

</div>

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

```auto
{
  "plugins": {
    "CapacitorHttp": {
      "enabled": true
    }
  }
}

```

we experience error messages in the Angular part.

```auto
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 (zone-patch-rxis.is: 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&nbsp; we don’t have any issues, however the Application requires this setting to run properly.

**Details**

Capacitor Version 5.5.0

Cordova Plugin v 2.279.2

- Configuration according to plugin documentation
- o JS is loaded inline, JS was downloaded from Dynatrace UI as documented
- o Adaptation of the config for native requests has no influence on the error ([https://www.npmjs.com/package/@dynatrace/cordova-plugin#native-webrequests](https://www.npmjs.com/package/@dynatrace/cordova-plugin#native-webrequests))
- Native Http from Capacitor is used, which uses monkey patching for XMLHttpRequest → [Http Capacitor Plugin API | Capacitor Documentation](https://capacitorjs.com/docs/apis/http)

**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

**Assumption**

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 🙂

---

<div class="post-metadata">

**Author:** ![ltrempe](https://avatars.discourse-cdn.com/v4/letter/l/9de0a6/32.png) [@ltrempe](https://community.dynatrace.com/u/ltrempe)\
**Post date:** [March 7, 2024, 6:50pm UTC](https://community.dynatrace.com/t/capacitor-http-native-http-not-working-with-cordova-plugin/43498/2 "2024-03-07T18:50:49Z")

</div>

I’ve run into a similar issue between Capacitor, the Dynatrace Cordova plugin and&nbsp;[cordova-plugin-wkwebview-file-xhr](https://github.com/oracle/cordova-plugin-wkwebview-file-xhr)&nbsp;for native requests. The injected Dynatrace JS on the index page will throw a series of&nbsp; **RangeErrors** &nbsp;that prevent requests from completing. No solution yet, however&nbsp;[cordova-plugin-advanced-http](https://github.com/silkimen/cordova-plugin-advanced-http)&nbsp;seems to play nicely with the Capacitor and the Dynatrace Cordova plugin.

---

<div class="post-metadata">

**Author:** ![matthias\_hochri](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/matthias_hochri/32/15052_2.png) [@matthias\_hochri](https://community.dynatrace.com/u/matthias_hochri)\
**Post date:** [March 8, 2024, 10:38am UTC](https://community.dynatrace.com/t/capacitor-http-native-http-not-working-with-cordova-plugin/43498/3 "2024-03-08T10:38:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![daanvanhulst](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@daanvanhulst](https://community.dynatrace.com/u/daanvanhulst)\
**Post date:** [October 15, 2026, 12:51pm UTC](https://community.dynatrace.com/t/capacitor-http-native-http-not-working-with-cordova-plugin/43498/4 "2026-10-15T12:51:04Z")

</div>

I am running into the same problem with our application. Was this resolved, or was there some other outcome. Would be good to know.

---

<div class="post-metadata">

**Author:** ![nicholas\_mcwher](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/nicholas_mcwher/32/6822_2.png) [@nicholas\_mcwher](https://community.dynatrace.com/u/nicholas_mcwher)\
**Post date:** [October 19, 2026, 10:51am UTC](https://community.dynatrace.com/t/capacitor-http-native-http-not-working-with-cordova-plugin/43498/5 "2026-10-19T10:51:33Z")

</div>

Hi there.

Are you using the latest plugin version (2.347.1)? We haven’t really seen any support tickets for this issue. I would suggest creating a support ticket with the steps to reproduce and console logs showing the full error etc. so that we can take a further look into the issue. As Matthias mentioned, this is a bit more complex of an issue for the community board.

Thanks!
