Skip to content

Future of the Node HTTP Client  #38533

Description

@ronag

I see a slight problem with the situation with the node core http client. We are getting issues reported in the issue tracker. However, there is little interest by contributors (that are familiar with the code) to look into these issues and resolve them.

Part of the reason for this is that some of the people that usually engage with http client issues is @mcollina, @dnlup or myself. Whom I believe are mostly focusing on nodejs/undici, which we feel is a better alternative and the future, and have limited interest in putting further effort into the node core http client.

This is a slightly suboptimal situation. I would personally like to discuss whether and how we could encourage users over to NodeJS/undici and eventually deprecating the current node client.

Maybe add something in the docs that point to undici. However, I don’t think this is something we have done in the past.

Thoughts?

Activity

  1. DerekNonGeneric commented on May 1, 2021

    @DerekNonGeneric
    Contributor

    Maybe add something in the docs that point to undici. However, I don’t think this is something we have done in the past.

    I found some prior art that may help: our util.log(string) core function recommends using a third party module, but it's deprecated, which I'm unsure whether would be an appropriate designation in this situation (perhaps more likely legacy).

    Stability: 0 - Deprecated: Use a third party module instead.

    Refs: https://nodejs.org/dist/latest-v16.x/docs/api/util.html#util_util_log_string

  2. mcollina commented on May 4, 2021

    @mcollina
    SponsorMember

    I share @ronag concerns and I would also add one of my own.

    The reason why very few would like to work on the HTTP client is because every change breaks the huge number of modules in the ecosystem that monkeypatch it. Fixing the majority of those bugs requires either breaking some other users or finding some clever hacks that will come hunting us back over the years.

  3. Trott commented on May 4, 2021

    @Trott
    Member

    Since this is on the TSC agenda: @nodejs/tsc

  4. benjamingr commented on May 4, 2021

    @benjamingr
    Member

    I think @jasnell is talking about shipping WHATWG ReadableStream this year (right?), we can also land the polyfill in core in the meantime and just ship fetch (on top of unidici perhaps).

    Then we can direct people to the new API and put the old API in maintenance mode and possibly eventually even deprecate it.

    Another possible alternative would be to land unidici as part of core (or as a dep) and build the existing HTTP API on top of it (kine of like what browsers did with fetch and XHR or how domains build on async_hooks now).

  5. mcollina commented on May 4, 2021

    @mcollina
    SponsorMember

    Another possible alternative would be to land unidici as part of core (or as a dep) and build the existing HTTP API on top of it (kine of like what browsers did with fetch and XHR or how domains build on async_hooks now).

    It's not possible. The current API is an extremely leaky abstraction that multiple modules in the ecosystem monkeypatch. Doing so would not reduce the friction for the community.

  6. benjamingr commented on May 4, 2021

    @benjamingr
    Member

    It's not possible. The current API is an extremely leaky abstraction that multiple modules in the ecosystem monkeypatch. Doing so would not reduce the friction for the community.

    I'm sure this is pretty common in servers - but who's patching the clinet?

  7. targos commented on May 4, 2021

    @targos
    Member

    I'd prefer we keep the existing API with a legacy status and introduce a new one based on undici.

  8. benjamingr commented on May 4, 2021

    @benjamingr
    Member

    I'd prefer we keep the existing API with a legacy status and introduce a new one based on undici.

    Note that if landing fetch is an eventual goal that would mean we'd have to maintain 3 HTTP APIs. I am fine with this if the fetch we land is based on unidici to the point we only de-facto maintain two APIs and fetch is just a wrapper around that

  9. ronag commented on May 4, 2021

    @ronag
    MemberAuthor

    Just a side note. I actually prefer if undici is not included in core. It is much easier to maintain and develop as npm module.

  10. ronag commented on May 4, 2021

    @ronag
    MemberAuthor

    I'd prefer we keep the existing API with a legacy status and introduce a new one based on undici.

    Note that if landing fetch is an eventual goal that would mean we'd have to maintain 3 HTTP APIs. I am fine with this if the fetch we land is based on unidici to the point we only de-facto maintain two APIs and fetch is just a wrapper around that

    There is https://github.com/Ethan-Arrowood/undici-fetch which we are considering merging into undici once it's a bit more mature.

  11. targos commented on May 4, 2021

    @targos
    Member

    It would be unfortunate to have to recommend people to use an external module for doing HTTP requests...

  12. benjamingr commented on May 4, 2021

    @benjamingr
    Member

    @ronag

    Kind of OT on your side note:

    Just a side note. I actually prefer if undici is not included in core. It is much easier to maintain and develop as npm module.

    I think that's a bigger problem and we need a process for deps to live in core without requiring a full CI run or the same process. The reason it's much nicer to maintain/develop outside of core is (presumably, from stuff I was involved in):

    • You don't need to wait 48 hours (or a week) to land PRs.
    • You don't need to wait for mostly flakey CI that's mostly irrelevant.
    • You can easily set up your own infra without needing to bother more people.
    • You don't need to go through the consensus seeking process.

    It would be great if we could solve that and make contributing relatively standalone stuff (like unidico or AbortSignal) more convenient and less tedious.

    One approach you may want to take is to keep the nodejs/unidici repo and treat it like a dep - that way you'd get the same "freedom" stuff like libuv gets

  13. benjamingr commented on May 4, 2021

    @benjamingr
    Member

    There is https://github.com/Ethan-Arrowood/undici-fetch which we are considering merging into undici once it's a bit more mature.

    That would be cool though I would prefer it if users had fetch as a convenient API and unidici (presumably with a more "standard" name) as a low-level API (assuming callback-land http becomes legacy).

  14. ronag commented on May 4, 2021

    @ronag
    MemberAuthor

    @ronag

    Kind of OT on your side note:

    What does OT mean?

    I think that's a bigger problem and we need a process for deps to live in core without requiring a full CI run or the same process. The reason it's much nicer to maintain/develop outside of core is (presumably, from stuff I was involved in):

    Yea I get that. Just thinking that it would be nice if possible.

  15. ronag commented on May 4, 2021

    @ronag
    MemberAuthor

    There is https://github.com/Ethan-Arrowood/undici-fetch which we are considering merging into undici once it's a bit more mature.

    That would be cool though I would prefer it if users had fetch as a convenient API and unidici (presumably with a more "standard" name) as a low-level API (assuming callback-land http becomes legacy).

    Yea, that's the idea. In terms of API we have a bit of a layered approach in undici. Whether or not we split undici into minimal packages (e.g. undici-core, undici-pool, undici-agent, undici-api, undici-fetch) or just have everything together (undici) is something to consider.

  16. 20 remaining items

  17. added a commit that references this issue on Jun 17, 2021
  18. ronag commented on Jun 17, 2021

    @ronag
    MemberAuthor
  19. Flarna commented on Jun 17, 2021

    @Flarna
    Member

    Is there already a conclusion regarding moving undici into core?
    I fully understand that keeping it as a separate NPM module results in an easier workflow. But I assume the same would be valid for all core components.

    core has a well defined maintenance/release strategy including LTS. Are the same rules applicable to undici once it is the recommended HTTP client?

    node has citgm to watch the impact on the ecosystem. Currently it's verified that a new node release doesn't break undici but I assume once undici as the recommended HTTP client something similar should be done for undici releases.

    Please note that my intend is not to block anything here. My main point is to understand the long term strategy regarding this.

  20. ronag commented on Jun 17, 2021

    @ronag
    MemberAuthor

    Is there already a conclusion regarding moving undici into core?

    No.

    But I assume the same would be valid for all core components.

    Indeed. This is an argument that goes back and forth, e.g. stream utils such as pipeline and finished (and now destroy) could also more easily live as npm packages. I'm not sure what the strategy in general is here in regards to what is and isn't in core.

    core has a well defined maintenance/release strategy including LTS. Are the same rules applicable to undici once it is the recommended HTTP client?

    I have a hard time seeing that it would. Not sure whether or not that would make sense. It would be as any other npm package, if it's not in core. I think LTS strategy makes sense for node core since it's not possible for users to cherry-pick what to or not to upgrade. This does not apply to npm packages where users can choose when and how to upgrade semver major.

    node has citgm to watch the impact on the ecosystem. Currently it's verified that a new node release doesn't break undici but I assume once undici as the recommended HTTP client something similar should be done for undici releases.

    That would be great. However, we would need help to put that into practice. I think there was some project that was working on making something like citgm for npm packages (something along the lines "will I break you" or something)?

    Please note that my intend is not to block anything here. My main point is to understand the long term strategy regarding this

    Good feedback. My understanding is that the consensus is that undici is the way forward but there are still questions that remain open.

    I'm much in favor of leaving undici outside of core due to ease of development and maintenance. Those are my personal primary concerns as a undici developer and those priorities might not align with the priorities of node core and the ecosystem.

  21. jasnell commented on Jun 17, 2021

    @jasnell
    Member

    If undici is merged into core, it would follow the same LTS/maintenance cycle. If it remains separate, then it would have it's own cycle, similar to the readable-stream module. Personally, I'd like to see it merged into core sooner rather than later -- however, right now it's premature as that would hinder it's ability to evolve as quickly as it needs right now.

  22. Trott commented on Jun 23, 2021

    @Trott
    Member

    We didn't have the right people to talk about this at the TSC meeting today, but it seems like it ties into the larger issue of nodejs/TSC#1041.

  23. removed
    tsc-agendaIssues and PRs to discuss during Technical Steering Committee meetings.
    on Jul 22, 2021
  24. mhdawson commented on Jul 22, 2021

    @mhdawson
    Member

    We agreed in the TSC meeting today to remove from the tsc-agenda and possibly add it back on after nodejs/TSC#1041
    is resolved

  25. GrosSacASac commented on Aug 16, 2021

    @GrosSacASac
    Contributor

    If I understand correctly undici has all fixes to node http that are long due, and changing http itself is an impossible puzzle since so much code in the wild monkeypatches it.

    In that case I recommend to include undici in node alongside http and mark it as legacy.

    Just a side note. I actually prefer if undici is not included in core. It is much easier to maintain and develop as npm module.

    Why is is so much easier ?

  26. Chaphasilor commented on Aug 19, 2021

    @Chaphasilor

    Why is is so much easier ?

    Faster release cycles, easier for others to contribute to, independent CI environments, etc.

  27. GrosSacASac commented on Aug 19, 2021

    @GrosSacASac
    Contributor

    Faster release cycles, easier for others to contribute to, independent CI environments, etc.

    To keep those benefits is it possible to include whatever the last release is from unici into node whenever node is released (similar to npm I think)

  28. github-actions commented on Jun 27, 2026

    @github-actions
    Contributor

    This issue has been marked as stale due to 210 days of inactivity.
    It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

  29. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Jun 27, 2026
  30. github-actions commented on Jul 28, 2026

    @github-actions
    Contributor

    This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
    If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    httpIssues and PRs related to the http subsystem.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions