cloudflare / workers-graphql-server

🔥Lightning-fast, globally distributed Apollo GraphQL server, deployed at the edge using Cloudflare Workers
https://graphql-on-workers.signalnerve.com/___graphql
MIT License
680 stars 486 forks source link

Upgrade to `apollo-server-cloudflare@2.21` and mock 'tls' and 'net' modules. #27

Closed abernix closed 3 years ago

abernix commented 3 years ago

This upgrades to Apollo Server 2.21 and makes a Webpack configuration change to make it possible to bundle that new version.

Per the comment added within the Webpack configuration which aliases the 'tls' and 'net' modules in the resulting bundle to empty modules:

The 'net' and 'tls' Node.js built-in usage within Apollo Server is merely to run instanceof checks against an existing, user-supplied "server" instance when subscriptions are desired to be bound to an already-created server. For the purposes of Cloudflare, where none of these Node.js builtins exist, this instanceof check is irrelevant because such a class could not exist.

This is necessary as of the introduction of those instanceof checks in https://github.com/apollographql/apollo-server/commit/8ab0e90724d8d35ad.

subhendukundu commented 3 years ago

Merge this please!