Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix server autoinstrument mergeOptions behavior in node v20+ #1136

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

jaridmargolin
Copy link
Contributor

@jaridmargolin jaridmargolin commented Mar 15, 2024

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

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

Related issues

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers assigned
  • Issue from task tracker has a link to this pull request
  • Changes have been reviewed by at least one other engineer

Copy link
Contributor

@waltjones waltjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaridmargolin Looks good. Thank you for the PR!

@waltjones waltjones merged commit 35255bd into rollbar:master Mar 18, 2024
5 checks passed
@jaridmargolin
Copy link
Contributor Author

@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
Copy link
Contributor

@jaridmargolin It should be late today or early tomorrow.

@waltjones
Copy link
Contributor

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

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.

autoInstrument is broken with got library
2 participants