refactor(auth-demo): modernize functions to v2 API#10151
Conversation
|
There was a problem hiding this comment.
Code Review
This pull request updates the Firebase Cloud Functions in the auth demo to use the newer HTTPS trigger syntax and simplifies the initialization of the admin SDK. The reviewer identified an invalid import path for the onRequest trigger, which will cause a module resolution error and should be corrected to import from firebase-functions/v2/https.
| */ | ||
|
|
||
| const functions = require('firebase-functions'); | ||
| const { onRequest } = require('firebase-functions/https'); |
There was a problem hiding this comment.
In Cloud Functions for Firebase v2, the correct import path for HTTPS triggers is firebase-functions/v2/https. Importing from firebase-functions/https is invalid and will result in a module resolution error (Cannot find module 'firebase-functions/https').
| const { onRequest } = require('firebase-functions/https'); | |
| const { onRequest } = require('firebase-functions/v2/https'); |
Security Audit & Remediation: auth-demo-functions
A. Previous CVEs
B. Changes Made
checkIfAuthenticatedfrom Cloud Functions v1 to v2 API viarequire('firebase-functions/https')admin.initializeApp()C. Remaining CVEs
uuidand@tootallnate/once.D. Introduced CVEs
E. Testing Strategy
node --checkvalidation on the updated function file - 100% passing.