firebase-tools: Emulator: auth functions not triggered

It seems that the firebase functions based on auth events (in my case functions.auth.user().onCreate) are not triggered within the emulator suite. In Emulator UI i’m able to see that my auth function is initialized correctly but nothing happens when a user is created (from client side with auth.createUserWithEmailAndPassword() method) image

I set the required env variables (FIREBASE_AUTH_EMULATOR_HOST and GCLOUD_PROJEC) when launching the emulator

My dependencies are up to date : firebase-tools 8.16.2 firebase-admin: 9.4.1 firebase-functions: 3.11.0

Note : regular firebase functions are triggered properly in the emulator.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (10 by maintainers)

Most upvoted comments

I am having the same issue.

Other Functions are working “https.onCall” Debugger jumps to breakpoints etc, but auth.user().onCreate is not firing, don’t know if the emulator suite emulates this behaviour but auth.user().onCreate also does not fire when creating a user from the emulator dashboard.

Hi, An update from my side, after updating firebase-tools the onCreate function is firing again.

Also one thing to note is that firebase-ui is not compatible with the auth emulator the firebase-ui team is still working on getting it to work. When using Firebase-ui it will send all comms to the configured project directly.

NB: So when you use firebase-ui all auth requests will bypass the emulator (even if useEmulator() is called) and thus the local onCreate functions will not get called.

see here: https://github.com/firebase/firebaseui-web/issues/778#issuecomment-721535405

I have changed region and no effect. I too have been using firebaseUI.

However I am adding users from the emulator frontend now, would this not trigger the function? (The docs state that creating a user from the Firebase console will trigger the function, not sure if this behaviour is emulated.)

@jonadeline @johanbuys would you please do me a favor and try firebase emulators:start --project foobar instead, where foobar matches the project ID used on the client? This forces the firebase command to use a certain project ID. And please remove the environment variables – those don’t do much.