apollo-server icon indicating copy to clipboard operation
apollo-server copied to clipboard

Add a test showing http/2 works

Open glasser opened this issue 2 years ago • 5 comments

Apollo Server v3 used node-fetch Requests to represent incoming requests, and those objects aren't compatible with http/2 requests which have colons in header names. See #2333 and #1533.

We think that AS4 (which no longer uses that representation for requests) should support http/2. It would be great to get a PR adding a test!

glasser avatar Oct 04 '22 22:10 glasser

hi @glasser, I am a new contributor and I would be happy to work on this issue.

would I add this test to the general apolloServerTests.ts suite?

nedjulius avatar Oct 13 '22 00:10 nedjulius

Sure! Alternatively, add it to packages/server/src/__tests__/express4/expressSpecific.test.ts and do it just for express middleware, since not all integrations might support HTTP/2.

glasser avatar Oct 13 '22 00:10 glasser

Provide an example to how to create apollo server with http2 and express.

kiran052 avatar Jan 03 '23 10:01 kiran052

AS4 ships only with a simple standalone server and an Express middleware, and Express doesn't support http2 out of the box without using one of various "bridge" packages. So putting tests for this in the AS core repo might not make much sense. Perhaps we should find an integration for a framework that does support http2 (like Koa) and put a test like this into its integration repository. Once we have evidence that it's possible to do that for some framework, perhaps we can close this issue.

glasser avatar Feb 13 '23 21:02 glasser

https://github.com/apollo-server-integrations/apollo-server-integration-koa/pull/87 should suffice to close this out.

We just migrated to AS4 at my company in PROD today (using koa integration). I've also manually tested and have proven sending GraphQL requests via http2 cleartext works just fine, but we haven't transitioned to using it yet, need to get changes made to our service mesh and kubernetes to support h2c health checks/readiness checks/etc before we can do that.

theJC avatar Mar 02 '23 05:03 theJC