getsentry / sentry-cocoa

The official Sentry SDK for iOS, tvOS, macOS, watchOS.
https://sentry.io/for/cocoa/
MIT License
803 stars 316 forks source link

Integration `enableNetworkBreadcrumbs` causes requests to fail #4098

Open bitsandfoxes opened 3 months ago

bitsandfoxes commented 3 months ago

Description

I've got a repro that I shared with @brustolin. In a Unity game, subsequent requests fail with error 404. The request URL gets modified by having it appended and separated by a ,. I.e. example.com,example.com See original issue https://github.com/getsentry/sentry-unity/issues/1658 Setting enableNetworkBreadcrumbs = NO "fixes" the issue.

brustolin commented 3 months ago

The request URL gets modified by having it appended and separated by a ,

Where did you assert this problem? In the native layer, the moment we're creating the breadcrumb, the url is correct.

bitsandfoxes commented 3 months ago

Where did you assert this problem?

I can repro this locally by logging the request URL on the C# layer.

brustolin commented 3 months ago

I did some tests and I don't think Unity also swizzle NSSessionTask, I was afraid that two swizzling could be causing some problem.

Also, I noticed that the second request fails even before the swizzled function is called.

In the native layer the url is not duplicated, which makes this even more bizarre.

More investigation will be required