rollbar / rollbar.js

Error tracking and logging from Javascript to Rollbar
https://docs.rollbar.com/docs/javascript
MIT License
566 stars 212 forks source link

Fix server autoinstrument mergeOptions behavior in node v20+ #1136

Closed jaridmargolin closed 4 months ago

jaridmargolin commented 4 months ago

Description of the change

Problem/Impact

rollbar.js, with autoInstrument turned on, will break all http/https requests in node v20+ that use URL as the first parameter to the request method.

The impact of this should be pretty large as the very popular got package uses this fn signature under the hood for all of it's requests.

Context

In node v20, changes were made to the initialization of urlSearchParams causing a need to update how to sniff out what a URL is. Node made the underlying modification within their code, however rollbar.js has not updated it's mergeOptions function which was originally modeled off the nodejs internals that were changed.

Solution

Node internally, now appears to be using a new internal method isURL however it does not appear that it is exposed. I chose to update the check to use instanceof. I'm not sure if/why there would be a necessity for a more complex approach to checking (perhaps performance?).

Type of change

Related issues

Checklists

Development

Code review

jaridmargolin commented 4 months ago

@waltjones - Sure thing! Glad to get such quick eyes on it.

Do you have insight into when a release containing this change will land? Trying to determine if we need to point at our local branch to unblock, or if it would make sense to wait and update rollbar.js version when released.

waltjones commented 4 months ago

@jaridmargolin It should be late today or early tomorrow.

waltjones commented 4 months ago

@jaridmargolin Released now in 2.26.4. https://github.com/rollbar/rollbar.js/releases/tag/v2.26.4