node.js - 当我在浏览器中运行 firebase 功能时,出现 403 错误
问题描述
当我从 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);
解决方案
当您导出 HTTP 类型函数时,函数的名称将成为 URL 的一部分。您可能希望使用路径/widgets/testing
来调用您的快速路由,因为“小部件”是函数的名称。
推荐阅读
- python - Sqlite在Python中查询整数值字段不起作用
- java - JSON 响应值表示 Null 放心
- python - 以字典的形式存储文件中的数据(可能是+熊猫)
- c# - 如何访问元组的索引值?
- spring-boot - Spring Controller 返回 blob 性能不佳
- sql - 获取第一个可用的日期(最大日期)加入基于日期排列的 ASC 表
- java - 如何修复我的数组,以免出现 IndexOutOfBoundsException?
- python - 剩余项目的所有可能组合
- reactjs - 如何更改类型或 React 组件?
- css - 是否可以从子元素访问父元素的 CSS 计数器值?