firebase - 谷歌预定函数 : There was an error deploying functions?

标签 firebase google-cloud-functions

我有一个新项目,但希望测试预定的功能。我错过了什么吗?

$ firebase deploy

=== Deploying to 'testing-db'...

i  deploying functions
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
!  functions: missing required API cloudbuild.googleapis.com. Enabling now...
+  functions: required API cloudfunctions.googleapis.com is enabled
+  functions: required API cloudbuild.googleapis.com is enabled
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (24.45 KB) for uploading
i  functions: ensuring required API pubsub.googleapis.com is enabled...
i  functions: ensuring required API cloudscheduler.googleapis.com is enabled...
!  functions: missing required API cloudscheduler.googleapis.com. Enabling now...
+  functions: required API pubsub.googleapis.com is enabled
+  functions: required API cloudscheduler.googleapis.com is enabled
+  functions: functions folder uploaded successfully
i  functions: creating Node.js 14 function scheduledFunction(us-central1)...

Functions deploy had errors with the following functions:
        scheduledFunction(us-central1)
i  functions: cleaning up build files...

Error: There was an error deploying functions
Index.js
const functions = require('firebase-functions');

exports.scheduledFunction = functions.pubsub
  .schedule('every 1 minutes')
  .onRun((context) => {
    
    return console.log('This will be run every 1 minutes!');
  });
Firebase 日志显示:
Error: Failed to upsert schedule function scheduledFunction in region europe-west1

最佳答案

当您在 Firebase Functions 中使用计划函数时,会创建 Cloud Scheduler 工作所需的 App Engine 实例。你可以阅读它here .它们使用默认设置的资源位置。我认为您收到该错误是因为您指定的默认 GCP 资源位置与您计划的云功能区域之间存在差异。如果您点击 Firebase 中项目概览旁边的齿轮,您可以看到您的资源所在的位置。
检查您的 Cloud Scheduler 功能详细信息并查看它已部署到哪个区域。默认情况下,函数在 us-central1 区域中运行。检查这个 link看看我们如何改变函数的区域。

关于firebase - 谷歌预定函数 : There was an error deploying functions?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69945493/

相关文章:

node.js - 是否可以在本地测试 Firebase 触发器?

javascript - 在 Firebase 控制台中记录 JSON 对象

node.js - 声明自定义异常以与 Firestore 可调用函数和 VueJS 一起使用

javascript - 是否可以在谷歌云功能中放置一个计时器?

angularjs - 如何使用 AngularFire 在 Firebase 中使用路由和用户身份验证?

ios - 打开应用程序时表格 View 未刷新

firebase - 将数据添加到 map 字段(Flutter Firestore)

node.js - 如何在谷歌云中自动化 NodeJS 脚本

javascript - Firebase 函数 - 如何验证从 CDN 缓存加载静态内容?

typescript - 如何检查Google Play订阅在客户端或服务器端是否处于事件状态