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

Replace deprecated request package with alternative #135

Open
tobiaslohr opened this issue Apr 7, 2020 · 4 comments
Open

Replace deprecated request package with alternative #135

tobiaslohr opened this issue Apr 7, 2020 · 4 comments
Assignees
Labels

Comments

@tobiaslohr
Copy link
Contributor

NPM package request has been deprecated. We should work to look out for suitable alternatives and start exploring them. One candidate might be got (https://www.npmjs.com/package/got), however alternative options are welcome.

@tobiaslohr tobiaslohr added the task label Apr 7, 2020
@tobiaslohr tobiaslohr self-assigned this Feb 10, 2022
@clavery
Copy link
Contributor

clavery commented Feb 10, 2022

got (like all of Sindre's packages nowadays) is ESM only in the current version. Given that sfcc-ci is commonjs at the moment that adds some friction since you can't do a simple require or you need to use a version < than the current.

I find axios (https://www.npmjs.com/package/axios) works fine for OCAPI, webdav (i.e. for both text and binary content). Still works fine with commonjs and is promise-native. So if we ever want to drop support for node<12 (which itself is EOL in April anyway) we could use it async as well. I use it here for ocapi/webdav and AM: https://github.com/SalesforceCommerceCloud/b2c-tools/blob/main/lib/environment.js

@nickpalmigiano
Copy link
Contributor

axios seems like a more straightforward replacement since it keeps the same architecture patterns. While I like the fact that sfcc-ci follows similar design patterns as the storefront architecture, with pwa-kit this is less important. Since sfcc-ci is used by many different environment combinations I would consider node version compatibility important. Either got or axios would work since they seem to be the most well maintained, just have to understand the trade-offs.

@gokaygurcan
Copy link
Member

https://npmtrends.com/axios-vs-fetch-vs-got-vs-ky-vs-request-vs-simple-get-vs-superagent

Looks like Axios is very reliable alternative.

Currently, there're 3 warnings, and they're all related to request package:

npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

@tobiaslohr do you need any support on this?

@tobiaslohr
Copy link
Contributor Author

@gokaygurcan Yes, I do! Happy to get support for this. I think there are a few candidates, also see this thread request/request#3143.

While there are personal preferences I think we should ensure that the replacement accounts at least for the following principles:

  • Active community
  • Promise support (to be able to gracefully migrate from callbacks to promises)
  • Streaming support (for WebDAV requests)
  • Lightweight (arguable)
  • Usage in other tools (arguable)

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants