これは何?
PythonのFirebase Functionsはbetaということもあり、Regionを指定する方法が2023年5月25日時点では公式ドキュメントに記載されていない。Pythonのfirebase_functionsのソースコードを見て調べる必要があった。
方法
以下のようにして指定できることが分かった。
options.set_global_options(region=options.SupportedRegion.ASIA_NORTHEAST1)
以下のようなpythonファイルを作ってデプロイすれば良い:
from firebase_admin import initialize_app
from firebase_functions import https_fn, options, storage_fn
initialize_app()
options.set_global_options(region=options.SupportedRegion.ASIA_NORTHEAST1)
@https_fn.on_request()
def on_request_example(_: https_fn.Request) -> https_fn.Response:
return https_fn.Response("Hello world!")
Discussion