question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider using `axios` rather than `request`

See original GitHub issue

Hi,

request is deprecated since a long time and it’s now common to use axios. A lot of generated boilerplate could be removed with this change.

Also, request-promise-core have some unhandled promises which are hanging our apps using @hubspot/api-client. Changing the request library will fix this. Also, the OpenAPI generator used here is capable of generating clients with axios so this change would not be that painful.

I clearly understand that this change will cause some sort of big refactor but I think that it is more than relevant to use a well maintained library, especially if you’re relying entirely on it like @hubspot/api-client do:

  "dependencies": {
    "bluebird": "^3.7.2",
    "bottleneck": "^2.19.5",
    "lodash": "^4.17.19",
    "request": "^2.88.0"
  }

You’ll be able to remove bluebird, which is nice too.

EDIT: to give more context on why this should be done, some errors are unhandled which is not your fault but is causing some damages. For instance, while trying to edit a CRM contact with a bad id, maybe the error will be catch, maybe not causing the app to hang without being able to catch it:

    StatusCodeError: 404 - {"status":"error","message":"resource not found","correlationId":"xxx"}

      at new StatusCodeError (../../node_modules/request-promise-core/lib/errors.js:32:15)
      at Request.plumbing.callback (../../node_modules/request-promise-core/lib/plumbing.js:104:33)
      at Request.RP$callback [as _callback] (../../node_modules/request-promise-core/lib/plumbing.js:46:31)
      at Request.self.callback (../../node_modules/request/request.js:185:22)
      at Request.<anonymous> (../../node_modules/request/request.js:1154:10)
      at IncomingMessage.<anonymous> (../../node_modules/request/request.js:1076:12)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:8

github_iconTop GitHub Comments

1reaction
ksvirkou-hubspotcommented, Dec 15, 2021

Hi Everyone We have problems with OpenAPI Generator We are working on it

1reaction
apeinigercommented, Dec 6, 2021

Having the same problem. Github Dependabot is now throwing security warnings because of this outdated dependency.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Axios vs. fetch(): Which is best for making HTTP requests?
Axios is not always an ideal solution; depending on your needs, there are sometimes better options for making HTTP requests.
Read more >
Axios vs. Fetch API – Which is Better For HTTP Requests?
Axios is a library for making HTTP requests in React. ... Actually, Fetch API is a native interface with even more possibilities than...
Read more >
Making HTTP requests with Axios - CircleCI
Axios is a promise-based HTTP library that lets developers make requests to either their own or a third-party server to fetch data.
Read more >
How to Perform HTTP Requests with Axios – A Complete Guide
Sending HTTP requests to your API with Axios is a fantastic tool. ... Instead of promises, we may use async/await to send HTTP...
Read more >
Difference between Fetch and Axios.js for making http requests
One of the fundamental tasks of any web application is to communicate with servers through the HTTP protocol. This can be easily achieved ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found