【问题标题】:Same Firebase HTTPS request function works or doesn't depending on the environment相同的 Firebase HTTPS 请求功能是否有效取决于环境
【发布时间】:2021-03-29 13:06:32
【问题描述】:

在工作中,每个开发人员都有自己的 Firebase 测试环境。我被要求将一些数据导入 Firestore 到现在正在休假的同事的环境中,因为我们使用的 API 基本上是一个 HTTPS 请求触发函数。

我现在正在尝试使用 Postman,出于某种原因,我在环境中发出的 POST 请求工作得非常好,我得到了预期的响应:

{
    "statusCode": "200",
    "message": "Operation successful"
}

由于具有相同标头和正文的相同请求在他的环境中不起作用,我收到了这个我以前从未见过的错误:

<html>

<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <title>403 Forbidden</title>
</head>

<body text=#000000 bgcolor=#ffffff>
    <h1>Error: Forbidden</h1>
    <h2>Your client does not have permission to get URL <code>/importAPI/import/event</code> from this server.</h2>
    <h2></h2>
</body>

</html>

最近在两个环境中部署了完全相同的功能,所以我真的不知道是什么原因造成的。这是否与我的同事在他的环境中的某些设置有关?

提前感谢您的帮助,如果您需要更多信息,请告诉我。

【问题讨论】:

    标签: firebase google-cloud-firestore google-cloud-functions


    【解决方案1】:

    我终于在这里找到了解决方案:

    https://stackoverflow.com/a/62944789/14378609

    由于某种原因,该函数缺少“Cloud Functions Invoker”角色。我进入GCP Console添加了,问题立马解决了:

    【讨论】:

      猜你喜欢
      • 2016-09-09
      • 2014-04-13
      • 1970-01-01
      • 2019-06-01
      • 2020-07-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多