SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Downloaden Sie, um offline zu lesen
FIREBASE CLOUD
FUNCTIONS V2
And friends....
whoami - I Am !Groot
Aviv Laufer
CTO as a Service - https://42-golems.io/
@avivl
42-golems.io
A Brief History of Firebase
● 2014 Acquired by Google, Firebase Hosting & Authentication.
● 2016 Analytics, Messaging.
● Firebase, a real-time document database.
● Cloud Firestore scalable NoSQL cloud database.
● Cloud Functions
● Remote Config
● And much more https://firebase.google.com/products-build
42-golems.io
“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. Your JavaScript or TypeScript code is stored in
Google's cloud and runs in a managed environment. There's no need to
manage and scale your own servers.“
Firebase Functions the Shpiel
42-golems.io
The Shpiel continues...
After you write and deploy a function, Google's servers begin to manage the function
immediately. You can fire the function directly with an HTTP request, or, in the case of
background functions, Google's servers will listen for events and run the function when it
is triggered.
● Cloud Firestore triggers
● Realtime Database triggers
● Remote Config triggers
● Firebase Authentication triggers
● Google Analytics triggers
● Cloud Storage triggers
● Pub/Sub triggers
42-golems.io
Welcome to V2
Powered by Cloud Run and Eventarc, Cloud Functions for Firebase (2nd gen) has
the potential to give you more powerful infrastructure, advanced control over
performance and scalability, and more control of the functions runtime.
42-golems.io
Cloud Run
● Fully managed
● Excellent for stateless containers.
● Serverless
● Built on top of Knative.
● Comes in 2 flavorus.
Shameless Plug
Taking Google Cloud Run for a spin
Hacking Google Cloud Run
42-golems.io
Eventarc
Eventarc lets you build event-driven architectures without having to implement, customize, or maintain the underlying
infrastructure. Eventarc offers a standardized solution to manage the flow of state changes, called events, between
decoupled microservices. When triggered, Eventarc routes these events through Pub/Sub subscriptions to various
destinations (in this document, see Event destinations) while managing delivery, security, authorization, observability, and
error-handling for you.
42-golems.io
What's new in Cloud Functions for Firebase (2nd gen)
● Function instances can now execute more than one request at a time.
● Secure your callable and HTTP functions with a new `cors` setting.
42-golems.io
● HTTP functions can now have a 1 hour timeout (up from 9 minutes
previously).
● Function instances now default to the default compute service account rather
than the app engine service account.
● New trigger types include Firebase Alerts, triggers custom event triggers for
Firebase Extensions, and task queue functions. .
What's new cont...
42-golems.io
V2 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
42-golems.io
Not supported triggers (for now)
● Cloud Firestore
● Firebase Authentication `onCreate` and `onDelete`
● Google Analytics
42-golems.io
From V1 to V2 and beyond
42-golems.io
Call functions directly
● Call functions from your app
● Call functions via HTTP requests
● Enqueue functions with Cloud Tasks
● Run functions on schedule
42-golems.io
Trigger background functions
● Firebase Alerts triggers
● Custom event/extension triggers
● Blocking Auth triggers
● Pub/Sub triggers
● Realtime Database Triggers
● Remote Config Triggers
● Cloud Storage triggers
● Test Lab Triggers
42-golems.io
Custom event triggers/extensions NEW!
Firebase Extensions:
● Firebase Extensions help you deploy functionality to your app quickly with pre-packaged solutions.
● Once installed, a Firebase Extension performs a specific task or set of tasks in response to HTTPS
requests, Cloud Scheduler events, or to triggering events from other Firebase products, like Cloud
Firestore or Firebase Cloud Messaging.
● Available on the extensions Marketplace
42-golems.io
Extensions
● Stream Collections to BigQuery
● Resize Images
● Delete User Data
● Trigger Email
● Send Invoices using Stripe
● Send Messages with Twilio
● And many more....
42-golems.io
When you upload a file to your specified Cloud Storage bucket, this extension:
Detects if the file is an image. If it is, then:
● Creates a resized image with your specified dimensions.
● Names the resized image using the same name as the original uploaded
image, but suffixed with your specified width and height.
● Stores the resized image in the same Storage bucket as the original uploaded
image.
Resize Images
42-golems.io
42-golems.io
Authentication blocking triggers
Blocking functions let you execute custom code that modifies the result of a user registering or
signing in to your app. For example, you can prevent a user from authenticating if they don't meet
certain criteria, or update a user's information before returning it to your client app.
You can register blocking functions for two events:
● beforeUserCreated: Triggers before a new user is saved to the Firebase Authentication
database, and before a token is returned to your client app.
● beforeUserSignedIn: Triggers after a user's credentials are verified, but before Firebase
Authentication returns an ID token to your client app. If your app uses multi-factor
authentication, the function triggers after the user verifies their second factor. Note that
creating a new user also triggers beforeUserSignedIn, in addition to beforeUserCreated.
42-golems.io
42-golems.io
High Noon
42-golems.io
And the winner is....
● The test was configured to run up to 20 VUs for 6 minutes
● Using K6
42-golems.io
Life behind Firebase - Cloud Functions (2nd gen)
● Longer request processing - Up to 60 mins for HTTP functions.
● Larger instances - Up to 16GB of RAM and 4 vCPUs
● Concurrency - Up to 1000 concurrent requests with a single function.
● Minimum instances - Provide for pre-warmed instances to cut your cold starts and make sure the
bootstrap time of your application does not impact application performance.
● Traffic splitting - Support multiple revisions of your functions, splitting traffic between different
revisions and rolling your function back to a prior version.
● Event Sources - Native support for Eventarc, which brings over 90+ event sources from direct
sources and Cloud Audit logs (e.g., BigQuery, Cloud SQL, Cloud Storage, Firebase...)
42-golems.io
42-golems.io
Thank You!
42-golems.io

