# Cloud Functions
- is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests.
- did user log in for the first time, send them a welcome email
- Did user enter a new value, update it into DB via function
- did user update photo, manululate, resize, add filter all on Cloud
- Cloud messaging, send messages to friends
- Each function runs in isolation, in its own environment with its own configuration.
- Auto-scaling default, no need to worry about holiday time
How to make use to async/await syntax in typescript or ECMA acript 2017 to write better, safer coould functions
- wait for promise resolve or promise fail
deployed URL https://us-central1-named-messenger-MY_PROJECT.cloudfunctions.net/helloWorld
firebase login firebase init functions tree functions/ -L 1 functions/ |-- node_modules |-- package.json |-- package-lock.json |-- src |-- tsconfig.json `-- tslint.json
Cloud Functions is a serverless execution environment for building and connecting cloud services.
- Google Cloud Functions
- Firebase Cloud Functions
Serverless Functions are kind of webhooks
|Invokations||2,000,000 /month||125,000 /month|
In addition to the 2 million invocations, the free tier provides 400,000 GB-seconds, 200,000 GHz-seconds of compute time, and 5GB of Internet egress traffic per month.
GCP free tier (one time) and always free services (monthly)
How to deal with secrets in cloud functions?
- Use environment variables
- Use Google Secret Key Manager services
image/jpg image/png text/plain text/html
← AWS Cloud Platforms →