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: depreacted request-promise module #1017

Merged
merged 5 commits into from
Feb 26, 2024
Merged

Conversation

aryamohanan
Copy link
Contributor

@aryamohanan aryamohanan commented Jan 23, 2024

The request-promise module is now deprecated as it relies on the deprecated request package. Please refer to the following link for more information: request/request#3142

In light of this deprecation, we are discontinuing the use of the request-promise module and adopting the node-fetch module as an alternative. node-fetch is a lightweight and widely utilized package. It is important to note that Node.js has introduced a native fetch module starting from version 18. Consequently, once support for Node.js versions 14 and 16 is discontinued, we will seamlessly transition to utilizing the fetch module from node-fetch.

what's pending?

  • Fix all unit test cases other than collector package
  • Fix all unit test cases for collector package
  • uninstall request-promise

Notable Changes

  • request-promise response body is automatically parsed based on content type. With node-fetch, we need to manually parse the response according to the usage.

  • request-promise automatically converts basic data types like objects and arrays to JSON-formatted strings by default, but node-fetch not.

  • node-fetch does not automatically serialize the body in the same way as request-promise, so according to the response header content-type, manually converted to the desired response type.

  • To address the certificate authorization issue with node-fetch, process.env.NODE_TLS_REJECT_UNAUTHORIZED was set to '0' in tests.

The changes are only in test files.

@aryamohanan aryamohanan force-pushed the fix/deprecate-request-promise branch 3 times, most recently from 01d61f6 to 6e09953 Compare January 31, 2024 15:15
@aryamohanan aryamohanan force-pushed the fix/deprecate-request-promise branch 7 times, most recently from 121ef0a to 4bfa27e Compare February 6, 2024 13:09
@aryamohanan aryamohanan force-pushed the fix/deprecate-request-promise branch 4 times, most recently from 7e9c990 to bb3a71b Compare February 19, 2024 16:47
@aryamohanan aryamohanan force-pushed the fix/deprecate-request-promise branch 6 times, most recently from 00ef716 to f797ece Compare February 26, 2024 04:43
@aryamohanan aryamohanan removed the WIP label Feb 26, 2024
@aryamohanan aryamohanan marked this pull request as ready for review February 26, 2024 07:20
@aryamohanan aryamohanan requested a review from a team as a code owner February 26, 2024 07:20
Copy link
Contributor

@kirrg001 kirrg001 left a comment

Choose a reason for hiding this comment

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

Great work!
As discussed, just moving the tls check to the mocharc 👍

@aryamohanan aryamohanan force-pushed the fix/deprecate-request-promise branch 4 times, most recently from cfa9d43 to 7b14d78 Compare February 26, 2024 10:50
@aryamohanan aryamohanan force-pushed the fix/deprecate-request-promise branch from 7b14d78 to 87bf25c Compare February 26, 2024 10:51
@aryamohanan aryamohanan merged commit 6bb88dd into main Feb 26, 2024
1 check passed
@aryamohanan aryamohanan deleted the fix/deprecate-request-promise branch February 26, 2024 11:12
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.

2 participants