Weitere ähnliche Inhalte

Was ist angesagt?

ContainerConf 2022: Kubernetes is awesome - but...
ContainerConf 2022: Kubernetes is awesome - but...ContainerConf 2022: Kubernetes is awesome - but...
ContainerConf 2022: Kubernetes is awesome - but...
Nico Meisenzahl
 
AWS Lambda 100% 활용하기 :: 김상필 솔루션즈 아키텍트 :: Gaming on AWS 2016
AWS Lambda 100% 활용하기 :: 김상필 솔루션즈 아키텍트 :: Gaming on AWS 2016AWS Lambda 100% 활용하기 :: 김상필 솔루션즈 아키텍트 :: Gaming on AWS 2016
AWS Lambda 100% 활용하기 :: 김상필 솔루션즈 아키텍트 :: Gaming on AWS 2016
Amazon Web Services Korea
 

Was ist angesagt? (20)

AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
ContainerConf 2022: Kubernetes is awesome - but...
ContainerConf 2022: Kubernetes is awesome - but...ContainerConf 2022: Kubernetes is awesome - but...
ContainerConf 2022: Kubernetes is awesome - but...
 
Helm - Package manager in K8S
Helm - Package manager in K8SHelm - Package manager in K8S
Helm - Package manager in K8S
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
 
Microservices Tracing With Spring Cloud and Zipkin @Szczecin JUG
Microservices Tracing With Spring Cloud and Zipkin @Szczecin JUGMicroservices Tracing With Spring Cloud and Zipkin @Szczecin JUG
Microservices Tracing With Spring Cloud and Zipkin @Szczecin JUG
 
