Delete a Firebase Cloud Function which failed with `Deploy Error: undefined`
Delete a Firebase Cloud Function which failed with `Deploy Error: undefined`
如何删除使用 Deploy Error: undefined
部署的 Firebase Cloud Function?
重现我的问题的步骤:
1) 创建一个新的 Firebase 项目
2) $ firebase init
和设置函数
3) 将以下代码粘贴到 functions/index.js
"use strict";
const functions = require('firebase-functions');
function aFunction() {
return 'reports/posts';
}
function getCorruptTrigger() {
return '/reports/posts/' + aFunction +'/createdAt'
}
exports.thisFnWillFailToDeploy = functions
.database
.ref(getCorruptTrigger())
.onWrite(event => {});
4) firebase deploy --only functions
5) 函数将无法按预期部署。
我试图删除云函数:
- 从
index.js
中删除函数并部署不会删除函数,而是我得到 functions[thisFnWillFailToDeploy]: Deploy Error: undefined
- 在 Google Cloud Console 中删除 Cloud Function 不会删除该函数。 (我祝酒说该功能将被删除,但事实并非如此。在日志中有
"status":{"code":13}
的错误)
- 创建名为
thisFnWillFailToDeploy
的空云函数也会导致 Deploy Error: undefined
您项目中的该函数处于错误状态。显然,部署一个带有格式错误的 ref 的函数会导致该函数出现无法自行逆转的问题。该功能从一开始就无法部署(甚至没有机会删除它)。之后,您将无法再更新或删除该函数。如果需要,您必须联系支持人员才能恢复该功能。您应该仍然能够更新或删除该项目中的其他函数。
我猜这是因为您在生成引用名称的函数调用中有错字。您在调用 aFunction 时缺少括号。我想你的意思是让它看起来像这样:
function getCorruptTrigger() {
return '/reports/posts/' + aFunction() +'/createdAt'
}
如果您改为在新项目中部署它,它应该可以工作。
如何删除使用 Deploy Error: undefined
部署的 Firebase Cloud Function?
重现我的问题的步骤:
1) 创建一个新的 Firebase 项目
2) $ firebase init
和设置函数
3) 将以下代码粘贴到 functions/index.js
"use strict";
const functions = require('firebase-functions');
function aFunction() {
return 'reports/posts';
}
function getCorruptTrigger() {
return '/reports/posts/' + aFunction +'/createdAt'
}
exports.thisFnWillFailToDeploy = functions
.database
.ref(getCorruptTrigger())
.onWrite(event => {});
4) firebase deploy --only functions
5) 函数将无法按预期部署。
我试图删除云函数:
- 从
index.js
中删除函数并部署不会删除函数,而是我得到functions[thisFnWillFailToDeploy]: Deploy Error: undefined
- 在 Google Cloud Console 中删除 Cloud Function 不会删除该函数。 (我祝酒说该功能将被删除,但事实并非如此。在日志中有
"status":{"code":13}
的错误) - 创建名为
thisFnWillFailToDeploy
的空云函数也会导致Deploy Error: undefined
您项目中的该函数处于错误状态。显然,部署一个带有格式错误的 ref 的函数会导致该函数出现无法自行逆转的问题。该功能从一开始就无法部署(甚至没有机会删除它)。之后,您将无法再更新或删除该函数。如果需要,您必须联系支持人员才能恢复该功能。您应该仍然能够更新或删除该项目中的其他函数。
我猜这是因为您在生成引用名称的函数调用中有错字。您在调用 aFunction 时缺少括号。我想你的意思是让它看起来像这样:
function getCorruptTrigger() {
return '/reports/posts/' + aFunction() +'/createdAt'
}
如果您改为在新项目中部署它,它应该可以工作。