Fix server autoinstrument mergeOptions behavior in node v20+ #1136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the change
Problem/Impact
rollbar.js
, with autoInstrument turned on, will break all http/https requests in node v20+ that useURL
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 useinstanceof
. 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