Description
Describe the bug
After upgrading our Ionic app to Capacitor version 7 we are getting frequent CapacitorUrlRequestError errors. It doesn't appear to be impacting the Datadog collection but is making our console and DataDog RUM sessions cluttered with noise. This is using DD 6.4.0. Every few seconds we are getting an error like this:
CapacitorHttp fetch 1740676694796 https://browser-intake-us3-datadoghq.com/api/v2/rum?ddsource=browser&ddtags=sdk_version%3A6.4.0%2Capi%3Afetch%2Cenv%3A[removed]%3A[removed]%2Cversion%3A5.0.6&dd-api-key=[removed]&dd-evp-origin-version=6.4.0&dd-evp-origin=browser&dd-request-id=05b37b90-488f-42b6-8329-f9be37f0c36f&dd-evp-encoding=deflate&batch_time=1740676694796: 6.062ms (user-script:2, line 526)
[Error] Error: The operation couldn’t be completed. (Capacitor.CapacitorUrlRequest.CapacitorUrlRequestError error 0.)
(anonymous function) (main.js:9528)
(anonymous function) (polyfills.js:10364)
handleUnhandledRejection (polyfills.js:10385)
(anonymous function) (polyfills.js:10379)
drainMicroTaskQueue (polyfills.js:8677)
[Log] native CapacitorHttp.request (#45858817) (user-script:2, line 345)
[Log] {callbackId: "45858817", pluginId: "CapacitorHttp", methodName: "request", options: Object}ObjectcallbackId: "45858817"methodName: "request"options: {url: "https://browser-intake-us3-datadoghq.com/api/v2/ru…&dd-evp-encoding=deflate&batch_time=1740676694804", method: "POST", data: Blob, headers: {Content-Type: "text/plain"}, dataType: "json"}ObjectpluginId: "CapacitorHttp"type: "message"Object Prototype (user-script:2, line 346)
[Log] result CapacitorHttp.request (#45858817) (user-script:2, line 325)
[Error] Object
code: "Capacitor.CapacitorUrlRequest.CapacitorUrlRequestError"
errorMessage: "The operation couldn’t be completed. (Capacitor.CapacitorUrlRequest.CapacitorUrlRequestError error 0.)"
To Reproduce
Start a session and the errors start showing in the console and datadog session immediately
Expected behavior
I'd expect not to have this noise. It's possible the datadog URL needs to be encoded - see this forum post for reference: https://forum.ionicframework.com/t/capacitorhttp-ios-error/231416/8