aws-observability / aws-rum-web

Amazon CloudWatch RUM Web Client
Apache License 2.0
114 stars 65 forks source link

fix: Ignore URL construction error from invalid performance resource event #532

Closed shubhsheth closed 3 months ago

shubhsheth commented 3 months ago

Based on this PR: https://github.com/aws-observability/aws-rum-web/pull/527

This PR fixes an error originating from recordResourceEvent() method when it tries to process an event that has an invalid name prop. While trying to construct a URL from the string, it fails with Failed to construct 'URL': Invalid URL. This causes the failure from RUM library to be logged as a RUM error event.

Adding a try/catch around the URL construction to silently ignore errors originating from unintended string formats.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

qhanam commented 3 months ago

Nice -- thanks @williazz and @shubhsheth ! LGTM -- just the one unit test in the approval workflow.

shubhsheth commented 3 months ago

Thanks @qhanam and @williazz for working with me on this! I wanted to ask if it's okay if I create a release 1.7.2 up to this change?

qhanam commented 3 months ago

Yes, we can do a patch release for this.