Skip to content

Upgrade to Firebase Functions v2#2444

Merged
rfontanarosa merged 11 commits into
masterfrom
rfontanarosa/2086/feature-firebase-functions-v2---profobuf-compatibility
Mar 5, 2026
Merged

Upgrade to Firebase Functions v2#2444
rfontanarosa merged 11 commits into
masterfrom
rfontanarosa/2086/feature-firebase-functions-v2---profobuf-compatibility

Conversation

@rfontanarosa
Copy link
Copy Markdown
Collaborator

@rfontanarosa rfontanarosa commented Mar 5, 2026

@auto-assign auto-assign Bot requested a review from gino-m March 5, 2026 13:35
@rfontanarosa rfontanarosa changed the title Rfontanarosa/2086/feature firebase functions v2 profobuf compatibility Upgrade to Firebase Functions v2 Mar 5, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 undertakes a significant upgrade of the project's Firebase Cloud Functions, transitioning them from version 1 to version 2. This migration involves updating the API imports and adapting function signatures to the new v2 event and request/response types, ensuring compatibility and leveraging the latest features. Concurrently, related development dependencies and internal testing utilities have been refined to support this updated functions environment. The changes aim to modernize the serverless backend infrastructure.

Highlights

  • Firebase Functions V1 to V2 Migration: Core Firebase Cloud Functions, including HTTP and Firestore triggers, have been upgraded from v1 to v2 syntax and APIs, involving updates to imports and function signatures.
  • Dependency Management Updates: Development dependencies were adjusted across package.json files, notably adding @types/express and re-positioning isolate-package for improved compatibility.
  • Testing Utilities Modernization: Internal testing helpers for Firestore event contexts were removed and updated to align with the new Firebase Functions V2 event structure, streamlining test setup.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • functions/package.json
    • Added @types/express as a development dependency.
    • Removed isolate-package from dev dependencies.
  • functions/src/common/auth.ts
    • Updated imports for Request and Response to Firebase Functions v2 and Express types.
    • Modified function signatures to use the new Request type from Firebase Functions v2.
  • functions/src/common/datastore.ts
    • Updated import for UserRecord to firebase-admin/auth.
    • Modified mergeUserProfile function signature to use the UserRecord type.
  • functions/src/export-csv.ts
    • Updated imports for Request and Response to Firebase Functions v2 and Express types.
    • Modified exportCsvHandler function signature to use the new Request and Response types.
  • functions/src/export-geojson.ts
    • Updated imports for Request and Response to Firebase Functions v2 and Express types.
    • Modified exportGeojsonHandler function signature to use the new Request and Response types.
  • functions/src/handlers.ts
    • Updated imports for onRequest, Request, and Response to Firebase Functions v2 and Express types.
    • Modified function signatures and type definitions to use the new Request and Response types.
  • functions/src/import-geojson.ts
    • Updated imports for Request and Response to Firebase Functions v2 and Express types.
    • Modified importGeoJsonCallback function signature to use the new Request and Response types.
  • functions/src/index.ts
    • Updated imports for Firestore triggers to onDocumentCreated and onDocumentWritten from Firebase Functions v2.
    • Migrated Firestore trigger functions to use the new Firebase Functions v2 syntax.
  • functions/src/on-create-loi.ts
    • Updated imports for FirestoreEvent and QueryDocumentSnapshot from Firebase Functions v2.
    • Modified onCreateLoiHandler function signature to accept FirestoreEvent and access event data and parameters.
  • functions/src/on-create-passlist-entry.spec.ts
    • Removed newEventContext import and firebase-functions-test dependency.
    • Updated test calls to onCreatePasslistEntryHandler to pass mock FirestoreEvent objects directly.
  • functions/src/on-create-passlist-entry.ts
    • Updated imports for FirestoreEvent and QueryDocumentSnapshot from Firebase Functions v2.
    • Modified onCreatePasslistEntryHandler function signature to accept FirestoreEvent and access event parameters.
  • functions/src/on-write-job.ts
    • Updated imports for Change, DocumentSnapshot, and FirestoreEvent from Firebase Functions v2.
    • Modified onWriteJobHandler function signature to accept FirestoreEvent and access event parameters.
  • functions/src/on-write-loi.ts
    • Updated imports for Change, DocumentSnapshot, and FirestoreEvent from Firebase Functions v2.
    • Modified onWriteLoiHandler function signature to accept FirestoreEvent and access event parameters.
  • functions/src/on-write-submission.spec.ts
    • Removed newEventContext import and firebase-functions-test dependency.
    • Updated test calls to onWriteSubmissionHandler to pass mock FirestoreEvent objects directly.
  • functions/src/on-write-submission.ts
    • Updated imports for Change, DocumentSnapshot, and FirestoreEvent from Firebase Functions v2.
    • Modified onWriteSubmissionHandler function signature to accept FirestoreEvent and access event data and parameters.
  • functions/src/on-write-survey.ts
    • Updated imports for Change, DocumentSnapshot, and FirestoreEvent from Firebase Functions v2.
    • Modified onWriteSurveyHandler function signature to accept FirestoreEvent and access event parameters.
  • functions/src/session-login.ts
    • Updated imports for Request from Firebase Functions v2, logger from firebase-functions/logger, and Response from Express.
    • Modified sessionLoginHandler function signature to use the new Request type.
  • functions/src/testing/http-test-helpers.ts
    • Updated imports for Request from Firebase Functions v2 and Response from Express.
    • Modified createPostRequestSpy and createGetRequestSpy function signatures to use the new Request type.
  • lib/src/testing/firestore/event-context.ts
    • Removed the file, deprecating TestEventContext and newEventContext.
  • lib/src/testing/firestore/index.ts
    • Removed the export for event-context.
  • package.json
    • Added isolate-package as a development dependency.
  • pnpm-lock.yaml
    • Updated various package versions and added libc specifications for native modules.
    • Updated @types/express version.
    • Adjusted isolate-package entry.
    • Updated @types/cookie-parser dependency on @types/express.
  • pnpm-workspace.yaml
    • Added @types/express to the catalog definitions.
Activity
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.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.97%. Comparing base (bd5a939) to head (c7ee9be).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2444   +/-   ##
=======================================
  Coverage   58.97%   58.97%           
=======================================
  Files         111      111           
  Lines        2747     2747           
  Branches      408      408           
=======================================
  Hits         1620     1620           
  Misses       1065     1065           
  Partials       62       62           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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 successfully upgrades Firebase Functions from v1 to v2. The changes are comprehensive, updating HTTP triggers, Firestore triggers, and their corresponding tests to use the new APIs. The migration appears to be well-executed across the codebase. I found one potential issue where an error returned from a utility function was not being handled, which could lead to a function crash. I've left a comment with a suggestion to fix it. Otherwise, the changes look good.

Note: Security Review did not run due to the size of the PR.

@rfontanarosa rfontanarosa self-assigned this Mar 5, 2026
@rfontanarosa rfontanarosa merged commit d243b39 into master Mar 5, 2026
9 checks passed
@rfontanarosa rfontanarosa deleted the rfontanarosa/2086/feature-firebase-functions-v2---profobuf-compatibility branch March 5, 2026 16:53
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.

[Feature] Firebase Functions v2 - Profobuf compatibility

3 participants