Skip to content
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

Migrate Firebase Functions to V2 API and Update Dependencies #98

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tharropoulos
Copy link
Collaborator

Change Summary

What is this?

This change modernizes our Firebase Functions implementation by upgrading to the V2 API. We're also updating our dependencies to their latest stable versions to ensure we're using the most secure and feature-rich versions available.
This comes as a response to users wanting to migrate to the V2 API to make use of all the new features that it provides.

Changes

Code Changes:

  1. In functions/src/indexOnWrite.js:

    • Migrated from functions.firestore.document().onWrite() to onDocumentWritten() V2 API
    • Replaced functions.logger with granular imports from firebase-functions/logger
    • Simplified code structure and improved error handling patterns
  2. In functions/src/backfill.js:

    • Updated function handler to use V2 onDocumentWritten syntax
    • Migrated logging to use destructured imports (info, error) from firebase-functions/logger
    • Improved code formatting and readability
  3. In functions/src/index.js:

    • Added dotenv configuration for better environment variable management
    • Maintained existing exports structure for backward compatibility

Dependency Updates:

  1. Major Version Updates:

    • firebase-admin: 12.2.013.0.1
    • firebase-functions: 5.0.16.1.1
  2. Added Dependencies:

    • dotenv: ^16.4.7 for improved environment variable handling
  3. Removed Dependencies:

    • firebase-functions-test: Removed as it's not needed in the current test setup

This update maintains all existing functionality while modernizing the codebase.

PR Checklist

* update backfill.js and indexOnWrite.js to use onDocumentWritten v2
* replace functions.logger with firebase-functions/logger imports
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.

1 participant