firebase functionsのデフォルトのリージョンはus-central1
になっている。
firebase functionsのリージョンをasia-northeast1
に変更し、Vueから呼び出すサンプルを記載する。
firebaseサンプル(一部抜粋)
- functionsに
region('asia-northeast1')
を追加する
functions/index.js
const functions = require('firebase-functions');
exports.helloWorld= functions.region('asia-northeast1').https.onRequest((request, response) => {
return response.send('HelloWorld')
});
Vueサンプル(一部抜粋)
- functionsのリージョンを変更してもVue側は
us-central1
を見に行ってしまうので、明示的に伝える必要がある -
firebase.app().functions('asia-northeast1')
のようにfunctions()
にリージョン名を渡すことで呼び出し先を変更できる
:HelloWorld.vue
firebase.app().functions('asia-northeast1').httpsCallable('getMatches')