I was using this piece and it stopped working in one night:
I wrote the code above in different variations, nothing helped. Writing it here so that I won’t forget. Eventually the solution was very easy, I had an inactive firebase function listening to firebase realtime database writes and I just deleted that function. This thing got resolved.
The inspo is from this old post:
Hope saves someones less hours than me.