Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test Firebase Auth Blocking functions V2 locally on the emulator?

On the Firebase Console there is an option in settings that allows you to choose which function to trigger (screenshot belows) for the 2 events beforeUserCreated & beforeUserSignedIn. Looking at David's video on this topic I see that I need to export them in my functions index file and then after deployment they show up in the dropdown in settings and thats where you select which function to trigger for each event.

In the Emulator there is no such setting, so how do I tell the Auth Emulator to trigger beforeUserCreated & beforeUserSignedIn for the users?

Thanks!

enter image description here Code

Firebase Settings

like image 949
Frontend Backend Bookend Avatar asked Dec 05 '25 13:12

Frontend Backend Bookend


1 Answers

For those who end up here upon searching:

You do not need to export the blocking function as constant, it works without it (I wonder why they make you select in production though).

Also a note: If you use V1 blocking functions and then switch to V2 then you need to restart the emulator else it throws all kinds of errors which are confusing and hard to figure out.

Below is what I ended up doing:

enter image description here

like image 84
Frontend Backend Bookend Avatar answered Dec 08 '25 07:12

Frontend Backend Bookend



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!