[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기
[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기
[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기
 
Serverless computing
Serverless computingServerless computing
Serverless computing
 
AWS Lambda 100% 활용하기 :: 김상필 솔루션즈 아키텍트 :: Gaming on AWS 2016
AWS Lambda 100% 활용하기 :: 김상필 솔루션즈 아키텍트 :: Gaming on AWS 2016AWS Lambda 100% 활용하기 :: 김상필 솔루션즈 아키텍트 :: Gaming on AWS 2016
AWS Lambda 100% 활용하기 :: 김상필 솔루션즈 아키텍트 :: Gaming on AWS 2016
 
대용량 트래픽을 처리하는 최적의 서버리스 애플리케이션 - 안효빈, 구성완 AWS 솔루션즈 아키텍트 :: AWS Summit Seoul 2021
대용량 트래픽을 처리하는 최적의 서버리스 애플리케이션  - 안효빈, 구성완 AWS 솔루션즈 아키텍트 :: AWS Summit Seoul 2021대용량 트래픽을 처리하는 최적의 서버리스 애플리케이션  - 안효빈, 구성완 AWS 솔루션즈 아키텍트 :: AWS Summit Seoul 2021
대용량 트래픽을 처리하는 최적의 서버리스 애플리케이션 - 안효빈, 구성완 AWS 솔루션즈 아키텍트 :: AWS Summit Seoul 2021
 
Grafana 7.0
Grafana 7.0Grafana 7.0
Grafana 7.0
 
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container Day
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container DayECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container Day
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container Day
 
Terraform on Azure
Terraform on AzureTerraform on Azure
Terraform on Azure
 
Configure an End-to-End Video Channel to Deliver Low Latency (CTD411-R3) - AW...
Configure an End-to-End Video Channel to Deliver Low Latency (CTD411-R3) - AW...Configure an End-to-End Video Channel to Deliver Low Latency (CTD411-R3) - AW...
Configure an End-to-End Video Channel to Deliver Low Latency (CTD411-R3) - AW...
 
Securing your Amazon SageMaker model development in a highly regulated enviro...
Securing your Amazon SageMaker model development in a highly regulated enviro...Securing your Amazon SageMaker model development in a highly regulated enviro...
Securing your Amazon SageMaker model development in a highly regulated enviro...
 
Data Pipelines with Kafka Connect
Data Pipelines with Kafka ConnectData Pipelines with Kafka Connect
Data Pipelines with Kafka Connect
 
IaC on AWS Cloud
IaC on AWS CloudIaC on AWS Cloud
IaC on AWS Cloud
 
Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform Training
 
Docker intro
Docker introDocker intro
Docker intro
 
AWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless CloudAWS Lambda and the Serverless Cloud
AWS Lambda and the Serverless Cloud
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as Code
 

Ähnlich wie Firebase Cloud Functions V2

Creating Scalable JVM/Java Apps on Heroku
Creating Scalable JVM/Java Apps on HerokuCreating Scalable JVM/Java Apps on Heroku
Creating Scalable JVM/Java Apps on Heroku
Joe Kutner
 

Ähnlich wie Firebase Cloud Functions V2 (20)

Google Firebase presentation - English
Google Firebase presentation - EnglishGoogle Firebase presentation - English
Google Firebase presentation - English
 
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
GCP - Continuous Integration and Delivery into Kubernetes with GitHub, Travis...
 
Supercharge your app with Cloud Functions for Firebase
Supercharge your app with Cloud Functions for FirebaseSupercharge your app with Cloud Functions for Firebase
Supercharge your app with Cloud Functions for Firebase
 
Google Cloud Functions & Firebase Crash Course
Google Cloud Functions & Firebase Crash CourseGoogle Cloud Functions & Firebase Crash Course
Google Cloud Functions & Firebase Crash Course
 
Google Cloud Next '22 Recap: Serverless & Data edition
Google Cloud Next '22 Recap: Serverless & Data editionGoogle Cloud Next '22 Recap: Serverless & Data edition
Google Cloud Next '22 Recap: Serverless & Data edition
 
IDEALIZE 2023 - NodeJS & Firebase Session
IDEALIZE 2023 - NodeJS & Firebase SessionIDEALIZE 2023 - NodeJS & Firebase Session
IDEALIZE 2023 - NodeJS & Firebase Session
 
GCCP Session 2.pptx
GCCP Session 2.pptxGCCP Session 2.pptx
GCCP Session 2.pptx
 
Session 4 GCCP.pptx
Session 4 GCCP.pptxSession 4 GCCP.pptx
Session 4 GCCP.pptx
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
 
Serverless with Firebase - Launchpad Build Burgos
Serverless with Firebase - Launchpad Build Burgos Serverless with Firebase - Launchpad Build Burgos
Serverless with Firebase - Launchpad Build Burgos
 
Azure Functions.pptx
Azure Functions.pptxAzure Functions.pptx
Azure Functions.pptx
 
Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Python
 
Firebase
Firebase Firebase
Firebase
 
Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3
 
Open shift and docker - october,2014
Open shift and docker - october,2014Open shift and docker - october,2014
Open shift and docker - october,2014
 
Cloud Function For Firebase - GITS
Cloud Function For Firebase - GITSCloud Function For Firebase - GITS
Cloud Function For Firebase - GITS
 
Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIs
 
Introduction to PaaS and Heroku
Introduction to PaaS and HerokuIntroduction to PaaS and Heroku
Introduction to PaaS and Heroku
 
Creating Scalable JVM/Java Apps on Heroku
Creating Scalable JVM/Java Apps on HerokuCreating Scalable JVM/Java Apps on Heroku
Creating Scalable JVM/Java Apps on Heroku
 
ServerLess by usama Azure fuctions.pptx
ServerLess by usama Azure fuctions.pptxServerLess by usama Azure fuctions.pptx
ServerLess by usama Azure fuctions.pptx
 

Kürzlich hochgeladen

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Kürzlich hochgeladen (20)

WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 

Firebase Cloud Functions V2

  • 2. whoami - I Am !Groot Aviv Laufer CTO as a Service - https://42-golems.io/ @avivl 42-golems.io
  • 3. A Brief History of Firebase ● 2014 Acquired by Google, Firebase Hosting & Authentication. ● 2016 Analytics, Messaging. ● Firebase, a real-time document database. ● Cloud Firestore scalable NoSQL cloud database. ● Cloud Functions ● Remote Config ● And much more https://firebase.google.com/products-build 42-golems.io
  • 4. “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. Your JavaScript or TypeScript code is stored in Google's cloud and runs in a managed environment. There's no need to manage and scale your own servers.“ Firebase Functions the Shpiel 42-golems.io
  • 5. The Shpiel continues... After you write and deploy a function, Google's servers begin to manage the function immediately. You can fire the function directly with an HTTP request, or, in the case of background functions, Google's servers will listen for events and run the function when it is triggered. ● Cloud Firestore triggers ● Realtime Database triggers ● Remote Config triggers ● Firebase Authentication triggers ● Google Analytics triggers ● Cloud Storage triggers ● Pub/Sub triggers 42-golems.io
  • 6. Welcome to V2 Powered by Cloud Run and Eventarc, Cloud Functions for Firebase (2nd gen) has the potential to give you more powerful infrastructure, advanced control over performance and scalability, and more control of the functions runtime. 42-golems.io
  • 7. Cloud Run ● Fully managed ● Excellent for stateless containers. ● Serverless ● Built on top of Knative. ● Comes in 2 flavorus. Shameless Plug Taking Google Cloud Run for a spin Hacking Google Cloud Run 42-golems.io
  • 8. Eventarc Eventarc lets you build event-driven architectures without having to implement, customize, or maintain the underlying infrastructure. Eventarc offers a standardized solution to manage the flow of state changes, called events, between decoupled microservices. When triggered, Eventarc routes these events through Pub/Sub subscriptions to various destinations (in this document, see Event destinations) while managing delivery, security, authorization, observability, and error-handling for you. 42-golems.io
  • 9. What's new in Cloud Functions for Firebase (2nd gen) ● Function instances can now execute more than one request at a time. ● Secure your callable and HTTP functions with a new `cors` setting. 42-golems.io
  • 10. ● HTTP functions can now have a 1 hour timeout (up from 9 minutes previously). ● Function instances now default to the default compute service account rather than the app engine service account. ● New trigger types include Firebase Alerts, triggers custom event triggers for Firebase Extensions, and task queue functions. . What's new cont... 42-golems.io
  • 11. V2 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 42-golems.io
  • 12. Not supported triggers (for now) ● Cloud Firestore ● Firebase Authentication `onCreate` and `onDelete` ● Google Analytics 42-golems.io
  • 13. From V1 to V2 and beyond 42-golems.io
  • 14. Call functions directly ● Call functions from your app ● Call functions via HTTP requests ● Enqueue functions with Cloud Tasks ● Run functions on schedule 42-golems.io
  • 15. Trigger background functions ● Firebase Alerts triggers ● Custom event/extension triggers ● Blocking Auth triggers ● Pub/Sub triggers ● Realtime Database Triggers ● Remote Config Triggers ● Cloud Storage triggers ● Test Lab Triggers 42-golems.io
  • 16. Custom event triggers/extensions NEW! Firebase Extensions: ● Firebase Extensions help you deploy functionality to your app quickly with pre-packaged solutions. ● Once installed, a Firebase Extension performs a specific task or set of tasks in response to HTTPS requests, Cloud Scheduler events, or to triggering events from other Firebase products, like Cloud Firestore or Firebase Cloud Messaging. ● Available on the extensions Marketplace 42-golems.io
  • 17. Extensions ● Stream Collections to BigQuery ● Resize Images ● Delete User Data ● Trigger Email ● Send Invoices using Stripe ● Send Messages with Twilio ● And many more.... 42-golems.io
  • 18. When you upload a file to your specified Cloud Storage bucket, this extension: Detects if the file is an image. If it is, then: ● Creates a resized image with your specified dimensions. ● Names the resized image using the same name as the original uploaded image, but suffixed with your specified width and height. ● Stores the resized image in the same Storage bucket as the original uploaded image. Resize Images 42-golems.io
  • 20. Authentication blocking triggers Blocking functions let you execute custom code that modifies the result of a user registering or signing in to your app. For example, you can prevent a user from authenticating if they don't meet certain criteria, or update a user's information before returning it to your client app. You can register blocking functions for two events: ● beforeUserCreated: Triggers before a new user is saved to the Firebase Authentication database, and before a token is returned to your client app. ● beforeUserSignedIn: Triggers after a user's credentials are verified, but before Firebase Authentication returns an ID token to your client app. If your app uses multi-factor authentication, the function triggers after the user verifies their second factor. Note that creating a new user also triggers beforeUserSignedIn, in addition to beforeUserCreated. 42-golems.io
  • 23. And the winner is.... ● The test was configured to run up to 20 VUs for 6 minutes ● Using K6 42-golems.io
  • 24. Life behind Firebase - Cloud Functions (2nd gen) ● Longer request processing - Up to 60 mins for HTTP functions. ● Larger instances - Up to 16GB of RAM and 4 vCPUs ● Concurrency - Up to 1000 concurrent requests with a single function. ● Minimum instances - Provide for pre-warmed instances to cut your cold starts and make sure the bootstrap time of your application does not impact application performance. ● Traffic splitting - Support multiple revisions of your functions, splitting traffic between different revisions and rolling your function back to a prior version. ● Event Sources - Native support for Eventarc, which brings over 90+ event sources from direct sources and Cloud Audit logs (e.g., BigQuery, Cloud SQL, Cloud Storage, Firebase...) 42-golems.io