skip to Main Content

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


  1. Chosen as BEST ANSWER

    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:

    import * as functions from 'firebase-functions/v1';
    
    functions.auth.user().onDelete
    

  2. 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:

    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.

    For now, you must keep using the v1 version imports for Authentication triggers, and none of the instructions for migrations to v2 apply.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search