# ⚠️ Do not use! – Tutorial: Notify users about major updates

**URL:** <https://community.developer.atlassian.com/t/do-not-use-tutorial-notify-users-about-major-updates/79242>\
**Category:** Forge Platform and Tools\
**Tags:** graphql, forge-native-nodejs-runtime, versioning\
**Created:** [April 17, 2024, 4:01pm UTC](https://community.developer.atlassian.com/t/do-not-use-tutorial-notify-users-about-major-updates/79242 "2024-04-17T16:01:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![klaussner](https://avatars.discourse-cdn.com/v4/letter/k/a183cd/32.png) [@klaussner](https://community.developer.atlassian.com/u/klaussner)\
**Post date:** [April 17, 2024, 4:01pm UTC](https://community.developer.atlassian.com/t/do-not-use-tutorial-notify-users-about-major-updates/79242/1 "2024-04-17T16:01:03Z")

</div>

⚠ **Unfortunately, this method no longer works due to a change in the Forge runtime (the outbound proxy can no longer make unauthenticated GraphQL requests).**

* * *

One of the biggest problems with the current app versioning system is that [customers often stay on old versions because admins don’t update apps manually](https://community.developer.atlassian.com/t/forge-update-broke-our-app-in-100s-of-customer-instances-and-we-cant-do-anything-about-it/77751) when new major updates are available.

I found a way to notify users about major updates that you can use until [Atlassian ships improvements to the versioning system](https://community.developer.atlassian.com/t/an-update-on-managing-app-versions-on-forge/77852).

# Prerequisites

- The app must use the native Node.js runtime.
- This method doesn’t need additional scopes or egress permissions.

# Getting the current version

The [`getAppContext`](https://developer.atlassian.com/platform/forge/runtime-reference/app-context-api/#getappcontext--preview-) function returns an object that includes the environment and the app version under which a Forge function is executed:

```tsx
import { getAppContext } from "@forge/api";

const context = getAppContext();
console.log(context.environmentType); // e.g., "PRODUCTION"
console.log(context.appVersion); // e.g., "2.1.0"

```

# Getting the latest version

To find out if the current version differs from the latest deployed version, you can fetch the latest version using the GraphQL API:

```graphql
query App {
  app(id: "ari:cloud:ecosystem::app/<YOUR_APP_ID>") {
    environments {
      type # e.g., "PRODUCTION"
      versions(first: 1) { # We only need the latest version.
        nodes {
          version # e.g., "3.0.0"
        }
      }
    }
  }
}

```

To make the request, use `requestGraph` function like this:

```tsx
const response = await api.asApp().requestGraph(query, undefined, {
  Authorization: "Forge none"
});

```

**It’s important to override the `Authorization` header** because `asApp` and `asUser` requests are not supported by this part of the GraphQL schema. `"Forge none"` is a special header value that tells the Forge outbound proxy to not use an `Authorization` header. Luckily, the GraphQL API returns details about the production environment of your app without this header if the app is published on the Marketplace. For example:

```json
{
  "data": {
    "app": {
      "environments": [
        {
          "type": "PRODUCTION",
          "versions": { "nodes": [{ "version": "3.0.0" }] }
        }
      ]
    }
  }
}

```

Finally, you can compare the version from the app context with the latest version for the respective environment and show a message in your front end if users need to update manually. 🎉

---

<div class="post-metadata">

**Author:** ![chhantyal](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/chhantyal/32/47298_2.png) [@chhantyal](https://community.developer.atlassian.com/u/chhantyal)\
**Post date:** [August 8, 2024, 7:58am UTC](https://community.developer.atlassian.com/t/do-not-use-tutorial-notify-users-about-major-updates/79242/2 "2024-08-08T07:58:39Z")

</div>

Looks like this is not working anymore. The Graph API returns 400 when Authorization header is used.

---

<div class="post-metadata">

**Author:** ![AbbyMarieFlood](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@AbbyMarieFlood](https://community.developer.atlassian.com/u/AbbyMarieFlood)\
**Post date:** [August 16, 2024, 9:04am UTC](https://community.developer.atlassian.com/t/do-not-use-tutorial-notify-users-about-major-updates/79242/3 "2024-08-16T09:04:15Z")

</div>

There’s another way to access information about the latest available version using the marketplace Rest API: [https://developer.atlassian.com/platform/marketplace/rest/v2/api-group-app-versions/#api-addons-addonkey-versions-latest-get](https://developer.atlassian.com/platform/marketplace/rest/v2/api-group-app-versions/#api-addons-addonkey-versions-latest-get). This doesn’t require the `Authorization` header so still works.  
It does require the marketplace URL to be added to the manifest though. With something like:

```auto
permissions:
  external:
    fetch:
      client:
        - remote: atlassian-marketplace
remotes:
  - key: atlassian-marketplace
    baseUrl: 'https://marketplace.atlassian.com'
    operations:
      - fetch

```

Specifying the URL permission directly also works but could affect data residency `PINNED` status (see [https://developer.atlassian.com/platform/forge/runtime-egress-permissions/#data-residency-eligibility](https://developer.atlassian.com/platform/forge/runtime-egress-permissions/#data-residency-eligibility)).
