Forge lifecylce events

Hi,

I have added the triggers for install and upgrade in my manifest.yml. and created a function to fetch the events. But how to test this in local.

I ran my app using npm run dev . Meanwhile in another console i did forge install --upgrade. But i dont see any messages in console.

Could someone please help in testing these events.

manifest.yml:

trigger:
    - key: lifecycle-trigger
      function: lifecycle-trigger-func
      events:
        - avi:forge:installed:app
        - avi:forge:upgraded:app
  function:
    - key: resolver
      handler: index.handler
    - key: lifecycle-trigger-func
      handler: lifecycle.postInstallOrUpdateHandler

lifecycle.js:

exports.postInstallOrUpdateHandler = async function(event, context) {
    console.log('event: ' + JSON.stringify(event));
    console.log('context: ' + JSON.stringify(context));
  
    return true;
  };

Thanks

Upgrades are only sent as events when a new major version is installed. To test it, you would have to make a change to, say, the scopes to trigger a new major version. Not sure if you can do that while tunneling, though.

1 Like

I uninstalled the app and again installed while running the app with npm run dev in another terminal. Still didnt get the call back

I am able to get the callback when i install and uninstall the app. Tried the code in the index.js then it worked. Thanks

1 Like