Skip to content
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

fix: remove global override of fetch #1194

Merged
merged 1 commit into from Oct 30, 2023

Conversation

andrew-scott-fischer
Copy link
Contributor

@andrew-scott-fischer andrew-scott-fischer commented Oct 27, 2023

Feel free to help me get tests passing!

Ticket: #1193

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • Commit messages follow the conventional commits spec
  • If this is a code change: I have written unit tests.
  • If this changes code in a published package: I have run pnpm changeset to create a changeset JSON document appropriate for this change.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

Attempting to use the node native fetch API in node >= 18 when the near-api-js is imported directly or by a transitive dependency results in the node global fetch property being overwritten by near-api-js.

These two lines of code here and here explicitly override the global fetch property.

They should not do this.

Test Plan

I am not sure how to test this. Suggestions welcome

Related issues/PRs

#1193

@changeset-bot
Copy link

changeset-bot bot commented Oct 27, 2023

🦋 Changeset detected

Latest commit: 89667fc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
near-api-js Patch
@near-js/providers Patch
@near-js/cookbook Patch
@near-js/accounts Patch
@near-js/wallet-account Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes total sense, thanks for addressing this cruel manipulation with the global object.

@frol frol merged commit 038b9b9 into near:master Oct 30, 2023
1 check failed
@github-actions github-actions bot mentioned this pull request Oct 30, 2023
@andrew-scott-fischer andrew-scott-fischer deleted the remove-global-fetch-override branch October 30, 2023 21:42
@andrew-scott-fischer
Copy link
Contributor Author

@frol I see the last release was ~5 months ago; any idea when the next one will be?

@frol
Copy link
Collaborator

frol commented Oct 31, 2023

@andrew-scott-fischer I don't feel adventurous to do it before NEARCON, and then one week after NEARCON will be also a catch up game, so I would hope that we can have a release in the second half of November.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants