Skip to content
FIRERUN.

The BaaS & deploy-platform newsroom for builders

Subscribe

Firebase

Firebase Cloud Functions Gets the Auth Triggers 1st Gen Had

A Sept 15 release lets Cloud Functions for Firebase (2nd gen) fire onUserCreated and onUserDeleted natively, closing a gap open since 2nd gen launched.

Abstract flat-vector editorial illustration for "Firebase Cloud Functions Gets the Auth Triggers 1st Gen Had"

Cloud Functions for Firebase (2nd gen) can now trigger directly off account creation and deletion, closing a gap that has forced developers to keep 1st-gen functions running on the side since 2nd gen launched. Firebase’s Sept. 15 release notes added onUserCreated and onUserDeleted handlers, imported from firebase-functions/v2/identity, that fire when a user account is created or deleted.


What shipped

Per the release notes, the handlers respond to the same events 1st gen’s functions.auth.user().onCreate()/onDelete() always did: Firebase docs list new email/password sign-ups, first-time federated sign-ins, Admin SDK account creation and first-time anonymous sessions as triggers for onUserCreated. Two exceptions carry over from the underlying auth model. A user’s first sign-in with a custom token doesn’t fire onUserCreated, and deleting several users at once through the Admin SDK doesn’t fire onUserDeleted at all.

The new triggers also pick up 2nd gen’s usual configuration surface (region, concurrency, cpu, memory, secrets), plus Identity Platform tenant scoping via tenantId or IS_NOT_TENANT, and CloudEvents-shaped payloads on event.data. Firebase’s docs are explicit that this is a different feature from the blocking functions (beforeCreate/beforeSignIn) 2nd gen already had: those run synchronously inside the auth flow and can reject or modify a sign-in, while onUserCreated/onUserDeleted are asynchronous background triggers that run after the event has already completed.

Why the gap mattered

2nd gen Cloud Functions launched in 2022 without an equivalent to 1st gen’s auth event triggers, and Firebase’s own 1st-gen docs said so plainly. Developers who wanted onCreate/onDelete behavior, such as sending a welcome email, provisioning a Firestore profile document or cleaning up a deleted user’s data, had to keep a 1st-gen function deployed alongside their 2nd-gen codebase just for that one job. A firebase/firebase-functions GitHub issue asking for v2 parity, filed April 26, 2023 and closed with this release, called the missing triggers “really missing” and cross-referenced two earlier requests for the same gap, a sign the request outlived several release cycles before landing.

Key Takeaways

  • Firebase’s Sept. 15, 2026 release notes add onUserCreated/onUserDeleted triggers to Cloud Functions for Firebase (2nd gen), via firebase-functions/v2/identity.
  • The triggers mirror 1st gen’s functions.auth.user().onCreate()/onDelete(), with the same two exceptions: no event on custom-token sign-in, and no event on bulk Admin SDK deletion.
  • They’re distinct from 2nd gen’s existing blocking functions (beforeCreate/beforeSignIn), which run synchronously during sign-in rather than as an after-the-fact background trigger.
  • The feature closes a request open since April 2023, tracked as firebase/firebase-functions issue #1383.

What to do

If you’re still running a 1st-gen function purely to catch account creation or deletion, you can now migrate that logic to onUserCreated/onUserDeleted in your 2nd-gen codebase and retire the 1st-gen deployment. Check both exceptions before you do: if your app supports custom-token sign-in or ever bulk-deletes users through the Admin SDK, keep handling those cases separately, since neither fires the new triggers.

Stay in the loop

Get new articles in your inbox

We'll only email you when a new article drops. Unsubscribe anytime.