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
setGlobalOptionsmethod. 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
corssetting. HTTP triggers also now have a
corssetting 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).
- 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:
Currently available Cloud Functions triggers
Cloud Functions v2 supports the following Firebase background triggers:
- Cloud Storage
- Firebase Alerts
- Cloud Tasks
Cloud Functions v2 does not currently support the following triggers:
- Firebase Realtime Database
- Cloud Firestore
- Firebase Authentication
- Google Analytics
- Scheduled functions
- Firebase Remote Config
- Firebase Test Lab
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.
cloudfunctions.netURLs aren't yet supported for HTTP functions; temporarily, you'll see
.run.appURLs 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.