Google Cloud Functions
#FaaS #Serverless
Cloud Functions - Event-driven Serverless Computing  |  Cloud Functions  |  Google Cloud
コードを書いて、デプロイして、対象のイベントが起きて関数が実行される。
コード、対象となるランタイムは、node, python, goなど
対象のイベントは、
http, background(pubsub, storage, firebase event)など
cloud functions background
ローカルでの開発
開発したあとに、以下にdeployするか?
Cloud Functions Deploy
開発環境
Functions Framework  |  Google Cloud Functions に関するドキュメント
で、ローカル開発サーバーを起動できる
hot reload?
node-js,
hot reload · Issue #24 · GoogleCloudPlatform/functions-framework-nodejs · GitHub
pacakge.jsonに書けばよい? nodemonを使う?
pythonは、--debugでよい
firebaseの場合は、
firebaseの場合は、firebase shelllで、もっと楽にできる。firebaseでなくても動く?
javascript - How to use Google sheets API while inside a google cloud function - Stack Overflow
GCP Cloud Functions Debuging
tips:
Cloud Functions Local emulator
fileの利用
/tmp が使える tmpfs. 実行が終われば、(たぶん)消える。実行ごとにcontainerが生成・消滅するので。
Write temporary files from Google Cloud Function - Stack Overflow
読み込みについては、deploy時に、そのディレクトリにあるファイルが含まれるので、それを使う。
環境変数
.env
.env.yamlを書けばよい。
Puppeteer + GCP Functionsでサーバレスなスクレイピング - Qiita
cache, pooling 戦略?
tips#use_global_variables_to_reuse_objects_in_future_invocations
It is particularly important to cache network connections, library references, and API client objects in global scope. See Optimizing Networking for examples.
Optimizing Networking  |  Cloud Functions Documentation  |  Google Cloud
sessionや api clientなど
#gcp #Node.js