federation
federation copied to clipboard
@apollo/subgraph errors when used in a Cloudflare Worker
Using a working Apollo Server in Cloudflare Worker, which utilizes esmodules for files/deps, works great. Adding @apollo/subgraph and calling buildSubgraphSchema throws the following error:
Uncaught TypeError: url_1.URL is not a constructor
When looking at the source code, there are several instances of URL being imported and used:
import { URL } from "url";
I find this odd. URL has been on the global object since Node 10, according to MDN: https://developer.mozilla.org/en-US/docs/Web/API/URL
I doubt this single change will fix the package working in an esmodule environment, but it is a good first step.
I can submit a PR which uses the global URL instead of the required one and see if there are any regressions if that is helpful.