# Cloud Functions for Firebase

Cloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests.


## Docs

- [Cloud Functions for Firebase](https://firebase.google.com/docs/functions.md.txt): Cloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests.
- [Configure your environment (1st gen)](https://firebase.google.com/docs/functions/1st-gen/config-env-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to configure functions with parameterized configuration or environment variables.
- [Realtime Database triggers (1st gen)](https://firebase.google.com/docs/functions/1st-gen/database-events-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to handle events in the Firebase Realtime Database to run operations with administrative privileges.
- [Cloud Firestore triggers (1st gen)](https://firebase.google.com/docs/functions/1st-gen/firestore-events-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to handle events in Cloud Firestore to perform tasks without updating client code.
- [Cloud Storage triggers (1st gen)](https://firebase.google.com/docs/functions/1st-gen/gcp-storage-events-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to trigger a function in response to the uploading, updating, or deleting of files and folders in Cloud Storage.
- [Get started: write, test, and deploy your first functions (1st gen)](https://firebase.google.com/docs/functions/1st-gen/get-started-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to get started with functions by creating, testing, and deploying your first functions.
- [Remote Config triggers (1st gen)](https://firebase.google.com/docs/functions/1st-gen/rc-events-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to trigger a function in response to Firebase Remote Config events, including the publication of a new config version or a rollback.
- [Report errors (1st gen)](https://firebase.google.com/docs/functions/1st-gen/reporting-errors-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to report errors from a function to Cloud Logging and Error Reporting for more fine-grained error reporting.
- [Enqueue functions with Cloud Tasks (1st gen)](https://firebase.google.com/docs/functions/1st-gen/task-functions-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to enqueue functions with Cloud Tasks to help your app run time-consuming, resource-intensive, or bandwidth-limited tasks asynchronously.
- [Test Lab triggers (1st gen)](https://firebase.google.com/docs/functions/1st-gen/test-lab-events-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to trigger a function when a test matrix completes to handle test states and outcomes.
- [Write and view logs (1st gen)](https://firebase.google.com/docs/functions/1st-gen/writing-and-viewing-logs-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to write and view logs for functions using the logger SDK, custom Google Cloud Logging, or the console object standard.
- [Call functions from your app](https://firebase.google.com/docs/functions/callable.md.txt): A guide to calling functions directly from your Firebase app, covering how to write, deploy, and call HTTP Callable functions.
- [Configure your environment](https://firebase.google.com/docs/functions/config-env.md.txt): A guide to configuring your Cloud Functions environment, covering parameterized configuration, environment variables, and Secret Manager.
- [Create and handle custom event triggers](https://firebase.google.com/docs/functions/custom-events.md.txt): A guide to creating and handling custom event triggers in Cloud Functions by publishing events to Eventarc channels and subscribing to them.
- [FAQ &amp; Troubleshooting](https://firebase.google.com/docs/functions/faq-and-troubleshooting.md.txt): Frequently asked questions and troubleshooting for Cloud Functions for Firebase.
- [Cloud Storage triggers](https://firebase.google.com/docs/functions/gcp-storage-events.md.txt): A guide to triggering Cloud Functions in response to Cloud Storage events, including file uploads, updates, and deletions.
- [Run functions locally](https://firebase.google.com/docs/functions/local-emulator.md.txt): A guide to running and testing your functions locally using the Firebase CLI, covering installation, environment setup, and service interaction.
- [Manage functions](https://firebase.google.com/docs/functions/manage-functions.md.txt): A guide to managing your Cloud Functions deployments, covering how to deploy, delete, modify, and set runtime options for functions.
- [Organize multiple functions](https://firebase.google.com/docs/functions/organize-functions.md.txt): A guide to organizing functions for better navigation and maintenance, covering management in codebases, multiple files, and groups.
- [Pub/Sub triggers](https://firebase.google.com/docs/functions/pubsub-events.md.txt): A guide to triggering functions in response to Pub/Sub events, explaining how to handle new messages and access the message payload.
- [Quotas and limits](https://firebase.google.com/docs/functions/quotas.md.txt): An overview of the quotas and limits for Cloud Functions, detailing the usage-based limits for invocations, compute time, and internet traffic.
- [Report errors](https://firebase.google.com/docs/functions/reporting-errors.md.txt): A guide to reporting errors from Cloud Functions to Cloud Error Reporting, covering both automatic and manual methods.
- [Retry asynchronous functions](https://firebase.google.com/docs/functions/retries.md.txt): A guide to configuring asynchronous functions to retry on failure by enabling and disabling retries for background functions.
- [Enqueue functions with Cloud Tasks](https://firebase.google.com/docs/functions/task-functions.md.txt): A guide to enqueuing functions with Cloud Tasks for asynchronous execution of resource-intensive tasks, covering creation, testing, and deployment.
- [Sync, async, and promises](https://firebase.google.com/docs/functions/terminate-functions.md.txt): A guide to properly managing the lifecycle of your functions, explaining how to terminate synchronous, asynchronous, and HTTP functions.
- [Firebase Test Lab triggers](https://firebase.google.com/docs/functions/test-lab-events.md.txt): A guide to triggering Cloud Functions in response to Firebase Test Lab events, explaining how to handle test matrix completion and access client details.
- [Unit testing of Cloud Functions](https://firebase.google.com/docs/functions/unit-testing.md.txt): A guide to writing unit tests for functions using the Firebase Functions Test SDK for both background and HTTP functions.
- [Cloud Functions version comparison](https://firebase.google.com/docs/functions/version-comparison.md.txt): A comparison of the two versions of Cloud Functions, highlighting the new features in the 2nd gen.
- [Cloud Functions for Firebase (video series)](https://firebase.google.com/docs/functions/video-series.md.txt): Cloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests.
- [Write and view logs](https://firebase.google.com/docs/functions/writing-and-viewing-logs.md.txt): A guide to writing and viewing logs for Cloud Functions, covering the logger SDK, the Firebase console, and Cloud Logging.
- [Google Analytics triggers](https://firebase.google.com/docs/functions/1st-gen/analytics-events.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to trigger functions in response to Google Analytics conversion events.
- [Auth blocking triggers (1st gen)](https://firebase.google.com/docs/functions/1st-gen/auth-blocking-events-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to execute custom code that modifies the result of a user registering or signing in to your app.
- [Firebase Authentication triggers (1st gen)](https://firebase.google.com/docs/functions/1st-gen/auth-events.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to handle Firebase Authentication events for user creation and deletion.
- [Call functions from your app (1st gen)](https://firebase.google.com/docs/functions/1st-gen/callable-1st.md.txt): This guide is for 1st gen Cloud Functions only, and covers how to write and deploy HTTP Callable functions and add client logic to call them from your app.
- [Call functions via HTTP requests (1st gen)](https://firebase.google.com/docs/functions/1st-gen/http-events-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to trigger a function through an HTTP request using various supported HTTP methods.
- [Manage functions (1st gen)](https://firebase.google.com/docs/functions/1st-gen/manage-functions-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to deploy, delete, and modify functions using Firebase CLI commands or by setting runtime options in your functions source code.
- [Organize multiple functions (1st gen)](https://firebase.google.com/docs/functions/1st-gen/organize-functions-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to organize functions in codebases or multiple files to make them easier to navigate and maintain.
- [Pub/Sub triggers (1st gen)](https://firebase.google.com/docs/functions/1st-gen/pubsub-events-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to create a function that handles Pub/Sub events from a globally distributed message bus.
- [Schedule functions (1st gen)](https://firebase.google.com/docs/functions/1st-gen/schedule-functions-1st.md.txt): This guide is for 1st gen Cloud Functions only, and describes how to schedule functions to run at specified times using a Pub/Sub topic.
- [Upgrade 1st gen Node.js functions to 2nd gen](https://firebase.google.com/docs/functions/2nd-gen-upgrade.md.txt): A guide to upgrading 1st gen Node.js functions to 2nd gen, covering the benefits and migration process.
- [Firebase Alerts triggers](https://firebase.google.com/docs/functions/alert-events.md.txt): A guide to writing functions that handle Firebase alert events, with examples for Crashlytics, Performance Monitoring, and App Distribution.
- [Auth blocking triggers](https://firebase.google.com/docs/functions/auth-blocking-events.md.txt): A guide to using blocking functions to customize authentication flows, with examples for blocking user registration and sign-in.
- [Protocol specification for https.onCall](https://firebase.google.com/docs/functions/callable-reference.md.txt): An outline of the protocol specification for `https.onCall` triggers in Cloud Functions, covering request and response formats, status codes, and serialization.
- [SQL&nbsp;Connect triggers for Cloud Functions](https://firebase.google.com/docs/functions/data-connect-events.md.txt): A guide to handling Data Connect events with Cloud Functions, explaining how to trigger functions in response to data changes.
- [Realtime Database triggers](https://firebase.google.com/docs/functions/database-events.md.txt): A guide to handling Realtime Database events with Cloud Functions, explaining how to trigger functions in response to data changes.
- [Cloud Firestore triggers](https://firebase.google.com/docs/functions/firestore-events.md.txt): A guide to handling Cloud Firestore events with Cloud Functions, explaining how to trigger functions in response to document changes.
- [Cloud Run functions and Firebase](https://firebase.google.com/docs/functions/functions-and-firebase.md.txt): An explanation of how Cloud Run functions work with Firebase, detailing the relationship between the two services.
- [Get started: write, test, and deploy your first functions](https://firebase.google.com/docs/functions/get-started.md.txt): A step-by-step guide to getting started with Cloud Functions, covering how to write, test, and deploy your first functions.
- [Handling dependencies](https://firebase.google.com/docs/functions/handle-dependencies.md.txt): A guide to managing dependencies for your functions in Node.js and Python, covering local, external, and private modules.
- [Call functions via HTTP requests](https://firebase.google.com/docs/functions/http-events.md.txt): A guide to calling functions via HTTP requests, explaining how to create functions that handle HTTP events, configure CORS, and read request values.
- [Test functions interactively](https://firebase.google.com/docs/functions/local-shell.md.txt): A guide to testing your functions interactively using the Cloud Functions shell, covering how to invoke different function types with test data.
- [Cloud Functions locations](https://firebase.google.com/docs/functions/locations.md.txt): An overview of the supported regions for Cloud Functions and best practices for selecting a location to optimize for latency and availability.
- [Optimizing networking](https://firebase.google.com/docs/functions/networking.md.txt): A guide to optimizing networking for Cloud Functions, providing best practices for maintaining persistent connections and reducing CPU time.
- [Invoke Genkit flows from your app](https://firebase.google.com/docs/functions/oncallgenkit.md.txt): A guide to invoking Genkit flows from your app using Cloud Functions for Firebase by wrapping a Genkit flow in an `onCallGenkit` function.
- [Remote Config triggers](https://firebase.google.com/docs/functions/rc-events.md.txt): A guide to triggering functions in response to Remote Config events, explaining how to handle new config versions and rollbacks.
- [Schedule functions](https://firebase.google.com/docs/functions/schedule-functions.md.txt): A guide to scheduling functions to run at specified times using the onSchedule handler and deploying them with Cloud Functions.
- [Tips &amp; tricks](https://firebase.google.com/docs/functions/tips.md.txt): A collection of tips and tricks for working with Cloud Functions, including how to write idempotent functions and handle dependencies.
- [Use TypeScript for Cloud Functions](https://firebase.google.com/docs/functions/typescript.md.txt): A guide to using TypeScript to write functions, covering project initialization, migration from JavaScript, and emulation.
- [What can you do with Cloud Functions?](https://firebase.google.com/docs/functions/use-cases.md.txt): An overview of the various use cases for Cloud Functions, including user notifications, database maintenance, intensive task execution, and third-party service integration.
- [Get started with the experimental Dart SDK](https://firebase.google.com/docs/functions/start-dart.md.txt): A step-by-step guide to getting started with the experimental Dart SDK for moonrise-replacee94f56a959074250b5431e3e3a329b95moonrise-replace, covering how to write, test, and deploy your first functions.
- [Firebase Authentication triggers](https://firebase.google.com/docs/functions/auth-events.md.txt): A guide to handling Firebase Authentication events with Cloud Functions (2nd gen), explaining how to trigger functions in response to user creation and deletion.