相关疑难解决方法(0)

为 Cloud Functions 指定区域时出现异常“firebase.functions() requires ... no argument ...”

我正在关注 Firebase文档,以便从网页调用位于与us-central1.

更准确地说,在网页中,我做了var functions = firebase.functions('europe-west1');但我收到以下错误并且没有从调用中得到结果:

uncaught exception: functions: Firebase: firebase.functions() takes either no argument or a Firebase App instance. (app/invalid-app-argument).
Run Code Online (Sandbox Code Playgroud)

这是MCV代码:

云功能

const functions = require('firebase-functions');

exports.getName = functions
  .region('europe-west1')
  .https.onCall((data, context) => {
    return { name: 'MyName' };
  });
Run Code Online (Sandbox Code Playgroud)

网页

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script src="https://www.gstatic.com/firebasejs/5.3.1/firebase-app.js"></script>
    <script src="https://www.gstatic.com/firebasejs/5.3.1/firebase-functions.js"></script>

</head>

<body>
    <script>
        // Initialize Firebase
        var config = {
            apiKey: "xxxxxxxxxx",
            authDomain: "xxxxxxxxxx",
            databaseURL: "xxxxxxxxxx",
            projectId: "xxxxxxxxxx",
            storageBucket: "xxxxxxxxxx", …
Run Code Online (Sandbox Code Playgroud)

firebase google-cloud-functions

8
推荐指数
1
解决办法
1417
查看次数

标签 统计

firebase ×1

google-cloud-functions ×1