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

Implement HTTP2 server support to enable gRPC #8823

Closed
vsly-ru opened this issue Feb 9, 2024 · 76 comments · Fixed by #14286
Closed

Implement HTTP2 server support to enable gRPC #8823

vsly-ru opened this issue Feb 9, 2024 · 76 comments · Fixed by #14286
Assignees
Labels
enhancement New feature or request node.js Compatibility with Node.js APIs

Comments

@vsly-ru
Copy link

vsly-ru commented Feb 9, 2024

What is the problem this feature would solve?

As described in #887, HTTP2 support is mandatory for gRPC to work. We appreciate the bun team for successfully implementing HTTP2 client-side support, enabling connectivity to gRPC servers.

However, on the server side, the issue persists, preventing the operation of gRPC servers. Unfortunately, there seems to be a lack of prioritization for server support, evident from the absence of an ETA and limited developer replies on the issue.

So I assumed that the team determines feature implementation priority based on the upvotes received for an issue. Given that #887 may be deemed partially resolved, it's possible that its upvotes no longer influence the priority of the ongoing server-side concern.

This new issue is raised to emphasize the continued importance of server-side HTTP2 support. We hope to bring back the attention by collecting upvotes here. Thank you.

What is the feature you are proposing to solve the problem?

Implement HTTP2 server support in Bun.

What alternatives have you considered?

No response

@vsly-ru vsly-ru added the enhancement New feature or request label Feb 9, 2024
@vsly-ru vsly-ru mentioned this issue Feb 9, 2024
@Electroid Electroid added the node.js Compatibility with Node.js APIs label Feb 9, 2024
@birkskyum birkskyum mentioned this issue Feb 9, 2024
2 tasks
@birkskyum
Copy link
Collaborator

birkskyum commented Feb 10, 2024

Tags to make the ticket searchable:
http2.createServer, http2.createSecureServer, createServer, createSecureServer

@guest271314
Copy link
Contributor

Possibly related #7206

@birkskyum
Copy link
Collaborator

This has become the 22th most upvoted ticket in just 1 day, which I find to be highly unusual.

@debkanchan
Copy link

I'm dying for this to land so I can finally move on from node once and for all

@birkskyum
Copy link
Collaborator

birkskyum commented Feb 11, 2024

Same - can't use backend integrations for Auth0, Stripe etc. without it, because they strictly require http2 w/ https even in localhost using their dev mode APIs.

@birkskyum
Copy link
Collaborator

10th most requested features in less than a week.

@Electroid , there is a picture forming that the http2 client release only satisfied a minority of the people reacting to the other ticket. I imagine Windows support draw all resources now (and rightly so!), but any updates or plans for this will be appreciated.

@Electroid
Copy link
Contributor

Yes, it's clear that folks need this. I think most realistic would be between 1.1 and 1.2, but we don't have specific dates right now.

@ewrogers
Copy link

ewrogers commented Feb 15, 2024

This has become the 22th most upvoted ticket in just 1 day, which I find to be highly unusual.

Another dev here who has to use JS/TS and refuses to build "yet another JSON REST API microservice" when everyone knows gRPC is the better option.

@rhadamez
Copy link

rhadamez commented Feb 15, 2024

Probably Bun is being avoid to be used due http2 not in. After this implementation will be some issues related to it, so until there me and my pals gonna stay with node.

@guest271314
Copy link
Contributor

An alternative could be Bun's TCP server?

@Yashrocky96
Copy link

Because of this I'm unable to use Firebase SDK and Even GCP SDKs. Majority of our code is based on the SDKs.

If this is solved, then we can adopt this completely for our internal usage

@debkanchan
Copy link

Me and the gang waiting for this to dropped so we can finally ditch node

Man waiting meme

@pukingrainbows
Copy link

Also for running vite with https locally it is required, trying to use the "vite-plugin-mkcert";

@birkskyum
Copy link
Collaborator

birkskyum commented Feb 17, 2024

Also for running vite with https locally it is required, trying to use the "vite-plugin-mkcert";

Exactly, missing this breaks all frameworks but Next.js through mkcert, and maybe Next too through a similar issue.

@razvanphp
Copy link

Also for running vite with https locally it is required, trying to use the "vite-plugin-mkcert";

I'm pretty sure this is related, but just FYI, when running Vite 4.5 and have basicSsl() plugin included in config (from @vitejs/plugin-basic-ssl) the error message is very misleading:

% bun --bun vite
error when starting dev server:
TypeError: Invalid path string: path is too long (max: 1024)
    at readFile (native)
    at <anonymous> (/Volumes/Code/portal/node_modules/vite/dist/node/chunks/dep-52909643.js:54807:11)
    at readFileIfExists (/Volumes/Code/portal/node_modules/vite/dist/node/chunks/dep-52909643.js:22374:33)
    at <anonymous> (/Volumes/Code/portal/node_modules/vite/dist/node/chunks/dep-52909643.js:22368:21)
    at resolveHttpsConfig (/Volumes/Code/portal/node_modules/vite/dist/node/chunks/dep-52909643.js:22361:35)
    at <anonymous> (/Volumes/Code/portal/node_modules/vite/dist/node/chunks/dep-52909643.js:24928:142)
    at processTicksAndRejections (:12:39)

