Skip to content

Make datx work with native fetch on node 20 / drop use of isomorphic-fetch #1208

@fvoska

Description

@fvoska

Relevant version

  • 0.x
  • 1.x
  • 2.x

Relevant libraries

  • utils
  • core
  • network
  • jsonapi
  • jsonapi-angular

Breaking change

No

Description

isomorphic-fetch is used both in DatX unit tests and in any apps that might use datx on server-side. This lib is 3 years old and I would not consider it safe for production, from security perspective.

In node 20, we have experimental native fetch API and it is stable in 21. We should look into using that for all apps that are running node >=21 (so I guess when we switch to 22 LTS would be the ideal time). I have tried using fetch on some app I am working on that runs datx unit tests in node and it does not work. Simply removing the use of fetch from isomorphic-fetch and using native fetch causes this error:

image

Note: jsonapi-angular is not affected, because there we connect fetchReference to Angular's HttpClient (which in the background uses native XHR in the browser and xhr2 in node)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions