This is my code:
exports.createExample = functions.auth.user().onCreate((testUser) => {
functions.logger.log("inside the auth trigger ", testUser.uid);
return null;
});
- This trigger is working in production (I need to change some components inside the function - functions.logger.log is just sample code for troubleshooting)
- I have upgraded everything: firebase-functions is v6.3.2 and firebase-admin is v13.2.0
- I have checked and verified the following:
const functions = require("firebase-functions");
const admin = require("firebase-admin");
- One suggestion was the admin.initializeApp() was the problem. I tried putting that inside the trigger function as suggested but same error
- This is apparently an error the CLI is calling on the deployment. I verified I am running 13.35.1
- I don't understand why, on deployment, the trigger would ever be defined? Seems like it would be undefined until such time as it was in production and a user was created in firebase auth.
- Full error is:
=== Deploying to 'sample_firebase_project'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> lint
> eslint .
✔ functions: Finished running predeploy script.
i functions: preparing codebase default for deployment
i functions: preparing codebase fix_overwrite_issue for deployment
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
i artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔ artifactregistry: required API artifactregistry.googleapis.com is enabled
✔ functions: required API cloudbuild.googleapis.com is enabled
✔ functions: required API cloudfunctions.googleapis.com is enabled
⚠ functions: Runtime Node.js 18 will be deprecated on 2025-04-30 and will be decommissioned on 2025-10-31, after which you will not be able to deploy without upgrading. Consider upgrading now to avoid disruption. See https://cloud.google.com/functions/docs/runtime-support for full details on the lifecycle policy
i functions: Loading and analyzing source code for codebase default to determine what to deploy
Serving at port 8689
TypeError: Cannot read properties of undefined (reading 'user')
at Object.<anonymous> (/Users/test/AndroidStudioProjects/app/node_modules/firebase-tools/functions/index.js:35:47)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at loadModule (/Users/test/AndroidStudioProjects/app/node_modules/firebase-tools/functions/node_modules/firebase-functions/lib/runtime/loader.js:40:16)
at loadStack (/Users/test/AndroidStudioProjects/app/node_modules/firebase-tools/functions/node_modules/firebase-functions/lib/runtime/loader.js:157:23)
at /Users/testAndroidStudioProjects/app/node_modules/firebase-tools/functions/node_modules/firebase-functions/lib/bin/firebase-functions.js:56:56
NOTE: Both loader.js and firebase-functions.js are new and assumed to be current versions.
Any insights are appreciated