Skip to content

Auth onCreate and onDelete triggers for v2 functions #1383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
laurentpayot opened this issue Apr 26, 2023 · 65 comments
Open

Auth onCreate and onDelete triggers for v2 functions #1383

laurentpayot opened this issue Apr 26, 2023 · 65 comments

Comments

@laurentpayot
Copy link

Please add Authentication onCreate and onDelete triggers for v2 functions in the SDK, this is really missing. 🙏

Related issues

#1213
#1381

Version info

firebase-functions:
v4.3.1

firebase-tools:
11.29.0

@google-oss-bot
Copy link
Collaborator

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@jhuleatt
Copy link
Contributor

Hey @laurentpayot, thanks for requesting! This is currently a limitation of all 2nd gen functions (Node or Python). A workaround for now is to use 1st gen functions for Auth onCreate and onDelete triggers. Note that 1st gen and 2nd gen functions can coexist side-by-side in the same file.

@laurentpayot
Copy link
Author

Thanks for your answer @jhuleatt. I did not know a mix of 1st and 2nd gen functions was possible. I will use this "workaround" for now. I’m still eagerly awaiting v2 auth triggers 😉

@laurentpellegrino
Copy link
Contributor

Any updates on this?

@jjgriff93
Copy link

Seems to be the only ones missing now, do we have an ETA on when these will make it into v2?

@jacobg
Copy link

jacobg commented Nov 16, 2023

+1

7 similar comments
@dhutaryan
Copy link

+1

@emilioiz
Copy link

+1

@quirkles
Copy link

quirkles commented Dec 5, 2023

+1

@amacapas
Copy link

+1

@mvergarair
Copy link

+1

@Martinnord
Copy link

+1

@kafkas
Copy link

kafkas commented Jan 10, 2024

+1

@sebastianrueckerai
Copy link

When can we expect this?`

@sveinlo
Copy link

sveinlo commented Jan 19, 2024

+1

@cuong0993
Copy link

I believe we can use a HTTP v2 function for blocking "Before the user is created" https://firebase.google.com/docs/auth/extend-with-blocking-functions?gen=2nd.
It is a workaround for onCreate callback.

@muraterzioglu
Copy link

+1

@solarpush
Copy link

solarpush commented Mar 17, 2024

@cuong0993 > I believe we can use a HTTP v2 function for blocking "Before the user is created" https://firebase.google.com/docs/auth/extend-with-blocking-functions?gen=2nd. It is a workaround for onCreate callback.

Yes, I try it but this trigger not working in emulators ... (or i don't find how to) and i believe acces right is limited (for interact with firestore or other)

I any one know a solution for use blocking functions in emulators

@vazome
Copy link

vazome commented Jul 6, 2024

+1 for Python support

@newcaiosantos
Copy link

+1

2 similar comments
@yousefh409
Copy link

+1

@hytka81
Copy link

hytka81 commented Sep 17, 2024

+1

@Seanitzel
Copy link

Seanitzel commented Sep 19, 2024

Will this be implemented at some point?
The docs say the following -

Note: Cloud Functions for Firebase (2nd gen) does not provide support for the events and triggers described in this guide. Because 1st gen and 2nd gen functions can coexist side-by-side in the same source file, you can still develop and deploy this functionality together with 2nd gen functions.

But they still urge us to upgrade all our functions to v2...

@jay8t6
Copy link

jay8t6 commented Sep 27, 2024

Yes, please add this. I updated my firebase functions to the latest, now I get firebase.runWith is not a function error. How can you say it co-exists when it cant after you upgrade to the latest version of firebase-functions?

+1

@haybreaker
Copy link

+1

@enchorb
Copy link

enchorb commented Oct 9, 2024

+1, classic half-baked major upgrades by Firebase

@rublev
Copy link

rublev commented Oct 22, 2024

+1

@vazome
Copy link

vazome commented Dec 16, 2024

To all potential viewers:

If you haven’t contacted Firebase to raise your concern yet, please take a moment to do so. It would be helpful if you could specify whether (and how severely) the lack of Firebase Auth onCreate and onDelete triggers in V2 impact your business processes or development: Contact Support

Also, please cast a vote at UserVoices:

  1. Auth onCreate and onDelete triggers for v2 functions
  2. Auth onUpdate trigger for v1 and v2 functions

@evdama
Copy link

evdama commented Dec 16, 2024

@colerogers do you have any updates on this issue?

@htuli-tuw
Copy link

When will this get resolved ? Our whole codebase is on v2 just for this one trigger, we need to use v1.

@nmbgeek
Copy link

nmbgeek commented Dec 29, 2024

+1

@atsjo
Copy link

atsjo commented Dec 31, 2024

now I was able to deploy gen1 functions with nodejs22 again:-) Not mentioned in the docs, but at least it makes it easier to use the gen1 auth triggers in a gen2 codebase...

@w3rafu
Copy link

w3rafu commented Jan 8, 2025

:(

@evdama
Copy link

evdama commented Jan 23, 2025

There's one good news since yesterday... it seems v1 functions will now work on node runtime 22 as well (v1 was limited to node v20 before) i.e. when you have v1 and v2 functions, as most of us do it seems (see above), the deployment becomes easy again... I've all on node 22 now, v1 and v2 functions. The docs still say v1 functions can only run up to node v20 but that's not true anymore.

@atsjo can you confirm?

Update: gosh, just realized you posted this 'news' 3 weeks ago already... I discovered it just yesterday by accident, not switching my local env back to node 20 for gen1 functions and it f***** worked which at first confused me a lot 🤣

@shaffy9633
Copy link

bruh yall have to fix this. this is embarrassing

@guhndr
Copy link

guhndr commented Feb 7, 2025

+1

@sconix
Copy link

sconix commented Feb 11, 2025

This starts to be a theme, the parameter support is half done, the support for auth triggers is half done the support for custom service account is half done, pretty much everything is only half finished regarding cloud run functions and at the same time Google is moving forward deprecating things and asking everyone to upgrade, well would love to, but can only do it for half of the functions due to these unfinished features. Would be nice to at least know when we can expect full v2 functions support. Yes one can run v1 and v2 at the same time, but who really wants to maintain two different code bases.

@maciejgoscinski-latrace
Copy link

Any official statement from Google, before they deprecate us all to nonexistence?

@rublev
Copy link

rublev commented Mar 18, 2025

Any official statement from Google, before they deprecate us all to nonexistence?

me being deprecated like

@mqln
Copy link

mqln commented Mar 20, 2025

Hey guys, friendly reminder that everyone is sad at you.

@gbourne1
Copy link

+1

@readyiman
Copy link

Oh, it's apparently not yet available. That's why AI answer keep looping.

This is currently a limitation of all 2nd gen functions (Node or Python). A workaround for now is to use 1st gen functions for Auth onCreate and onDelete triggers. Note that 1st gen and 2nd gen functions can coexist side-by-side in the same file.

I wonder using v1 as workaround can still be used 2 years after..
Especially after everyone asked to do migration.

@solarpush
Copy link

solarpush commented Apr 19, 2025

For byPass limitation you need to use dedicated oncall or onrequest fn for create , update , delete a user with server auth package and use your logic at this time.

The front auth package can only be used for signin or signout.

You can too use the signinwithcustomtoken fn in front if you want signin from server.

@xrlife
Copy link

xrlife commented May 6, 2025

Pretty crazy that this is still an issue. I have not seen any replies to any of these posts for so long. Does anyone even work on this stuff? Trying to build something here and we can't really run this stuff anymore. Just stop, why force us to upgrade when you can't even force yourself to maintain your libraries. Only the posters here will get this info because no one at Google could give a crap about our projects and our success. It is garbage and if you worked for any of us we would fire you for incompetence and lack of communication at a minimum. Someone is updated the messages telling us we need to upgrade our node, why not upgrade your stuff at the same time. Act like you are one of the largest companies in the world. Maybe focus on something other than AdWords for a bit. Try it out. You committed to use node, and you know Nodes update cycle. Who dropped the ball here? It takes you longer to update your library than the cycle to deprecate your library. Seems like 101 stuff here. Maybe the interns should not be handing this project anymore. Seriously disappointing, since you are releasing great new features for firebase this same time you are doing nothing for basic triggers like OnCreateUser. Who would need such an edge case method, right?

@kafkas
Copy link

kafkas commented May 6, 2025

Hey folks, just wanted to check if I’m missing something here. I’ve been seeing a lot of complaints about the lack of auth onCreate/onDelete triggers in v2 and how people can't upgrade to v2 because of this, but isn’t it totally fine to just mix v1 and v2 functions?

We’ve upgraded all our other triggers (Firestore, callables, etc.) to v2, and we’re still using v1 just for the auth triggers until they’re supported in v2. This setup works fine with both Node.js 20 and 22 engines:

import { runWith } from 'firebase-functions/v1';
import { onDocumentCreated } from 'firebase-functions/v2/firestore';

export const authTriggerV1 = runWith({ /* config */ })
  .auth.user()
  .onCreate(async user => {
    // ...
  });

export const firestoreTriggerV2 = onDocumentCreated('users/{userId}', async event => {
  // ...
});

It’s been working smoothly for us. Once v2 supports auth triggers, we’ll migrate those too. Is there a reason this isn’t a viable solution for others?

@davie-robertson
Copy link

davie-robertson commented May 9, 2025

...and for what it is worth, they can no longer run side-by-side with v2 functions - #1653

@kafkas
Copy link

kafkas commented May 9, 2025

@davie-robertson Did you try deploying yourself? It is working for me. The issue you linked is from December 2024. It is possible they added support recently and haven't updated the docs.

Image

@davie-robertson
Copy link

hi @kafkas ,

Yes, I am deploying via firebase deploy --only functions, as as per that issue, it's not working in europe-west1

Image

@mgrazianoc
Copy link

Layoffs are so good, am I right folks?

@MarkUnthank
Copy link

+1

@RohovDmytro
Copy link

+googol

@emaysyuk
Copy link

+1

@emaysyuk
Copy link

emaysyuk commented May 22, 2025

Failed to update v1 functions with Node 22 in europe-central2

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests