'Function forgets the trigger? (Google Cloud)

I created a Google Cloud Function which works like a charm in the Cloud Console. But it wasn't triggered when it should be.

It is a RealTimeDatabase (RTDB) triggered Cloud Function. Then I opened the function again to look for the error, and I saw the path I specified wasn't saved. So I tried again, but it failed again.


This is what I'm doing:

enter image description here

As you see, I have entered the Database name and the Path that is supposed to be the trigger. What I've entered, matches what is shown as an example when I hover over the question mark with my mouse.

Then I click Save

enter image description here

Then I click Next and then Deploy. Then it takes a few minutes for the function to deploy.

After it was deployed, I open the function again and I see this:

enter image description here


It always completely "forgets" the database I've entered, and it always only saves a part of the path I've specified. I guess this is why the function isn't getting triggered.

But why doesn't the function save what I put in there?


So I tried deploying it with gcloud CLI as suggested by Kolban, but I get this error:

ERROR: (gcloud.functions.deploy) OperationError: code=5, message=Failed to configure trigger for event-type:providers/google.firebase.database/eventTypes/ref.create resource:projects/_/instances/xxx-default-rtdb.firebaseio.com/refs/user/lukas service:firebaseio.com.

The code I ran:

gcloud functions deploy myfunction --entry-point helloRTDB --trigger-event providers/google.firebase.database/eventTypes/ref.create --trigger-resource projects/_/instances/xxx-default-rtdb.firebaseio.com/refs/user/lukas --runtime nodejs16

EDIT: Okay, so I got it working with gcloud CLI, but the same happened. It's not triggered and when I open the function in the console, it also forgot the database and partly the path

I don't understand what is wrong.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source