onEdit not running in Sheets add-on

I had an apps script bound to a sheet which was using the onEdit simple trigger, and it was working fine. I’ve migrated it to a Sheets add-on and am testing it. The onOpen trigger runs fine, but onEdit won’t run. I also looked at using an installable trigger, but that’s not available when in testing mode.

Any ideas why onEdit is not triggering in the editor add-on?

One thing worth checking is how the test deployment is configured. For editor add-ons, onOpen can run even when the add-on isn’t enabled in the document, but onEdit only fires when the add-on is installed and enabled for that file. In the Apps Script editor under Deploy > Test deployments, try editing the test configuration so the installation config is set to “Installed and enabled” rather than just “Installed”, then open the test document from there and make an edit. Also keep in mind that a simple trigger won’t fire for changes made by a script or API call, only for edits a user makes in the sheet.

I filed a support case. It turns out that’s the expected behavior. onEdit doesn’t run in Test mode, only when deployed in production.

Thanks for coming back with the answer from support, and sorry that my test deployment suggestion didn’t apply here. The testing docs already note that installable triggers aren’t supported in test deployments, so it’s useful to know simple onEdit triggers don’t fire there either. Good to have that in the thread for anyone who hits the same thing.