Realm Auth Trigger not firing from frontend


I have a trigger set up to run a function on “Create” with authentication. This function creates a document in my members collection to contain some basic info about the user. The function looks like this:

  exports = function(authEvent){
  // Only run if this event is for a newly created user.
  if (authEvent.operationType !== "CREATE") { return }
  // Get the internal `user` document
  const { user } = authEvent;
  const users ="mongodb-atlas")
  const isLinkedUser = user.identities.length > 1;
  if(isLinkedUser) {
    const { identities } = user;
    return users.updateOne(
      { user_id: },
      { $set: { 
      } }
  } else {
    return users.insertOne({ _id:, email: })

This trigger works correctly if I manually create the user in the ui, but if I create it from the front end it does not fire. The user is created, but the trigger never fires. Here is the trigger:

Any ideas why it may be failing to trigger?

Ok, so the trigger only fires after the user is confirmed through the email confirmation function and successful login. Would be helpful to include this in the documentation