Stop making these 3 mistakes when dealing with App migration events

This post outlines the guidelines to avoid the common mistakes about App migration events. We will go through the common mistakes and provide recommended practices. We will also share ways to detect any breaking changes in event payload, if you missed updating your code before the end of corresponding deprecation period.

The webhook that you register is a callback URL that the App migration platform uses to send information about App migration events. The App migration platform provides notifications to your cloud app using the following event types:

Event type Description
listener-triggered Notifies your cloud app when core product data migration is finished.
app-data-uploaded Notifies your cloud app that app data upload to the Atlassian secure cloud storage is complete.

For more details about current event types, refer to following App migration documentation.

https://developer.atlassian.com/platform/app-migration/events

Following are the 3 mistakes to avoid when handling App migration events.

Mistake 1: Fail if there is new eventType value

The App migration platform could introduce new event types in the near future to provide more details about an app migration. We recommend you accept the eventType attribute of App migration event as a String . This will make your cloud app resilient to any new eventType introduced by App migration platform.

Mistake 2: Expecting same payload for all event types

The event payload is not the same for all event types. The event payload can change based on the eventType . Hence, we recommend your application performs specific payload validation based on the eventType attribute and be resilient to new event attributes. This will make your code resilient, if any new eventType is introduced which could have a different payload or if new event attributes are added to existing event types.

Mistake 3 : Returning 200 OK when the event payload do not match

Whenever an App migration event is received, return a response code after validating the payload of App migration event. If the event payload is not valid, return an appropriate error code with a message about the mismatched/incorrect fields. You could get invalid payload, if any event attribute is modified or removed as part of breaking change following a deprecation period. You can use this validation to implement monitoring to detect any missed events. Following this practice will also help the App migration platform to detect any anomaly with the App migration events.

4 Likes