Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 不调用Firebase云函数_Javascript_Firebase_Vue.js_Google Cloud Functions_Firebase Hosting - Fatal编程技术网

Javascript 不调用Firebase云函数

Javascript 不调用Firebase云函数,javascript,firebase,vue.js,google-cloud-functions,firebase-hosting,Javascript,Firebase,Vue.js,Google Cloud Functions,Firebase Hosting,当我访问/s/:id时,我的站点将调用函数s。 然而,它实际上从未被调用。 正如firebase项目概述所确认的,并没有证据表明调用了该函数。 我不知道为什么,因为控制台中没有错误 当访问s/:id时,不会调用函数,但会应用index.html。 我知道index.html是首选的,因为它是公开的,但我不认为这是不调用顶部函数的原因 #functions/index.js const functions = require("firebase-functions"); const express

当我访问/s/:id时,我的站点将调用函数s。 然而,它实际上从未被调用。 正如firebase项目概述所确认的,并没有证据表明调用了该函数。 我不知道为什么,因为控制台中没有错误

当访问s/:id时,不会调用函数,但会应用index.html。 我知道index.html是首选的,因为它是公开的,但我不认为这是不调用顶部函数的原因

#functions/index.js
const functions = require("firebase-functions");
const express = require("express");
const app = express();
const admin = require("firebase-admin");

admin.initializeApp(functions.config().firebase);

const db = admin.firestore();

const genHtml = (image_url, id) => `
<!DOCTYPE html>
<html>
  <head>
    //Meta tag to overwrite
  </head>
  <body>
  <script>
      location.href = '/share/${id}';
  </script>
  </body>
</html>
`;

app.get("s/:id", (req, res) => {

//processing

});
exports.s = functions.https.onRequest(app);

原因是什么?

通过匹配函数和数据库区域正确响应。我不知道这是否是原因,但它起了很大的作用

#functions/index.js
const functions = require("firebase-functions");
const express = require("express");
const app = express();
const admin = require("firebase-admin");

admin.initializeApp(functions.config().firebase);

const db = admin.firestore();

const genHtml = (image_url, id) => `
<!DOCTYPE html>
<html>
  <head>
    //Meta tag to overwrite
  </head>
  <body>
  <script>
      location.href = '/share/${id}';
  </script>
  </body>
</html>
`;

app.get("s/:id", (req, res) => {

//processing

});
exports.s = functions.https.onRequest(app);