Firebase Authentication triggers not working!!

1,617 views
Skip to first unread message

김종석

unread,
Nov 25, 2019, 11:18:10 PM11/25/19
to Firebase Google Group
Hi, All

I am using Firebase for Authentication and use Cloud Function "functions.auth().onDelete" to inform me when a user has sign out. 

It worked well for a year, but suddenly not working from October 22.

The functions.auth.user().onDelete () trigger does not work when deleting a user use SDK.

But, it works if delete user from the "Authentication" menu in the firebase console.

It looks like a stealth patch under the water.

Doug Stevenson

unread,
Nov 26, 2019, 3:47:49 PM11/26/19
to Firebase Google Group
How long ago did you last deploy this function?  There was a bug from a long time ago where functions that didn't get invoked for a month would stop being invoked entirely.  That bug was fixed.  All you have to do to resolve the issue is redeploy the function.

Doug

Guanaco Devs

unread,
Nov 26, 2019, 9:18:45 PM11/26/19
to Firebase Google Group
I do have a similar issue.
I have a few functions that will clean up my databases when a user deletes its account or "uninstall/clear application data", `admin.auth().deleteUser(uId)` in node, will delete the user account but instead of triggering `user.delete` in python, triggers `.auth.user().onCreate((user, context)` in node. This behavior leaves me with orphaned data that I have to cleanup running a local script on a monthly basis.
Just as the OP describes, if I delete the user from the firebase console, my functions work as I expect. Have not redeployed as Doug suggest yet, just realized that behavior by chance.

Guanaco Devs

unread,
Nov 26, 2019, 10:45:15 PM11/26/19
to Firebase Google Group
I have just redeployed all my python functions and all my node functions with upgraded libraries and the issue persists.

When a function from node is triggered, that deletes a user with `admin.auth().deleteUser(uId);`, it will delete the user from the firebase project but instead of triggering `functions.auth.user().onDelete((user, context)` it triggers `functions.auth.user().onCreate((user, context)`.

However as mentioned before by the OP and me, when deleting the user straight from Firebase Console, the triggers work as expected.


On Monday, November 25, 2019 at 10:18:10 PM UTC-6, 김종석 wrote:

Doug Stevenson

unread,
Nov 27, 2019, 2:35:37 AM11/27/19
to fireba...@googlegroups.com
Are you saying that if you programmatically delete a user using the Admin SDK, that you always get a call to an onCreate function as an immediate result?  That's not an expected behavior.

--
You received this message because you are subscribed to a topic in the Google Groups "Firebase Google Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebase-talk/ROXTbooVzlM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/1201054f-4698-4872-bd4e-968799df5202%40googlegroups.com.

Guanaco Devs

unread,
Nov 27, 2019, 11:06:08 AM11/27/19
to Firebase Google Group
Yes, Tha'ts exactly what is happening

Emmanuel Vlad

unread,
Nov 27, 2019, 11:06:08 AM11/27/19
to Firebase Google Group
I have exactly the same issue, `functions.auth.user().onDelete()` does not trigger, it'll instead trigger `functions.auth.user().onCreate()`.

I have only two functions:

exports.userIsDeleted = functions.auth.user().onDelete(user => {
 return admin.firestore().collection("users").doc(user.uid).delete();
});

exports.userIsCreated = functions.auth.user().onCreate(user => {
 return admin.firestore().collection("users").doc(user.uid).create({ display_name: "not set" });
});

김종석

unread,
Nov 27, 2019, 11:06:08 AM11/27/19
to Firebase Google Group
Last deployed on November 14th.
When I first discovered the issue, I redeployed it but it didn't work.
I don't think it's the same issue as the bug you said.
I have two environmens and have many times redeployed but both same.

Thanks for your reply. 

2019년 11월 27일 수요일 오전 5시 47분 49초 UTC+9, Doug Stevenson 님의 말:

Doug Stevenson

unread,
Nov 27, 2019, 11:53:55 AM11/27/19
to fireba...@googlegroups.com
If the behavior you're seeing is obviously wrong and also reproducible, please file a bug report with Firebase support.

Also consider filing on GitHub.

Thanks for bringing this up.

Doug


--
You received this message because you are subscribed to a topic in the Google Groups "Firebase Google Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebase-talk/ROXTbooVzlM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to firebase-tal...@googlegroups.com.

Sam Stern

unread,
Dec 2, 2019, 11:43:14 AM12/2/19
to Firebase Google Group
Hey everyone,

Thank you all for reporting this.  The issue was a bug in the Firebase Authentication backend which triggers the Cloud Functions.  A fix was rolled out last week and this should be fixed with no action needed on your end, if you are still seeing this issue or something similar please let us know ASAP.

- Sam 

You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/CAPWUpa1xFmxK15O3nMFyZ_JLNsySKVDx5ziJKwgny%2B5W1MQaYQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages