Automatic admin email from user lifecycle hook

System Information
  • strapi 4.0.7:
  • osx big sur/docker 4.3.0:
  • mysql:
  • node 14.16.0:
  • npm 6.14.11:
  • yarn 1.22.5:

Hi! I have been trying to attach a lifecycle hook to the user permissions plugin upon user creation. I can see in the logs that it gets triggered when I use postman but it returns a 400 and wrongly says that email already exists
whenever I attempt to trigger emailing functionality. I know the email works because I am able to get the email confirmation for user but I want another email notifying the admin of the system. Thanks in advance!

  async bootstrap({ strapi }) {
    console.log("test");
    strapi.db.lifecycles.subscribe({
      models: ['plugin::users-permissions.user'],

      // your lifecycle hooks
      async afterCreate(event) {
        const { result, params } = event;
        let user = {}
        console.log(result)
        console.log('user created!')
        if (result) {
          console.log("trying to send")
          user = result
       
          const emailTemplate = {
            subject: 'User Sign-up',
            text: `User (<%= user.username %>) has signed up. 
            Please check the application dashboard for details.`,
            html: `<h1>User (<%= user.username %>) has signed up.</h1>
            <p>Please check the application dashboard for details.<p>`,
          };

          // await strapi.plugins['email'].services.email.sendTemplatedEmail(
          // {
          //   to: process.env.NOTIFY_USER || 'me@anywhere.com',
          //   // from: is not specified, so it's the defaultFrom that will be used instead
          // },
          //   emailTemplate,
          // {
          //   user: _.pick(user, ['username', 'email', 'firstname', 'lastname']),
          // }
          // );
      }
      
        //console.log(strapi.controller('api::project.signupNotif'))
        //await strapi.controller('api::project.signupNotif')
        //await strapi.api('projects').controller('signupNotif')
        //await request(`/api/signup-notification`);
        console.log("after email")
      },
    })```
---
          await strapi
          .plugin('email')
          .service('email')
          .send({

Interestingly enough just using the plain vanilla email service works instead of the sendTemplatedEmail