RUM JavaScript Agent returns 'URL is not a constructor' error

Summary

Applications monitored by RUM generate JavaScript errors referring to ‘URL is not a constructor’ when using RUM Agent 1.329 or higher. This is caused by the RUM Agent using the URL constructor to validate origins.

Problem

Following the release of RUM JavaScript Agent 1.329, some customers have reported encountering JavaScript errors on pages related to ‘URL is not a constructor.’ This occurs because the URL object on the affected page has been overridden by non‑standard code. In other words, something on the application side replaces the native URL constructor with a custom implementation, and that breaks the JS Agent’s ability to function correctly.

Resolution

To resolve the issue, the override of the URL constructor will need to be removed so the browser’s default implementation is restored.

As a temporary solution, you can update your RUM application to use version 1.327 of the RUM JavaScript agent. See how to Control the RUM JavaScript version.

What’s next

This issue arises in version 1.329 because the RUM agent the JS Agent uses the URL constructor to validate origins. This is part of the default, browser‑supported API surface. Please check this Mozilla documentation for more information: Developer Mozilla API URL.

If this article did not help, please open a support ticket, mention that this article was used and provide the following in the ticket:

  • Link to the RUM Application in your Environment
  • Link to the JavaScript Error in your Environment
  • A .HAR file of a page where the problem occurs
12 Likes

Hello,

There should be a resolution from Dynatrace, as this issue did not occur in versions prior to 1.329.

Additionally, the proposed solution — removing the override of the URL constructor — would require action from each organization’s development team. Since the application works without errors when RUM is disabled, this may lead many teams to simply deactivate RUM instead of modifying their code.

1 Like