Firebase功能部署失败

Firebase功能部署失败,firebase,flutter,google-cloud-firestore,google-cloud-functions,Firebase,Flutter,Google Cloud Firestore,Google Cloud Functions,我一直在尝试部署名为onFollowUser的firebase函数,但它一直无法启动。我目前有Blaze计划,以下是错误消息: ⚠ functions[onFollowUser(us-central1)]: Deployment error. Failed to configure trigger providers/cloud.firestore/eventTypes/document.create@firestore.googleapis.com (__gcf__.us-central1.

我一直在尝试部署名为
onFollowUser
的firebase函数,但它一直无法启动。我目前有Blaze计划,以下是错误消息:

⚠  functions[onFollowUser(us-central1)]: Deployment error.
Failed to configure trigger providers/cloud.firestore/eventTypes/document.create@firestore.googleapis.com (__gcf__.us-central1.onFollowUser)


Functions deploy had errors with the following functions:
        onFollowUser


To try redeploying those functions, run:
    firebase deploy --only functions:onFollowUser


To continue deploying other features (such as database), run:
    firebase deploy --except functions

Error: Functions did not deploy properly.
这是我完整的
index.js

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();

exports.onFollowUser = 
functions
.firestore
.document('/Followers/{userID}/User Follower/{followerID}')
.onCreate(async (snapshot, context) => {
    console.log(snapshot.data());
});

我已经发现了错误。。。我的数据库位于欧洲中部,但由于某些原因,它正在部署到美国中部。。。我怎样才能改变这个?它说要部署到的项目的ID是正确的

这是我的package.json:

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "eslint .",
    "serve": "firebase emulators:start --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "10"
  },
  "dependencies": {
    "firebase-admin": "^8.10.0",
    "firebase-functions": "^3.6.1"
  },
  "devDependencies": {
    "eslint": "^5.12.0",
    "eslint-plugin-promise": "^4.0.1",
    "firebase-functions-test": "^0.2.0"
  },
  "private": true
}

编辑:即使我收到此失败消息,我仍可以在控制台上看到该功能:
这是一个已知问题,请参阅:

重命名a集合,使其不包含空格,而使用驼峰大小写、破折号或下划线

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
admin.firestore().settings({ timestampsInSnapshots: true });

exports.onFollowUser = 
functions
.firestore
.document('/Followers/{userID}/User-Follower/{followerID}')
.onCreate(async (snapshot, context) => {
    console.log(snapshot.data());
    return;
});

这是一个已知问题,请参阅:

重命名a集合,使其不包含空格,而使用驼峰大小写、破折号或下划线

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
admin.firestore().settings({ timestampsInSnapshots: true });

exports.onFollowUser = 
functions
.firestore
.document('/Followers/{userID}/User-Follower/{followerID}')
.onCreate(async (snapshot, context) => {
    console.log(snapshot.data());
    return;
});


仍然不工作…如果它显示在您的函数列表中,那么它确实在某个阶段部署。尝试触发它并检查日志以查看是否得到更好的错误消息。另一个尝试是将.document('/Followers/{userID}/User Follower/{followerID})更改为.document('Followers/{userID}/User followerID/{followerID})。删除前面的错误消息是什么意思?错误消息并没有说部署失败,它说它无法配置触发器提供程序。这意味着这不是部署问题,而是代码问题。我注意到你的收藏名称中有一个空格,试着避开它吧?更好的解决方案:不要使用空格、驼峰大小写、破折号或下划线,这些都不需要转义。子集合名称中的空格确实是问题所在。仍然不起作用…如果它显示在函数列表中,那么它确实在某个阶段部署了。尝试触发它并检查日志以查看是否得到更好的错误消息。另一个尝试是将.document('/Followers/{userID}/User Follower/{followerID})更改为.document('Followers/{userID}/User followerID/{followerID})。删除前面的错误消息是什么意思?错误消息并没有说部署失败,它说它无法配置触发器提供程序。这意味着这不是部署问题,而是代码问题。我注意到你的收藏名称中有一个空格,试着避开它吧?更好的解决方案:不要使用空格、驼峰大小写、破折号或下划线,这是不需要转义的。子集合名称中的空格确实是问题所在。你能共享你的
包.json
文件吗?“我的数据库位于欧洲中心,但出于某种原因,它正在部署到美国中心…”在一个位置有Firestore DB,在另一个位置有云函数应该没有问题。请参阅以下链接以更改区域:请参阅感谢@RenaudTarnec和Mike,它现在正在部署这可能是一个有趣的答案。。。我的部署是正确的,但后来,我开始有同样的问题。在花了4个小时试图修复它之后。。。我发现我的账单账户被暂停了,因为我最后一次0.01美元的付款失败了。我刚刚添加了一种新的支付方式,我的部署又开始工作了。你能分享你的
包.json
文件吗?“我的数据库位于欧洲中心,但是,出于某种原因,它正在部署到美国中心…”在一个位置有Firestore DB,在另一个位置有云功能应该没有问题。请参阅以下链接以更改区域:请参阅感谢@RenaudTarnec和Mike,它现在正在部署这可能是一个有趣的答案。。。我的部署是正确的,但后来,我开始有同样的问题。在花了4个小时试图修复它之后。。。我发现我的账单账户被暂停了,因为我最后一次0.01美元的付款失败了。我刚刚添加了一种新的付款方式,我的部署又开始工作了。