Forge - Life cycle event not triggered

Hai Team,
We are working with forge app and configured some default information using storage api that will be stored on installation(using lifecycle events). Working fine in development environment. But after deployed to production, getting empty from storage

Below function should be executed on installation

export const initializeApp = async (event) => {
    console.log('events', event)
    const info = {};
    info["app"] = { id: event?.app?.id };
    info["user"] = { id: event?.installerAccountId };
    await storage.set("__info", info);
}

Below given manifest info

trigger:
    - key: lifecycle-trigger
      function: lifecycle-trigger-func
      events:
        - avi:forge:installed:app
        - avi:forge:upgraded:app
function:
    - key: lifecycle-trigger-func
      handler: trigger.initializeApp
1 Like

Hi @GaneshXDev ,

I’ve created a test app and am seeing similar results to you - i.e. the app does not seem to be receiving the lifecycle events. Here’s my code:

manifest.yml:

modules:
  trigger:
    - key: lifecycle-trigger
      function: lifecycle-trigger-func
      events:
        - avi:forge:installed:app
        - avi:forge:upgraded:app
  function:
    - key: lifecycle-trigger-func
      handler: index.onLifecycleEvent
permissions:
  scopes:
    - storage:app
app:
  id: ari:cloud:ecosystem::app/xxxx

index.jsx:

import { storage } from "@forge/api";

export async function onLifecycleEvent(event, context) {
	console.log('Lifecycle event received');
	await storage.set("foo", "bar");
	const foo = await storage.get("foo");
	const storageSetSuccessfully = foo === "bar";
	console.log(`Storage set successfully? ${storageSetSuccessfully}`);
}

Can you please get support from Developer Support to resolve this.

Regards,
Dugald

Yeah sure. Thanks for the reply @dmorrow

I seem to be running into the exact same issue. What’s the best process for adding to or tracking the problem through Developer Support? I seem to only be able to report a bug, should I go ahead and submit a duplicate?

@dmorrow @tpettersen we have submitted a support request but there is no repones so what is the best way to get prompt response from atlassian??

Hello all, thank you for reporting this issue: we have identified the root cause for this (a race condition in the provisioning code) and the team is online to fix it. We have created an incident on our developer status page so that you can follow up on the resolution of this issue: Atlassian Developer Status - Errors while invoking forge functions for newly installed apps

I apologize for the pain caused by this :frowning:

2 Likes