Merge v14 branch to main#3162
Conversation
* chore: drop support for Node.js 18 and 20 * Added Node.js 26.x to CIs * chore: upgrade firebase-tools to 15.17.0 in CI workflows * ci: setup Java 21 for emulator-based integration tests
* update dependencies for v14 * replace upstream import of DEFAULT_DATABASE_ID with local constant
* bump jwks-rsa to 4.0.1 * drop Node 18 from test matrix for testing
* build(deps-dev): bump sinon from 18.0.1 to 22.0.0 Bumps [sinon](https://github.com/sinonjs/sinon) from 18.0.1 to 22.0.0. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md) - [Commits](sinonjs/sinon@v18.0.1...v22.0.0) --- updated-dependencies: - dependency-name: sinon dependency-version: 22.0.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps-dev): update @types/sinon to 21.0.1 and fix fake timer test leaks --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore: bump eslint to 10.3.0 and migrate to flat config * add missing copyright header * remove extra whitespaces * chore: restrict mocha globals to test files in flat config * unpin eslint * chore: adopt native defineConfig and streamline test globs in flat config
* chore: upgrade nock to v14 and fix api-request unit tests * test: make mockRequestWithError normalization more robust
* chore: Update send-email GHA and remove send-tweet GHA * chore: Update `checkout` and `setup-node` GHAs * chore: Update `setup-java`, `upload-artifact`, and `download-artifact` GHAs * fix: address gemini review
* feat(core): Error Handling Revamp (#3102) * Initial exports and external api changes * Connect response to error info * feat: Revamp error handling to include `httpResponse` and `cause` in `FirebaseAuthError` and `FirebaseAppError`, added sample tests. * more refactoring * refactor: Update all services to use ErrorInfo format * refactor: Update unit tests to verify error cause and httpResponse population. * chore: fix lint * chore: remove debug tests * fix: Ran api documentor and fix some export errors * fix: Removed outdated `__proto__` workaround and updated api doc strings * chore: Fix lint * fix: Used a helper function to map `RequestResponse` to `HttpResponse` * fix: Removed last of the stringified response bodies in response messages * chore: Fix lint * chore: Generate apidocs * fix: Apply revamp changes to pnv * chore: Added review suggestions * feat(error): Decouple public error codes, modularize error files, and enable declaration merging (#3127) * chore(auth): Refactor auth error logic * chore(installations): Refactor installations and instance id error logic * chore(fcm): Refactor fcm error logic * fix(auth): Fix auth error mapping that were not copied correctly * fix(auth): Fixed `INVALID_SERVICE_ACCOUNT` to map to a valid client code * chore(pm): Refactor project management error logic * chore: Fix license year for new files * chore(rtdb): Refactor rtdb error logic * chore(fs): Refactor firestore error logic * chore(app): Refactor app error logic * chore(security-rules): Refactor security rules error logic * chore(app-check): Refactor app check error logic * chore(remote-config): Refactor remote config error logic * chore(functions): Refactor functions error logic * chore(extensions): Refactor extensions error logic * chore(fdc): Refactor data connect error logic * chore(ml): Refactor ml error logic * chore(eventarc): Refactor eventarc error logic * chore(fpnv): Refactor pnv error logic * fix: address gemini review * fix: Use Declaration Merging to expose error code constant mapping along side error code type * fix: Address gemini review * chore: Remove extra whitespace * feat(fcm): Improve HTTP/2 session error handling. (#3126) * feat(messaging): Improve HTTP/2 session error handling. * fix: ensure error causes are not lost * fix: clean up stale tests * fix: address gemini review * fix: address more gemini review * fix: Resolve leftover merge issues * fix: resolve merge conflict * fix: Address gemini review * fix: Address TW review * fix: update `HttpClient` test to check error cause. * fix: Refactor error logic to remove `PrefixedFirebaseError` as a intermediate class (#3159) * fix: Removed `PrefixedFirebaseError` * fix: Replaces uses of base `FirebaseError` with manual prefix with service specific errors * fix: Apply gemini review and update docstring * fix: final pass to verify docs strings are uniform
…new `TOPICS_SUBSCRIPTION_RATE_EXCEEDED` SDK error code (#3148) * fix(fcm): Map `RESOURCE_EXHAUSTED` server code to new `TOPICS_SUBSCRIPTION_RATE_EXCEEDED` SDK error code * fix: Update apidocs * fix: Address gemini review * fix: Apply TW review changes
There was a problem hiding this comment.
Code Review
This pull request migrates the SDK to a minimum of Node.js 22, updates ESLint to use flat configs, and refactors error handling across all services to extend a unified FirebaseError class that accepts an ErrorInfo object. It also removes legacy FCM APIs and cleans up old TypeScript workarounds. Review feedback highlights a critical merge conflict in package.json that must be resolved, an opportunity to simplify AggregateError instantiation now that Node 22 is the minimum, and a minor typo in an Eventarc error message.
| // TODO: AggregateError is supported in Node 18+ but only included in the ES2021+ | ||
| // We use (global as any).AggregateError as a workaround to access it in ES2020. | ||
| const cause = new (global as any).AggregateError(allErrors, 'Stream failure and session failures occurred'); |
There was a problem hiding this comment.
Since the minimum supported Node.js version has been bumped to 22 (which natively supports AggregateError globally), the workaround casting to (global as any).AggregateError is no longer necessary. You can instantiate AggregateError directly.
| // TODO: AggregateError is supported in Node 18+ but only included in the ES2021+ | |
| // We use (global as any).AggregateError as a workaround to access it in ES2020. | |
| const cause = new (global as any).AggregateError(allErrors, 'Stream failure and session failures occurred'); | |
| const cause = new AggregateError(allErrors, 'Stream failure and session failures occurred'); |
| 'invalid-argument', "CloudEvent 'tyme' must be in ISO date format."); | ||
| throw new FirebaseEventarcError({ | ||
| code: 'invalid-argument', | ||
| message: "CloudEvent 'tyme' must be in ISO date format." |
| "google-auth-library": "^10.6.1", | ||
| "google-auth-library": "^10.6.2", | ||
| "jsonwebtoken": "^9.0.0", | ||
| "jwks-rsa": "^3.1.0" |
There was a problem hiding this comment.
I think we lost the jwks-rsa update in the merge.
There was a problem hiding this comment.
Ah, this is what I feared
* bump jwks-rsa to 4.0.1 * drop Node 18 from test matrix for testing
url.parse() is deprecated (DEP0169) and emits warnings on every cold start in serverless runtimes. Migrate the two call sites in BaseRequestConfigImpl.buildUrl() to the WHATWG URL constructor, matching the pattern from #3061. The protected buildUrl() return type changes from url.UrlWithStringQuery to URL. Both call sites are inside the same file. parsed.path is replaced with ${parsed.pathname}${parsed.search} so the request path on the wire stays byte-for-byte identical, and parsed.port is now string (always); the existing if (!port) falsy check still catches the empty case. Fixes #3118.
…3080) - Updated constructors in `AuthResourceUrlBuilder`, `TenantAwareAuthResourceUrlBuilder`, `AuthHttpClient`, and `AbstractAuthRequestHandler` to accept an optional emulator host parameter. - Modified token generation and verification methods in `BaseAuth` to utilize the emulator mode based on the new parameter. - Added tests to ensure correct behavior of emulator settings, including persistence after environment variable changes. - Improved handling of emulator state in `TenantManager` and `TenantAwareAuth` classes.
…lator (#3142) The Auth emulator does not populate the resource `name` field on its /config responses, so getProjectConfig() and updateProjectConfig() throw "INTERNAL ASSERT FAILED: Unable to get/update project config" against the emulator. Skip the assertion in both validators when useEmulator() is true. Production behavior is unchanged — a backend response missing `name` still throws. The guard reuses the existing useEmulator() helper, matching the same dynamic-read pattern AuthResourceUrlBuilder and AuthHttpClient already use to branch on the emulator. Fixes #2461.
Merge v14 branch to main