-
Notifications
You must be signed in to change notification settings - Fork 31
fix: Fix issue processing URLs for fetch and XHR requests. #783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix issue processing URLs for fetch and XHR requests. #783
Conversation
| this._maxPendingEvents = _options.maxPendingEvents; | ||
| this._maxBreadcrumbs = _options.breadcrumbs.maxBreadcrumbs; | ||
|
|
||
| // Set the initial logger, it may be replaced when the client is registered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logger can potentially be used earlier in the process now.
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
| // This will work in browser environments, but in the future we may want to consider an approach | ||
| // which doesn't rely on the browser's URL parsing. This is because other environments we may | ||
| // want to target, such as ReactNative, may not have as robust URL parsing. | ||
| const urlObj = new URL(url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was failing with relative URLs.
| } | ||
| } | ||
| } catch { | ||
| // Could not parse the URL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very basic approach. I already had some notes up above to come back to this and make it more flexible. Unfortuntely URL.canParse isn't widely available yet.
🤖 I have created a release *beep* *boop* --- <details><summary>browser-telemetry: 1.0.1</summary> ## [1.0.1](browser-telemetry-v1.0.0...browser-telemetry-v1.0.1) (2025-02-18) ### Bug Fixes * Fix issue processing URLs for fetch and XHR requests. ([#783](#783)) ([32cec6a](32cec6a)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
A URL filter was throwing an exception. This fixes the filter to prevent that exception, but it also makes the fetch/xhr wrappers more resilient to ensure we do not prevent requests from functioning when a filter fails.