@patriksimms
Copy link

patriksimms commented Feb 29, 2024

For anyone stumbling into this issue while getting @httptoolkit/httpolyglot to run in bun (required e.g. for mockttp):

We created a fork which removes http2.createServer calls. With this, you can run mockttp just fine. Once bun supports this, the fork of course will be deprecated.

https:/esome/httpolyglot-bun

@zachsents
Copy link

Others have mentioned it but this issue absolutely cripples anyone using GCP libraries, including firebase-admin. We need this so bad

@Yashrocky96
Copy link

@zachsents I agree, I had to use different firebase-functions to execute Firestore queries and maintain a 2nd API, which is not desirable @Jarred-Sumner

Hope this gets fixed, so that I can move it to the main Bun + Elysia.js API

@Lillious
Copy link

The one feature my team needs to ditch node. I hope this gets implemented sooner than later!

@dunadain
Copy link

dunadain commented Apr 1, 2024

Plz I need this feature for my game server

@rhuanbarreto

This comment was marked as off-topic.

@TomasHubelbauer
Copy link

@rhuanbarreto that seems to be about an HTTP2 client (making HTTP2 calls from Bun) not a server.

@MarcStdt
Copy link

MarcStdt commented Apr 3, 2024

Yes, it's clear that folks need this. I think most realistic would be between 1.1 and 1.2, but we don't have specific dates right now.

I think we approached that timeframe now. Is there any chance to get an ETA on this?
Me and my team are basically on the fence to adopt bun, but this is just a hard blocker for us.
I think this is also one of the most awaited features by now.

@guest271314

This comment was marked as off-topic.

@vsly-ru
Copy link
Author

vsly-ru commented Jul 3, 2024

Why is that "(grpc)" in parentheses? Does that include a standalone HTTP/2 server that has nothing to do with grpc?

HTTP/2(server) is the underlying transport of gRPC. So the task is to implement the HTTP/2, not gRPC, because gRPC is not a part of nodejs and Bun. It's just a lib, one of whose dependencies is not implemented yet.

@guest271314
Copy link
Contributor

bun is faster than deno (and deno is faster than node) for processing standard input and writing to standard output.

@LucyEgan
Copy link

+1 this is required for vite dev https, so hopefully soon 🤞 Q3 ends in 1.5 months 👀

@chimericdream
Copy link

@LucyEgan (and anyone else who finds their way here needing https with vite dev), this is the workaround my team is currently using to get https working with vite:

/*
 * This is only needed because Bun does not yet support HTTP/2, which Vite
 * uses for its https configuration. Once Bun adds HTTP/2 support, we can
 * remove this and simply use a regular https config.
 *
 * See:
 * https://vitejs.dev/config/server-options.html#server-https - note the bit about downgrading to TLS when `proxy` is set
 * https:/oven-sh/bun/issues/8823 - Bun's open ticket to support HTTP/2
 */
config.server!.proxy = {};

@LucyEgan
Copy link

@chimericdream 💜 your a star, thank you!

@pmbanugo
Copy link

maybe HTTP 3 also, in the future

@LucyEgan
Copy link

@pmbanugo when HTTP 4 has been standard for a few years 😄

@movva-gpu
Copy link

movva-gpu commented Aug 26, 2024

No it hasn't @LucyEgan ? Well at least I can't find any info about it :²

I found RCF9114 - HTTP3 and RFC9204 - QPACK: HTTP3, but nothing about http4 being a standard :/

I also found some information about HttpClient 4.x but that's an Apache Camel thing, not a standard of any kind 🤷‍♀️

And @pmbanugo, I'm not in the oven.sh team and I don't know if you get the hold of the time and the energy needed to make what they do (I'm not trying to be mean I genuinely don't know if you do), but if they haven't implemented HTTP2 yet, they're not gonna implement HTTP3 right after it comes out (sadly ik ik). Bun is (as far as I understand) not yet made or even able to be shipped to production, or at least not in the case of an HTTP2 web server, because it can't yet (can't wait for it to happen tho 🙏)

@LucyEgan
Copy link

@movva-gpu 🤣🤣🤣 naa HTTP 4 is totally a thing, just around the corner 🫠

