Skip to content

Conversation

@taeold
Copy link
Contributor

@taeold taeold commented Nov 3, 2025

  • Breaking: Minimum Node.js version is now 18. As of v7.0.0, the SDK requires a Node.js runtime of version 18 or newer. Support for Node.js 14 and 16 has been removed.

    • Impact: Functions using this SDK version will fail to deploy or run on Node.js runtimes older than v18.
    • Action Required: Before upgrading the SDK, you must set the node.js version to update your function's runtime environment to Node.js 18 or higher. We recommend using the latest Node.js LTS version supported by Cloud Functions.
  • Breaking: The functions.config() API has been removed. Following the deprecation schedule announced in v6.0.0, functions.config() has been removed entirely.

    • Impact: Calling this API will now throw a runtime error and cause build time errors if you are using TypeScript. Any function relying on functions.config() will fail at runtime.
    • Action Required: You must migrate from runtime configuration to environment variables using the params module.
  • Breaking: TypeScript v5 is now required. The SDK has been upgraded from TypeScript v4.3 to v5.9 and now targets ES2022.

    • Impact: This may introduce new type-checking errors in your project if you are using an older version of TypeScript or if your code relies on older type definitions.
    • Action Required: Update your project's TypeScript version to v5.x and resolve any resulting type errors.
  • Breaking: Improved error handling for async handlers in the Emulator. We have improved how unhandled errors are processed in the Local Emulator Suite. Previously, an unhandled error or rejected Promise in an async onRequest handler would cause the request to hang until a platform timeout.

    • Impact: As of v7.0.0, these unhandled errors will now correctly and immediately return a 500 Internal Server Error.
    • Action Required: This is a technical breaking change, as it changes error-handling behavior. This provides faster, more accurate error feedback during local development. Ensure your error handling logic is correct and not reliant on the old timeout behavior.
  • Feature: The SDK is now published as both CommonJS (CJS) and ECMAScript Modules (ESM). This provides first-class support for modern bundlers (like Vite and esbuild) and native import syntax, which can lead to optimized function sources and smaller bundle sizes. The package.json exports map now properly resolves for both require and import.

  • Feature: New FDC Trigger This release adds a new function trigger for Firebase Data Connect (FDC), onMutationExecuted(). This allows you to execute functions in response to data mutations.

taeold and others added 8 commits October 21, 2025 08:18
Upgrades from TypeScript v4.3.5 to v5.9.3. All tests pass successfully.
* BREAKING: Drop Node.js 14/16 support, require Node.js >=18

- Update package.json engines to require Node.js >=18.0.0
- Upgrade @types/node from v14 to v18
- Update TypeScript target from ES2019 to ES2022
- Add useDefineForClassFields: false for backward compatibility
- Update CI/CD workflows to test Node.js 18, 20, 22, and 24
- Set default CI/CD Node.js version to 24
- Update integration test documentation
Replace functions.config() implementation with an error that provides
clear migration guidance to the params module. This removes the deprecated
API as planned for the next major release while helping developers migrate.

The error message directs users to:
https://firebase.google.com/docs/functions/config-env#migrate-config
Upgraded eslint to v9 and replaced the legacy .eslintrc.js with the new eslint.config.js format.

Applied minor fixes to 4 files (renaming unused catch variables to _e and one small refactor) to satisfy slightly stricter baseline rules from updated plugins.

Mostly doing this due to our upgrade in TS to latest v5 version which the old versions of eslint ts plugins no longer support.
BREAKING CHANGE: Unhandled errors in async onRequest handlers now immediately return a 500 Internal Server Error instead of hanging until timeout. This may affect clients relying on 504 Gateway Timeout for retry logic.
Type out `functions.config()` API. Use of `functions.config()` API should now cause a BUILD error at compile time.

```ts
import * as functions from "firebase-functions";
import {onRequest} from "firebase-functions/https";
import * as logger from "firebase-functions/logger";

const cfg = functions.config()

export const helloWorld = onRequest((request, response) => {
  logger.info("Hello logs!", cfg);
  response.send("Hello from Firebase!");
});
```
```bash
$ npm run build

> build
> tsc

src/index.ts:5:23 - error TS2349: This expression is not callable.
  Type 'never' has no call signatures.

5 const cfg = functions.config()
                        ~~~~~~


Found 1 error in src/index.ts:5
```
* Add Firebase Data Connect v2 support

* Export dataconnect

* Fix export

* Rename Extract to VarName, since Extract is a built in type

* Include auth context in event payload

* Stronger typing for data connect params

* Fix formatting and address comments

* Apply another suggestion

* Add region and fix bug in which event.service, event.connector, event.operation gets populated

* Remove locations/... segment

