Reputation: 343
How can I delete a Firebase Cloud Function which deployed with Deploy Error: undefined
?
1) Create a new Firebase project
2) $ firebase init
and setup functions
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 deploy --only functions
5) The function will fail to deploy as expected.
index.js
and deploying does not delete the function, instead I get functions[thisFnWillFailToDeploy]: Deploy Error: undefined
"status":{"code":13}
)thisFnWillFailToDeploy
also results in Deploy Error: undefined
Upvotes: 3
Views: 2470
Reputation: 21
You can delete it yourself on the google cloud side. Google Cloud Link
Upvotes: 0
Reputation: 317467
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.
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.
Upvotes: 2