Running the custom user creation function throws $undefined: true in console

Hi,

So I have this flutter app with realm that uses flexible sync configuration. So I wanted to implement custom user metadata apart from builtin-auths so on trying to create the onUserCreation function (code below) and running it, it throws $undefined: true in the console. What does it mean? Can anyone guide as to how can I setup my custom user creation function?

exports = async (user) => {
  const collection = context.services
    .get("mongodb-atlas")
    .db("todo")
    .collection("users");
    
  try {
    const newUser = await collection.insertOne({
      owner_id: user.id,
      avatar: user.data.avatar,
      name: user.data.name,
      isProUser: user.data.isProUser,
      token: user.token,
    });
    return newUser;
  } catch (e) {
    console.error(`Failed to create custom user data document for user:${user.id}`);
    console.error(e);
    // throw e
  }
};
1 Like

Did you ever figure this out? I am getting the same output in the testing console result tab.

Unfortunately, no. Have you found anything in these last days?