Strapi lifecycle hooks afterDelete not working after delete from admin panel

Could it be that your if condition never evaluates to true? Try setting a breakpoint or a console log very early in the function to see if it gets called.