(Incase it wasn't clear, both of these comments are a joke)

@pmbanugo
Copy link

No it hasn't @LucyEgan ? Well at least I can't find any info about it :²

I found RCF9114 - HTTP3 and RFC9204 - QPACK: HTTP3, but nothing about http4 being a standard :/

I also found some information about HttpClient 4.x but that's an Apache Camel thing, not a standard of any kind 🤷‍♀️

And @pmbanugo, I'm not in the oven.sh team and I don't know if you get the hold of the time and the energy needed to make what they do (I'm not trying to be mean I genuinely don't know if you do), but if they haven't implemented HTTP2 yet, they're not gonna implement HTTP3 right after it comes out (sadly ik ik). Bun is (as far as I understand) not yet made or even able to be shipped to production, or at least not in the case of an HTTP2 web server, because it can't yet (can't wait for it to happen tho 🙏)

HTTP/3 might take a long time (or maybe never). Node.js doesn't even have HTTP/3 support, and I think the HTTP/2 implementation isn't fully RFC-compliant yet (I think I read that somewhere). Many of these tools mostly use http 1.1 and recommends it. If you want http/3, then use things like Caddy server or any web server that supports it.

@cirospaciari
Copy link
Collaborator

cirospaciari commented Aug 29, 2024

For people asking for updates, I'm actively working on server side support for this and improving client side support, will post updates soon. And we have plans for HTTP/3 too.

@guest271314
Copy link
Contributor

@cirospaciari What is the branch? https:/oven-sh/bun/tree/ciro/http2-server?

@cirospaciari
Copy link
Collaborator

cirospaciari commented Aug 30, 2024

@cirospaciari What is the branch? https:/oven-sh/bun/tree/ciro/http2-server?

Yeah but is outdated, I broke down in more branchs locally, will push soon and open a PR (but in this branch you mentioned the really basic stuff already works)

@guest271314
Copy link
Contributor

I look forward to testing your gear until it breaks. Thanks.

@rtritto
Copy link

rtritto commented Sep 23, 2024

Anywone can confirm if #13880 (Vite + Elysia) is related to this issue?

Edit:
Related comment #13880 (comment)

@jamie-notifi
Copy link

@cirospaciari What is the branch? https:/oven-sh/bun/tree/ciro/http2-server?

Yeah but is outdated, I broke down in more branchs locally, will push soon and open a PR (but in this branch you mentioned the really basic stuff already works)

Hey, any targeted release version // date for this feature?

@cirospaciari
Copy link
Collaborator

@cirospaciari What is the branch? https:/oven-sh/bun/tree/ciro/http2-server?

Yeah but is outdated, I broke down in more branchs locally, will push soon and open a PR (but in this branch you mentioned the really basic stuff already works)

Hey, any targeted release version // date for this feature?

Updating my branch and bug fixing you can follow on #14286

@guest271314
Copy link
Contributor

If anything I would be implementing Deno's HTTP/2 server, not Node.js.

Just implementing an HTTP/2 server alone is not enough. This has to be done for WHATWG Fetch implementation, too.

@ignoramous
Copy link

This has to be done for WHATWG Fetch implementation, too.

Believe the client has already been implemented: #887 (docs).

@guest271314
Copy link
Contributor

This has to be done for WHATWG Fetch implementation, too.

Believe the client has already been implemented: #887 (docs).

This is fixed #10582.

This is not fixed #7206.

@Jarred-Sumner
Copy link
Collaborator

Jarred-Sumner commented Oct 16, 2024

Creating a server in node:http2 will ship in Bun v1.1.31, which we aim to release tomorrow (thanks to @cirospaciari).

This includes many bugfixes for the client as well. About 90% of grpc-js’ test suite passes, the remaining todos are mostly named pipes on windows, injecting sockets from http1, and http2 push.

You can try it out now via

bun upgrade --canary

@deathemperor
Copy link

Also for running vite with https locally it is required, trying to use the "vite-plugin-mkcert";

I'm pretty sure this is related, but just FYI, when running Vite 4.5 and have basicSsl() plugin included in config (from @vitejs/plugin-basic-ssl) the error message is very misleading:

% bun --bun vite
error when starting dev server:
TypeError: Invalid path string: path is too long (max: 1024)
    at readFile (native)
    at <anonymous> (/Volumes/Code/portal/node_modules/vite/dist/node/chunks/dep-52909643.js:54807:11)
    at readFileIfExists (/Volumes/Code/portal/node_modules/vite/dist/node/chunks/dep-52909643.js:22374:33)
    at <anonymous> (/Volumes/Code/portal/node_modules/vite/dist/node/chunks/dep-52909643.js:22368:21)
    at resolveHttpsConfig (/Volumes/Code/portal/node_modules/vite/dist/node/chunks/dep-52909643.js:22361:35)
    at <anonymous> (/Volumes/Code/portal/node_modules/vite/dist/node/chunks/dep-52909643.js:24928:142)
    at processTicksAndRejections (:12:39)

This error still occurs running bun latest canary

@Atulin
Copy link

Atulin commented Oct 16, 2024

Too early for an HTTP/3 issue? 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request node.js Compatibility with Node.js APIs
Projects
None yet
Development

Successfully merging a pull request may close this issue.