-
Notifications
You must be signed in to change notification settings - Fork 2k
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
@apollo/gateway doesn't include node-fetch in its dependencies #3471
Comments
I ran into this recently and had to add I don't use I really hope this gets fixed soon for better DX and reduced element of surprise. |
As the `HeadersInit` is exported and used in the exported [`GatewayConfig`] type via [`RemoteGatewayConfig`] - which is emitted to `@apollo/gateway`'s `dist/index.d.ts` declaration, the `node-fetch` types need to be available by those who install the package. [`GatewayConfig`]: https://github.com/apollographql/apollo-server/blob/73cdf0d533908894282debdb6dc5444186af27a6/packages/apollo-gateway/src/index.ts#L74-L77 [`RemoteGatewayConfig`]: https://github.com/apollographql/apollo-server/blob/73cdf0d533908894282debdb6dc5444186af27a6/packages/apollo-gateway/src/index.ts#L62 Fixes: #3471
* Add production dependency on `@types/node-fetch`. As the `HeadersInit` is exported and used in the exported [`GatewayConfig`] type via [`RemoteGatewayConfig`] - which is emitted to `@apollo/gateway`'s `dist/index.d.ts` declaration, the `node-fetch` types need to be available by those who install the package. [`GatewayConfig`]: https://github.com/apollographql/apollo-server/blob/73cdf0d533908894282debdb6dc5444186af27a6/packages/apollo-gateway/src/index.ts#L74-L77 [`RemoteGatewayConfig`]: https://github.com/apollographql/apollo-server/blob/73cdf0d533908894282debdb6dc5444186af27a6/packages/apollo-gateway/src/index.ts#L62 Fixes: #3471 * Add CHANGELOG.md for #3546.
…lo-server#3546) * Add production dependency on `@types/node-fetch`. As the `HeadersInit` is exported and used in the exported [`GatewayConfig`] type via [`RemoteGatewayConfig`] - which is emitted to `@apollo/gateway`'s `dist/index.d.ts` declaration, the `node-fetch` types need to be available by those who install the package. [`GatewayConfig`]: https://github.com/apollographql/apollo-server/blob/73cdf0d533908894282debdb6dc5444186af27a6/packages/apollo-gateway/src/index.ts#L74-L77 [`RemoteGatewayConfig`]: https://github.com/apollographql/apollo-server/blob/73cdf0d533908894282debdb6dc5444186af27a6/packages/apollo-gateway/src/index.ts#L62 Fixes: apollographql/apollo-server#3471 * Add CHANGELOG.md for apollographql/apollo-server#3546. Apollo-Orig-Commit-AS: apollographql/apollo-server@c63786b
We do use `node-fetch` during runtime for some of the public methods in `RemoteGraphQLDataSource`. Using `node-fetch@2` because v3 is ESM-only. There's already a renovate rule to keep things from going to v3. We should probably break the interfaces that are using `node-fetch`'s classes, since they aren't used by the default implementation after switching to `make-fetch-happen`. ### Other detritus - **Move `@types/node-fetch` to `devDependencies`** This was originally included in apollographql/apollo-server#3546 as a fix for apollographql/apollo-server#3471. I think this is more appropriate for types. - **Change some imports to use `type`** so there's no runtime dependency for things that are just using types. - **Add `@types/make-fetch-happen`** - **Remove `pretty-format`** since that's not a runtime thing Fixes #1961
We use `node-fetch` during runtime for some of the public methods in `RemoteGraphQLDataSource`. Using `node-fetch@2` because v3 is ESM-only. There's already a renovate rule to keep things from going to v3. We should probably break the interfaces that are using `node-fetch`'s classes, since they aren't used by the default implementation after switching to `make-fetch-happen`. ### Other detritus - **Remove `@types/node-fetch`** This was originally included in apollographql/apollo-server#3546 as a fix for apollographql/apollo-server#3471. - **Change some imports to use `type`** so there's no runtime dependency for things that are just using types. - **Remove `pretty-format`** since that's not a runtime thing
When using
@apollo/[email protected]
, TypeScript fails because it can't find the types fornode-fetch
. This happens specifically here. It looks likenode-fetch
should be added as a dependency, or at least@types/node-fetch
.The text was updated successfully, but these errors were encountered: