Catch up on everything announced at Firebase Summit, and learn how Firebase can help you accelerate app development and run your app with confidence. Learn More

Cloud Functions v2 public preview

Stay organized with collections Save and categorize content based on your preferences.

Powered by Cloud Run and Eventarc, Cloud Functions for Firebase v2 has the potential to give you more powerful infrastructure, advanced control over performance and scalability, and more control of the functions runtime. This public preview documentation explains what's new and what's available at this point in the beta program for v2, and provides some guidance on how to use the new API, whether alone or together with Cloud Functions for Firebase v1 APIs.

What's new in Cloud Functions for Firebase v2

Changes and enhancements currently available in Cloud Functions for Firebase v2 include:

  • Function instances can now execute more than one request at a time. This feature is available for functions with one dedicated CPU or higher. Concurrency levels can be set on a per-function basis or across all functions with the setGlobalOptions method. If unspecified, new functions with 1 dedicated CPU or higher will default to 80 concurrent requests. See Allow concurrent requests.
  • Secure your callable and HTTP functions with a new cors setting. HTTP triggers also now have a cors setting to make CORS easier to manage.
  • Cloud Functions is now built on Cloud Run. If you're not familiar with Cloud Run, don't worry: building functions is just as easy as before. Cloud Run is a more modern serverless product that gives you better performance, better configuration, better monitoring, and more.
  • Google has collaborated with industry leaders to create the CloudEvents specification. Event handling functions now use this open standard as their event signature.
  • New trigger types include Firebase Alerts triggers, custom event triggers for Firebase Extensions, and task queue functions to run resource-intensive tasks on Cloud Tasks (task queue functions are also available in v1).
  • The firebase-functions SDK has been reimagined as more native to modern JavaScript. You can configure v2 functions globally, use options objects, and use modular imports.
  • HTTP functions can now have a 1 hour timeout (up from 9 minutes previously) if needed for long-running workloads.
  • Function instances now default to the default compute service account rather than the app engine service account.

Limitations during public preview

This limited public preview of Cloud Functions v2 does not yet include the full set of planned functionality, nor does it provide full feature parity with Cloud Functions v1. It is limited in terms of the triggers and regions available, and has the other current limitations described in this section.

Currently available Cloud Functions locations

Cloud Functions v2 is currently available in the following regions:

  • europe-north1
  • europe-west1
  • europe-west4
  • us-central1
  • us-east1
  • us-west1

Currently available Cloud Functions triggers

Cloud Functions v2 supports the following Firebase background triggers:

  • Firebase Realtime Database
  • Cloud Storage
  • Firebase Alerts
  • Pub/Sub
  • Callables
  • Cloud Tasks
  • HTTP
  • Scheduled functions
  • Firebase Authentication blocking functions
  • Firebase Remote Config
  • Firebase Test Lab

Cloud Functions v2 does not currently support the following triggers:

  • Cloud Firestore
  • Firebase Authentication onCreate and onDelete
  • Google Analytics

Other limitations

These limitations also apply to Cloud Functions v2:

  • Function names are restricted to lowercase letters, numbers, and dashes.
  • Full observability is not yet built into the Firebase CLI or Firebase console. To observe your function instances, use the Google Cloud Console for the underlying Cloud Run service.
  • The Firebase Local Emulator Suite currently supports HTTP, Cloud Storage, and Pub/Sub functions in v2.
  • URLs aren't yet supported for HTTP functions; temporarily, you'll see URLs instead. This limitation also affects invocation of callable and task queue functions (see the respective guides for acceptable workarounds).
  • Cold starts have not yet been optimized in v2, and temporarily may be significantly slower than in v1. However, end users should experience fewer cold starts overall thanks to concurrency.