Yes, unhandled exception emails do work with 2GP.
I confirmed this by creating a managed 2GP with a Visualforce Controller that tries to divide by zero if a certain custom metadata record is set to
Here's how I set up my test:
- Created managed 2GP using
force:package:update with the
--ERRORNOTIFICATIONUSERNAME flag and provided the username of a user from the DevHub that I used to create the 2GP.
- Created and promoted a package version with my test code
- Installed the package version in an ACTIVE (i.e. production) Enterprise Edition org.
- Performed an action that triggered the unhandled exception.
Figure 1: Unhandled Exception in the Subcriber Org
Figure 2: Unhandled Exception Email Received ~5 Minutes Later
Possible Reasons for Missing Unhandled Exception Emails
This Known Issue highlights the fact that Apex exception emails are rate-limited to a few hundred emails per hour for a given instance. This is also referenced in the Apex Developer Guide on the Exceptions in Apex page.
Apex exception emails are limited to 10 emails per hour, per application server. Because this limit isn’t on a per-org basis, email delivery to a particular org can be unreliable.
Depending on the type of unhandled exception and the frequency of that exception type being thrown on a given instance, you might intermittently miss out on getting Apex exception emails.
Best Practices for Surfacing Apex Exceptions in Managed Packages
The recommended course of action for ISV partners is to use AppExchange App Analytics to surface exceptions from within managed packages. To do this, filter your package usage logs by the
log_record_type value of
To learn more about AppExchange App Analytics, check out the AppExchange Partner Intelligence Basics module on Trailhead.