apollographql / apollographql/datasource-rest

Dropping node-fetch

Open
#393 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
48
Forks
21
PR merge metrics
No merged PRs in 30d

Description

What's the way ahead for this lib and `node-fetch`?

Should `datasource-rest@v7` come, what would be the minimal supported `node` version?

Since node 21, the global `fetch` (undici-based) is stable. Should the global fetch be used as the default for [HTTPCache](https://github.com/apollographql/datasource-rest/blob/b7f0547724d67bb49f71067e53eec5f12334f12e/src/HTTPCache.ts#L42), the `node-fetch` dependency could be dropped.

Users could still provide their own `fetch` impl as they do know, but the library would be less prone to more and more issues related to the outdated `node-fetch` v2 (e.g. #331). Caring about v3 (ESM only) will also become a non-issue.

Known obstacles:
* `nock` needs to upgraded to v14 (currently in beta)
* `nock` needs to have https://github.com/nock/nock/issues/2821 fixed

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing src/HTTPCache.ts and the linked nock compatibility issue, then determine the minimum supported Node version for a v7 release and whether the global fetch can replace the default. Done means a decided migration scope that addresses the nock upgrade and #2821 obstacles; no test file or command is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.