Skip to content

Conversation

@kinyoklion
Copy link
Member

@kinyoklion kinyoklion commented Feb 18, 2025

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.

this._maxPendingEvents = _options.maxPendingEvents;
this._maxBreadcrumbs = _options.breadcrumbs.maxBreadcrumbs;

// Set the initial logger, it may be replaced when the client is registered.
Copy link
Member Author

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.

@github-actions
Copy link
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Size: 19014 bytes
Size limit: 21000

@github-actions
Copy link
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Size: 15371 bytes
Size limit: 20000

@github-actions
Copy link
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Size: 19871 bytes
Size limit: 21000

// 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);
Copy link
Member Author

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.

@kinyoklion kinyoklion marked this pull request as ready for review February 18, 2025 19:11
@kinyoklion kinyoklion requested a review from a team as a code owner February 18, 2025 19:11
}
}
} catch {
// Could not parse the URL.
Copy link
Member Author

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.

@kinyoklion kinyoklion merged commit 32cec6a into main Feb 18, 2025
22 checks passed
@kinyoklion kinyoklion deleted the rlamb/emsr-104/missing-method-fetch-decorator branch February 18, 2025 19:24
@github-actions github-actions bot mentioned this pull request Feb 18, 2025
kinyoklion pushed a commit that referenced this pull request Feb 18, 2025
🤖 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants