Cannot find module ‘firebase-functions/v2/auth’ or its corresponding type declarations.
This is error I get on import { onDelete } from "firebase-functions/v2/auth";
What I tryied from other tickets I have found:
delete node_modules
, delete package-lock.json
, run install.
add "exclude": ["node_modules", "functions"]
to my tsconfig.json
in root.
2
Answers
I have found out why was that happening. Seems like that is some old version of calling Authentication trigger for cloud functions.
here is new version:
In fact, to date, has never been a "firebase-functions/v2/auth" import to use.
The "v2" you see in other Firebase product imports indicates use of second generation functions. The "v1" means first generation. Authentication functions aren’t yet available for 2nd gen functions, according to the documentation:
For now, you must keep using the v1 version imports for Authentication triggers, and none of the instructions for migrations to v2 apply.