<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Capacitor HTTP/Native HTTP not working with Cordova-Plugin in Real User Monitoring</title>
    <link>https://community.dynatrace.com/t5/Real-User-Monitoring/Capacitor-HTTP-Native-HTTP-not-working-with-Cordova-Plugin/m-p/239285#M5782</link>
    <description>&lt;P&gt;I've run into a similar issue between Capacitor, the Dynatrace Cordova plugin and&amp;nbsp;&lt;A href="https://github.com/oracle/cordova-plugin-wkwebview-file-xhr" target="_self"&gt;cordova-plugin-wkwebview-file-xhr&lt;/A&gt;&amp;nbsp;for native requests. The injected Dynatrace JS on the index page will throw a series of&amp;nbsp;&lt;STRONG&gt;RangeErrors&amp;nbsp;&lt;/STRONG&gt;that prevent requests from completing. No solution yet, however&amp;nbsp;&lt;A href="https://github.com/silkimen/cordova-plugin-advanced-http" target="_self"&gt;cordova-plugin-advanced-http&lt;/A&gt;&amp;nbsp;seems to play nicely with the Capacitor and the Dynatrace Cordova plugin.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2024 18:50:49 GMT</pubDate>
    <dc:creator>ltrempe</dc:creator>
    <dc:date>2024-03-07T18:50:49Z</dc:date>
    <item>
      <title>Capacitor HTTP/Native HTTP not working with Cordova-Plugin</title>
      <link>https://community.dynatrace.com/t5/Real-User-Monitoring/Capacitor-HTTP-Native-HTTP-not-working-with-Cordova-Plugin/m-p/233612#M5781</link>
      <description>&lt;P&gt;We have a case where we instrument our Cordova/Capacitor Mobile App with Dynatrace.&lt;/P&gt;
&lt;P&gt;Cordova Plugin v 2.279.2.&lt;BR /&gt;&lt;BR /&gt;However if we have the following Setting&lt;/P&gt;
&lt;PRE&gt;{
&amp;nbsp;&amp;nbsp;"plugins": {
 &amp;nbsp;&amp;nbsp; "CapacitorHttp": {
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "enabled": true
 &amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;}
}&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;we experience error messages in the Angular part.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Error when sending batch of logs to server TypeError: Ze.addEventListener is not a function TypeError: Ze. addEventListener is not a function
at d. &amp;lt;anonymous&amp;gt; (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) 
...

&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;Once we disable CapacitorHttp&amp;nbsp; we don't have any issues, however the Application requires this setting to run properly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Details&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Capacitor Version 5.5.0&lt;/P&gt;
&lt;P&gt;Cordova Plugin v 2.279.2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Configuration according to plugin documentation&lt;/LI&gt;
&lt;LI&gt;o JS is loaded inline, JS was downloaded from Dynatrace UI as documented&lt;/LI&gt;
&lt;LI&gt;o Adaptation of the config for native requests has no influence on the error (&lt;A class="" title="https://www.npmjs.com/package/@dynatrace/cordova-plugin#native-webrequests)" href="https://www.npmjs.com/package/@dynatrace/cordova-plugin#native-webrequests)" target="_blank" rel="noreferrer noopener"&gt;https://www.npmjs.com/package/@dynatrace/cordova-plugin#native-webrequests)&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Native Http from Capacitor is used, which uses monkey patching for XMLHttpRequest -&amp;gt; &lt;A class="" title="https://capacitorjs.com/docs/apis/http" href="https://capacitorjs.com/docs/apis/http" target="_blank" rel="noreferrer noopener"&gt;https://capacitorjs.com/docs/apis/http&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Tested combinations&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;JS Agent with Native http -&amp;gt; Throws JS Error (In Angular Core, http.mjs)&lt;/LI&gt;
&lt;LI&gt;o Object instance is window.XMLHttpRequest -&amp;gt; Object&lt;/LI&gt;
&lt;LI&gt;JS Agent without Native http -&amp;gt; Works&lt;/LI&gt;
&lt;LI&gt;o Object instance is XMLHttpRequest -&amp;gt; XMLHttpRequestEventTarget -&amp;gt; EventTarget&lt;/LI&gt;
&lt;LI&gt;Native http alone -&amp;gt; Works&lt;/LI&gt;
&lt;LI&gt;o Object instance is XMLHttpRequest -&amp;gt; XMLHttpRequestEventTarget -&amp;gt; EventTarget&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Assumption&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;JS Agent also uses monkey patching and gets in the way with Native-http plugin.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Anyone has the encountered a similar issue? any solutions? Thanks in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 09:49:52 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Real-User-Monitoring/Capacitor-HTTP-Native-HTTP-not-working-with-Cordova-Plugin/m-p/233612#M5781</guid>
      <dc:creator>MarcoCritti</dc:creator>
      <dc:date>2024-03-08T09:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Capacitor HTTP/Native HTTP not working with Cordova-Plugin</title>
      <link>https://community.dynatrace.com/t5/Real-User-Monitoring/Capacitor-HTTP-Native-HTTP-not-working-with-Cordova-Plugin/m-p/239285#M5782</link>
      <description>&lt;P&gt;I've run into a similar issue between Capacitor, the Dynatrace Cordova plugin and&amp;nbsp;&lt;A href="https://github.com/oracle/cordova-plugin-wkwebview-file-xhr" target="_self"&gt;cordova-plugin-wkwebview-file-xhr&lt;/A&gt;&amp;nbsp;for native requests. The injected Dynatrace JS on the index page will throw a series of&amp;nbsp;&lt;STRONG&gt;RangeErrors&amp;nbsp;&lt;/STRONG&gt;that prevent requests from completing. No solution yet, however&amp;nbsp;&lt;A href="https://github.com/silkimen/cordova-plugin-advanced-http" target="_self"&gt;cordova-plugin-advanced-http&lt;/A&gt;&amp;nbsp;seems to play nicely with the Capacitor and the Dynatrace Cordova plugin.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 18:50:49 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Real-User-Monitoring/Capacitor-HTTP-Native-HTTP-not-working-with-Cordova-Plugin/m-p/239285#M5782</guid>
      <dc:creator>ltrempe</dc:creator>
      <dc:date>2024-03-07T18:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: Capacitor HTTP/Native HTTP not working with Cordova-Plugin</title>
      <link>https://community.dynatrace.com/t5/Real-User-Monitoring/Capacitor-HTTP-Native-HTTP-not-working-with-Cordova-Plugin/m-p/239343#M5783</link>
      <description>&lt;P&gt;Please open a support ticket and we will take a look. This is way to complex for the community board here.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 10:38:13 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Real-User-Monitoring/Capacitor-HTTP-Native-HTTP-not-working-with-Cordova-Plugin/m-p/239343#M5783</guid>
      <dc:creator>matthias_hochri</dc:creator>
      <dc:date>2024-03-08T10:38:13Z</dc:date>
    </item>
  </channel>
</rss>

