If you're having issues with an onEdit(e) function, try renaming the function to something more meaningful, and setting it up with an On edit installable trigger.
Note: By doing this, the apps script will always run under your account, regardless of the user editing the file.
Open the Apps Script Editor,
Rename the onEdit function to something else (for example: installedEdit),
Go to the ⏰ Triggers icon on the left side of the Apps Script Editor window,
Create a new trigger and Select event type as On edit,
Save the trigger.