【问题标题】:When i run firebase funtion in browser i am getting 403 error当我在浏览器中运行 firebase 功能时,出现 403 错误
【发布时间】:2019-07-04 07:20:47
【问题描述】:

当我从 url 运行 firebase 函数时,我收到此错误:Your client does not have permission to get URL /testing from this server.,谁能帮助我为什么会收到此错误?在这里我添加了我的代码

这是我的代码

const express = require('express');
const app = express();
const cors = require('cors');
app.use(cors({ origin: true }));

app.get('/testing', (req, res) => {
  res.send({ 'status': 0});
});
exports.widgets = functions.https.onRequest(app);

【问题讨论】:

    标签: node.js firebase express google-cloud-functions


    【解决方案1】:

    当您导出 HTTP 类型的函数时,函数的名称将成为 URL 的一部分。您可能希望使用路径 /widgets/testing 来调用您的快速路由,因为“widgets”是函数的名称。

    【讨论】:

    • 我已经这样做了,现在我收到了这个错误:Cannot GET /testingtest
    猜你喜欢
    • 1970-01-01
    • 2017-11-04
    • 2021-11-13
    • 1970-01-01
    • 2023-04-02
    • 1970-01-01
    • 2022-01-26
    • 2012-10-31
    • 1970-01-01
    相关资源
    最近更新 更多