Forge Lifecycle Uninstalled Event

Hey @SeanBourke,

The uninstallation hook is not always call, particularly when the instance is killed by Atlassian, or in the case of sandbox, where a new sandbox trigger a new installation but without uninstalling the previous one (if I remember correctly).
Also, we didn’t update our installations table with the uninstallation date for the first year, so we have a lot of installations with an unknown state.

So to ensure that we clean customers data 30 days after uninstallation with do:

  1. the uninstall hook update the installations table with an uninstallation_date
  2. a job execute everyday and clean the data when the uninstallation_date is past 30 days
  3. another job execute everyday and check the installations with the licenses data that we get from Atlassian Marketplace, base on the app_entitlement_id => if there is an evaluation_end_date, we set the installation.uninstallation_date = license.maintenance_end_date

But even with this, there are corner cases that we don’t cover. For example, some of the rows in installations are old enough to not have an app_entitlement_id => what should we do in this case ? Consider that the app has not been updated for a long time, therefore it is safe to assume it is not installed anymore ?

All of this seems way too complicated just to know if our apps are installed, or not, on some instances.

A thread on this subject where they do things differently:

Also from https://community.developer.atlassian.com/t/falsehoods-developers-believe-about-connect-install-hooks/63813:

There is a trick if you want to know who still has your app installed:

Publish a new micro change in your descriptor,
Atlassian picks up on it, upgrades all instances (assuming you haven’t recently made a major upgrade that customers could reject),
After 24hrs, you can unsafely assume that the remaining instances have uninstalled your app, and you have missed the uninstall hook (but this assumption is unsafe, I insist, don’t straight up delete data and don’t accuse me if it doesn’t work).