Developer
News and Updates
Get Support
Sign in
Get Support
Sign in
DOCUMENTATION
Cloud
Data Center
Resources
Sign in
Sign in
DOCUMENTATION
Cloud
Data Center
Resources
Sign in
Forge modules
Automation modules
Bitbucket modules
Compass modules
Confluence modules
Dashboard modules (EAP)
Jira modules
Jira Service Management modules
Jira Software modules
Rovo modules
Teamwork Graph modules
Last updated Apr 7, 2026

Pre-uninstall trigger

The preUninstall module registers a function that runs when your app is uninstalled from an Atlassian app, giving it the opportunity to perform cleanup operations.

Pre-uninstall invocations are non-blocking. If the invocation fails, the uninstallation process will still continue.

Pre-uninstall functions run without a user context, which means the principal field of the context argument doesn't represent a user. If a function invoked from a pre-uninstall function returns a value, it is ignored. If the function throws an error, nothing will happen, and the uninstallation process will continue.

The invocation will have a timeout of 55 seconds.

Properties

PropertyTypeRequiredDescription
key

string

Yes

A key for the module, which other modules can refer to. Must be unique within the manifest.

Regex: ^[a-zA-Z0-9_-]+$

functionstringRequired if using triggers.A reference to the function module that defines the module.
endpointstring

Yes (if no function is specified).

A reference to the endpoint specifying the remote back end that resolves your event (if you are using Forge Remote).

Function arguments

When your trigger function is invoked, it receives two arguments:

1
2
export async function myTriggerFunction(payload, context) {
  // handle the payload
}

Arguments

  • payload: A payload detailing the invocation request.
  • context: Additional information about the context the function invocation occurred in. Refer to Context Schema for complete details.

Payload

PropertyTypeRequiredDescription
contextobjectYesProperties identifying this function to Atlassian.
context.cloudIdstringYesThe cloud ID.
context.moduleKeystringYesThe key identifying the `preUninstall` module in the manifest.
contextTokenstringYesAn encoded token used by Atlassian to identify the pre-uninstall trigger invocation. This value has no meaning to an app.

Example

Your function receives a request object with the following structure:

1
2
{
  "context": {
    "cloudId": "4f6d9508-93c9-4c2e-abd7-916c34920012",
    "moduleKey": "example-pre-uninstall"
  },
  "contextToken": "eyJhbGciOiJSUzI1NiIsImtpZCI6ImZvcmdlL2NvbnRleHQtdG9rZW4vMTcyYWE2NDItNDY1OS00OWRlLTk0YTYtYjVhYTZjODdlYTli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EpRMRjMAkG4xT-fKYuARBc_bd7WlP4Z8SZrqiZwkModWtHVsXD6OnsYpITJwP9nNoUIG_6WaBZelkyoCpomjj3zXRy5_b5MNI61rJrRGt_R3EZ9h2Xb5OwZ9OUve2SeelrcBBxJblg3tBQ9IFS_828Az6CELbCbf5h7Wz8aXvd3Q_Mrh3GpDHk4sP6bUsjkfhmtT9d292aEehl4BCZHFVQZieQ"
}

Context object properties

The context object contains information about the environment and installation where the trigger was invoked:

PropertyTypeDescription
principalPrincipal | undefinedThe principal containing the Atlassian ID of the user that interacted with the component.
installContextstringThe ARI identifying the cloud or Atlassian app context of this component installation.
workspaceIdstring | undefinedThe ID of the workspace on which the extension is working.
licenseLicense | undefinedContains information about the license of the app. This field is only present for paid apps in the production environment.
license is undefined for free apps, apps in DEVELOPMENT and STAGING environments, and apps that are not listed on the Atlassian Marketplace.
installationInstallation | undefinedA summary of the app installation, including the installation ARI and the contexts where the app is installed.

For complete context schema details and TypeScript definitions, see Function Arguments.

Example

1
2
modules:
  preUninstall:
    - key: example-pre-uninstall
      function: my-pre-uninstall-function
  function:
    - key: my-pre-uninstall-function
      handler: index.trigger

Handler function in index.js

1
2
// index.js

export const trigger = (payload, context) => {
  console.log("Pre-uninstall invoked");
  console.log(payload);
};

Rate this page: