1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Vue + firebase functionsでfunctionsのリージョンを変更する方法

Last updated at Posted at 2020-11-07

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')
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?