-
Notifications
You must be signed in to change notification settings - Fork 893
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
V11 release removal of node-fetch and undici dependencies #8492
Conversation
🦋 Changeset detectedLatest commit: d517b14 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
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 |
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1Affected Products
Test Logs |
packages/auth-compat/index.node.ts
Outdated
fetch as undiciFetch, | ||
Headers as undiciHeaders, | ||
Response as undiciResponse | ||
} from 'undici'; | ||
import './index'; | ||
|
||
FetchProvider.initialize( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping the FetchProvider because it's used in by auth's testing framework.
databaseInfo: DatabaseInfo, | ||
private readonly fetchImpl: typeof fetch | ||
) { | ||
super(databaseInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This consructor is removed because it would now have the same signature as RestConnection's constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks very thorough! Just a few questions.
undiciHeaders as unknown as typeof Headers, | ||
undiciResponse as unknown as typeof Response | ||
fetch as unknown as typeof fetch, | ||
Headers as unknown as typeof Headers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still have to do the casting or can it infer that it's a typeof, well, what it is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
||
export * from './api'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
registerFunctions(undiciFetch as any, 'node'); | ||
registerFunctions('node'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I don't think we actually need a separate functions Node bundle anymore. Maybe that can be a separate PR though. The only thing different is that it labels the bundle "node" for platform logging, which is pointless if it's the same bundle. I guess it tells us how many node users are using functions. Also it doesn't export the types from public-types which is probably a mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add the export.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We spoke offline about removing the separate node bundle, will be done in a different PR.
} | ||
resolve(); | ||
const reader = resp.body?.getReader(); | ||
reader?.read().then(function readChunk({ done, value }): any { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a chance of this hanging if there's no reader or no body? Do we have to call a resolve() or reject() or downloadFailed() or something at the end as a failsafe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thank you! Updated the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auth changes LGTM
packages/auth-compat/index.node.ts
Outdated
undiciFetch as unknown as typeof fetch, | ||
undiciHeaders as unknown as typeof Headers, | ||
undiciResponse as unknown as typeof Response | ||
fetch as unknown as typeof fetch, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Christina pointed out in the other comment, we also don't need casting here, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed packages/firestore/*
* Add node engines fields specifying a minimum of 18 (#8457) * Make memory lru gc the default (#8110) * Make memory lru gc the default * undo yarn.lock * Make memory lru gc the default * Fix tests * V11 release removal of node-fetch and undici dependencies (#8492) Our v11 release will require node 18+. Since fetch has been introduced in these node versions, we can remove our dependency on third party fetch implementations. This change removes our usage of fetch variants undici and node-fetch for our node target builds and our CI tools. * V11 - Remove functions node bundle (#8507) With the removal of fetch we no long need to create a node bundle for functions. Instead the sourcebase may become isomorphic, so long as we remove the older node sources. And that's what the PR does! * Initial changes for Vertex GA packaging (#8498) * [Vertex GA] Rewrite Schema (#8479) * [Vertex GA] Add new endpoint and error message. (#8497) * [Vertex GA] Miscellaneous breaking changes for Vertex GA (#8514) * Remove ES5 Support (#8509) * Emit a module package file for functions ESM builds (#8517) * Update API_NOT_ENABLED error for Vertex (#8549) * Upgrade cjs bundles for storage and performance (#8557) These should have been part of the bigger PR, but I missed these. * Rollup JS files with rollup-typescript-plugin (#8503) The rollup-typescript-plugin does not transpile JS files using the TS compiler by default. This means that external dependencies that provide JS bundles will not be transpiled to the target ES version specified in the TypeScript config used by the plugin. This resulted in one of our dependencies (https://github.com/jakearchibald/idb) being included in the CDN bundles without being transpiled to ES5 (the target ES version). Since this dependencies bundle uses ES2018 syntax (object spread operator `{ ...x }`), this upgraded our CDN bundles' minimum ES version requirement to ES2018 which isn't compatible with older browser versions. To see the ES2018 syntax in one of the CDN bundles, see https://www.gstatic.com/firebasejs/10.13.1/firebase-app.js and search for `...oldTraps`. * Fix tsc errors in vertex tests (#8562) * Make SafetySettings.method optional (#8567) * Make SafetySettings.method optional * Update API reports --------- Co-authored-by: hsubox76 <hsubox76@users.noreply.github.com> * [Vertex GA] Regenerate docs after Vertex GA changes (#8505) * Close emulator file after download is complete (#8572) * close file * Add test:ci to end of test command in CI * revert workflow file changes * format * rename vertexai package reference in a changeset (#8573) * Missed one doc change from a PR (#8575) * Overwrite undefined candidate index (#8577) * Overwrite undefined candidate index * Fix index overwrite condition to only be true when index is not a property * Upgrade Vertex Mock Responses to V5 (#8579) * Upgrade to mock responses v4 * Upgrade from v4 to v5 mock responses --------- Co-authored-by: wu-hui <53845758+wu-hui@users.noreply.github.com> Co-authored-by: DellaBitta <DellaBitta@users.noreply.github.com> Co-authored-by: Daniel La Rocque <dlarocque@google.com> Co-authored-by: hsubox76 <hsubox76@users.noreply.github.com>
Discussion
Our v11 release will require node 18+. Since fetch has been introduced in these node versions, we can remove our dependency on third party fetch implementations.
This PR removes our usage of
fetch
variantsundici
andnode-fetch
for our node target builds and our CI tools.Testing
CI.
API Changes
NA.