Hello I'm trying to write a function so that i can change the data when a user was created.
The following doesn't work. What am I doing wrong?
Doesn't it work with my model object of the user since i have some dependencies
in this package
name: foundation
description: A starting point for Dart libraries or applications.
# version: 1.0.0
# homepage: https://www.example.com
environment:
sdk: '>=2.5.0 <3.0.0'
dependencies:
quiver: ^2.0.5
intl: ^0.16.0
dev_dependencies:
pedantic: ^1.8.0
test: ^1.6.0
I'm getting all the time in the logs errors like these however there is no useable information inside.
TypeError: u.bx is not a function
at Object.lJ (/srv/build/node/index.dart.js:1628:63)
at fq.mv (/srv/build/node/index.dart.js:1756:5)
at dX.aW (/srv/build/node/index.dart.js:3771:5)
at dZ.$2 (/srv/build/node/index.dart.js:3775:32)
at Object.lP (/srv/build/node/index.dart.js:187:112)
at me (/srv/build/node/index.dart.js:1424:10)
at /srv/build/node/index.dart.js:1418:42
at cloudFunction (/srv/node_modules/firebase-functions/lib/cloud-functions.js:131:23)
at /worker/worker.js:825:24
at <anonymous>
Here is the code I tried:
void main() {
functions['createUser'] =
functions.firestore.document('/users/{userId}').onCreate(createUser);
}
FutureOr<void> createUser(DocumentSnapshot snap, EventContext context) {
final user = User.fromJson(snap.data.toMap());
final newUser = user.copy(idUser: 'hello_word');
final newDoc = DocumentData.fromMap(newUser.toJson());
return snap.reference.setData(newDoc);
}
Hello I'm trying to write a function so that i can change the data when a user was created. The following doesn't work. What am I doing wrong?
Doesn't it work with my model object of the user since i have some dependencies in this package
I'm getting all the time in the logs errors like these however there is no useable information inside.
Here is the code I tried: