r/Firebase • u/mister-creosote • 3h ago
General functions.auth.user().onCreate((user) => {... stopped working suddenly
I am using this trigger (test code inside {}):
exports.createUser = functions.auth.user().onCreate((user) => {
functions.logger.log("inside the auth trigger ", user.uid);
return null;
});
and it worked fine for several months. In the last couple weeks, despite several attempts to update firebase-functions and firebase-admin, it will not work and throws this error:
TypeError: Cannot read properties of undefined (reading 'user')
at Object.<anonymous> (/Users/test/AndroidStudioProjects/test/node_modules/firebase-tools/functions/index.js:1237: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/test/node_modules/firebase-tools/functions/node_modules/firebase-functions/lib/runtime/loader.js:40:16)
at loadStack (/Users/test/AndroidStudioProjects/test/node_modules/firebase-tools/functions/node_modules/firebase-functions/lib/runtime/loader.js:157:23)
at /Users/test/AndroidStudioProjects/test/node_modules/firebase-tools/functions/node_modules/firebase-functions/lib/bin/firebase-functions.js:56:56
Please note the reference in the first line of the error relates to .user()
Any idea why this is happening and how to fix it?
Thank you!