Skip to content

chore(storage): replace node-fetch with native fetch in tests#8337

Closed
swseverance wants to merge 1 commit into
googleapis:mainfrom
swseverance:chore/node-fetch
Closed

chore(storage): replace node-fetch with native fetch in tests#8337
swseverance wants to merge 1 commit into
googleapis:mainfrom
swseverance:chore/node-fetch

Conversation

@swseverance
Copy link
Copy Markdown

The test infrastructure appears to run on Node 18, where native fetch is guaranteed. There is no reason to depend on node-fetch in the testing code — replace the imports with native fetch and remove node-fetch and @types/node-fetch from devDependencies.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #8336 🦕

@swseverance swseverance requested a review from a team as a code owner May 20, 2026 22:31
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label May 20, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request removes the node-fetch dependency and its associated types, transitioning the project to the native fetch API. Feedback identifies potential issues resulting from this change, including the shift from Node.js Readable streams to Web ReadableStreams in response bodies and compatibility conflicts between native fetch and the form-data package. Additionally, a correction was requested for an invalid @types/node version in package.json.

Comment thread handwritten/storage/conformance-test/conformanceCommon.ts
Comment thread handwritten/storage/system-test/storage.ts
Comment thread handwritten/storage/package.json
@swseverance
Copy link
Copy Markdown
Author

It has come to my attention that the storage library may in fact be running tests in node 14 as well as node 18. If in fact tests are running in node 14 then they will likely fail, as fetch will not be available. Would the project maintainers be open to updating the storage library to no longer support node 14? It seems like many of the other packages require node >= 18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

remove node-fetch dependency from storage library

1 participant