删除因“部署错误:未定义"而失败的Firebase Cloud Function. [英] Delete a Firebase Cloud Function which failed with `Deploy Error: undefined`

查看:37
本文介绍了删除因“部署错误:未定义"而失败的Firebase Cloud Function.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何删除通过 Deploy Error:undefined 部署的 Firebase Cloud Function ?


How can I delete a Firebase Cloud Function which deployed with Deploy Error: undefined?


1)创建一个新的 Firebase 项目

1) Create a new Firebase project

2) $ firebase init 和设置功能

3)将以下代码粘贴到 functions/index.js

3) Paste the following code into 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部署-仅功能

5)该功能将无法按预期部署.

5) The function will fail to deploy as expected.


  • index.js 中删除该功能并进行部署不会删除该功能,而是得到 functions [thisFnWillFailToDeploy]:部署错误:未定义
  • Google云控制台中删除云功能不会删除该功能.(我吐司说该功能将被删除,但事实并非如此.在日志中,"status":{"code":13} 出现错误)
  • 使用名称 thisFnWillFailToDeploy 创建空的云函数也会导致 Deploy Error:undefined
  • Removing the function from the index.js and deploying does not delete the function, instead I get functions[thisFnWillFailToDeploy]: Deploy Error: undefined
  • Deleting the Cloud Function in the Google Cloud Console does not delete the function. (I get a toast saying that the function will be deleted, but this is not the case. In the logs there is an Error with "status":{"code":13})
  • Creating an empty cloud function with the name thisFnWillFailToDeploy also results in Deploy Error: undefined

推荐答案

您项目中的该函数处于错误状态.显然,部署具有格式错误的ref的功能会导致该功能出现问题,您无法自行撤消.该功能从一开始就无法部署(甚至没有机会删除它).之后,您将无法再更新或删除该功能.如果需要的话,您必须与支持人员联系以恢复该功能.您仍然应该能够更新或删除该项目中的其他功能.

That function in your project is in a bad state. Apparently, deploying a function with a malformed ref causes problems with that function that can't be reversed on your own. That function will failed to deploy from the outset (not even having a chance to delete it yet). After that, you can no longer update or delete the function. You'll have to contact support to recover the function, if that's what you need. You should still be able to update or delete other functions in that project.

我猜是因为您的函数调用中有一个错字,该错字生成了引用的名称.您在对aFunction的调用中缺少parens.我想您是要让它看起来像这样:

I'm guessing it's because you have a typo in your function call that generated the name of the ref. You're missing parens on the call to aFunction. I imagine you meant for it to look like this:

function getCorruptTrigger() {
    return '/reports/posts/' + aFunction() +'/createdAt'
}

如果您将其部署在新项目中,则应该可以使用.

If you deploy that in a new project instead, it should work.

这篇关于删除因“部署错误:未定义"而失败的Firebase Cloud Function.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