* Address comments
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @taeold, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request represents a significant update to the Firebase Functions SDK, bumping it to version 7.0.0. The changes focus on modernizing the development environment by adopting the new ESLint flat configuration and upgrading core dependencies. It also expands the SDK's capabilities by introducing event handlers for Firebase Data Connect, allowing developers to build more integrated solutions. Concurrently, it streamlines error handling for asynchronous HTTP functions and formally deprecates an older configuration API, guiding users towards more current and robust practices.

Highlights

  • ESLint Configuration Update: The project's ESLint configuration has been migrated from the traditional .eslintrc.js to the new flat config format in eslint.config.js, enhancing flexibility and maintainability of linting rules.
  • Dependency Upgrades: Numerous development dependencies, including ESLint, TypeScript, and related plugins, have been updated to their latest major versions. The minimum Node.js engine requirement has also been raised to >=18.0.0.
  • Firebase Data Connect Integration: New event handlers for Firebase Data Connect have been introduced in v2, allowing functions to respond to onMutationExecuted events with detailed parameter extraction.
  • Deprecation of functions.config(): The functions.config() API in v1 has been officially deprecated and now throws an error with clear migration guidance, encouraging users to transition to environment parameters.
  • Improved Async HTTP Error Handling: A new withErrorHandler utility has been implemented and integrated into both v1 and v2 HTTP onRequest handlers to gracefully catch and log unhandled rejections from async functions, preventing requests from hanging.
  • Modernized Module Imports: Several internal modules have been refactored to use default import statements (e.g., fs, express, chai, nock), aligning with modern JavaScript practices and improving compatibility.
Ignored Files
  • Ignored by pattern: .github/workflows/** (3)
    • .github/workflows/docs.yaml
    • .github/workflows/postmerge.yaml
    • .github/workflows/test.yaml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
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 introduces a major version bump to 7.0.0, bringing several modernizations to the codebase. Key changes include upgrading to ESLint's flat config, updating the TypeScript target to ES2022, enabling esModuleInterop for cleaner imports, and dropping support for Node.js versions below 18. A significant and welcome change is the removal of the deprecated functions.config() in favor of environment parameters. The introduction of the new dataconnect provider and improved error handling for HTTPS onRequest handlers are also notable improvements. My review focuses on potential issues in the new configurations and implementations to ensure robustness and correctness.

- Configure tsdown to build both CJS and ESM outputs.
- Update package.json exports to support both 'require' and 'import'.
- Fix type hygiene issues by using explicit 'export type'.
- Update protos/update.sh to generate ESM version of compiledFirestore and fix its imports for Node.js compatibility.
- Configure build aliases to handle relative paths to protos correctly in both CJS and ESM builds.
- Add packaging integration test to CI.

~Note: I enabled `esModuleInterop` in tsconfig.release.json to support default imports from CommonJS modules (like cors), which is required for proper ESM interop. This caused some chain-effect that required updating several unit tests and source files to use default imports for other CJS dependencies (e.g., fs, nock, jsonwebtoken) to align with the new compiler configuration.~ Fixed in #1751.
@taeold
Copy link
Contributor Author

taeold commented Nov 4, 2025

/gemini review

Copy link
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 introduces a major version update to firebase-functions. Key changes include upgrading the minimum Node.js version to 18, removing the deprecated functions.config() API in favor of environment parameters, and overhauling the build system to support dual CJS/ESM modules using tsdown. The ESLint configuration has been modernized to the new flat config format. A new dataconnect provider is introduced. A critical bug fix for unhandled promise rejections in onRequest handlers has been implemented. Additionally, robust packaging tests have been added to verify module exports. The changes are extensive and well-executed, significantly improving the SDK's architecture and developer experience. My feedback includes a minor suggestion to improve script maintainability.

Copy link
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 introduces a major version bump to 7.0.0, bringing a significant modernization to the firebase-functions SDK. Key improvements include a new build system using tsdown for dual CJS/ESM support, migration to ESLint's flat config, and an upgrade to Node.js 18. The removal of the deprecated functions.config() is a notable breaking change, handled cleanly with clear migration guidance. I'm also excited to see the new dataconnect provider and the addition of robust error handling for unhandled promises in HTTPS functions, which will greatly improve developer experience and function stability. The new packaging tests are an excellent addition for ensuring package integrity. Overall, this is a high-quality update with well-executed changes. I have a few minor suggestions to further improve the code.

Copy link
Contributor

@jhuleatt jhuleatt left a comment

Choose a reason for hiding this comment

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

🚢 🚢 🚢

@taeold taeold added this pull request to the merge queue Nov 4, 2025
Merged via the queue into master with commit f852d27 Nov 4, 2025
32 checks passed
@github-project-automation github-project-automation bot moved this from Approved [PR] to Done in [Cloud] Extensions + Functions Nov 4, 2025
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.

3 participants