Global namespace collision for native node fetch
when near-api-js
is imported
#1193
Closed
4 tasks done
Labels
bug
Something isn't working
Prerequisites
near-api-js
.Description
Attempting to use the node native
fetch
API in node >= 18 when thenear-api-js
is imported directly or by a transitive dependency results in the node globalfetch
property being overwritten bynear-api-js
.These two lines of code here and here explicitly override the global
fetch
property.They should not do this.
Reproducible demo
This can be reporoduced in a node console:
Steps to reproduce
near-api-js
somewhere in it's dependency treefetch
[AsyncFunction: fetch]
require('near-api-js')
fetch
[Function: default_1]
Expected behavior
I would not expect a dependency to overwrite the global
fetch
property.Actual behavior
near-api-js
overwrites the globalfetch
propertyYour environment
2.1.4
near-api-js
Self-service
Here's my PR: fix: remove global override of
fetch
#1194The text was updated successfully, but these errors were encountered: