Closed jrusso1020 closed 1 month ago
Hello @jrusso1020 checking this out now.
Looks like https://github.com/PostHog/posthog-ios/blob/333ca7fa6d5072b1fa12f93226c2e8ea153f3b45/PostHog/Replay/URLSessionInterceptor.swift#L27 gets called correctly, but https://github.com/PostHog/posthog-ios/blob/333ca7fa6d5072b1fa12f93226c2e8ea153f3b45/PostHog/Replay/URLSessionInterceptor.swift#L59 not, checking why's that.
The reason is that RN uses the URLSession.shared.dataTask(with: X)
instead of the methods using the method with completionHandler
, so the instrumentation (swizzling) isn't picking it up correctly.
Libraries that would use the URLSession.shared.dataTask(with: X, { completionHandler }
would be captured correctly, but if libraries would also use the URLSession.shared.dataTask(with: X)
it'd not work either.
Checking how to fix this.
Thanks for the quick update and work here @marandaneto ! will stay up to date and happy to try out any fix you have
I've opened this issue for later refactoring https://github.com/PostHog/posthog-ios/issues/204 https://github.com/PostHog/posthog-ios/releases/tag/3.12.6 should be a quick fix for now. The RN session plugin uses the latest posthog-ios version, so if you update your Pods, you can test this (be sure its using the 3.12.6 version).
@marandaneto just tested it out with a local build and looks like it's working now for us thanks for the quick fix!
Bug Description
Bug description
When enabling react native session replays, we are noticing that only network requests from third party SDKs are being recorded. For example, requests to revenue cat or sentry which come from their own react native packages.
Network requests to our own backend are not being recorded, throughout the entire session. We use
fetch
for requests in our react native application.here's a link to our screen recording for help debugging
Please describe. If this affects the front-end, screenshots would be of great help.
If you are on PostHog Cloud it would be really valuable if you can share any links where the problem occurs. This speeds up our ability to troubleshoot tremendously.
How to reproduce
Additional context
Fetch
We initialize our API client to use fetch like so
And then make requests like so, similar for 'get' requests as well
the
Content-Type
will either beapplication/json
ortext/plain
(used for sending base64 encoded protocol buffers)And example fetch request
Posthog Initailization
We enable the posthog client separately and then pass this into the posthogProvider
Package versions
We don't technically use expo to build our app but including it as well
Testing on iOS 18 (built and running on an actual device, not a simulator)
Debug info