Hi,
we want to start using the new avi:forge:installed:app and avi:forge:upgraded:app lifecycle events, but we are not sure on how to test these. Our manifest contains:
trigger:
- key: lifecycle-trigger
function: lifecycle-trigger-func
events:
- avi:forge:installed:app
avi:forge:upgraded:app
function:
- key: lifecycle-trigger-func
handler: lifecycle.postInstallOrUpdateHandler
and we want to check that the function is called. We thought in adding a value to storage (Storage API) when the function is invoked, and then read that value out from an admin page in the app.
This is our lifecycle file:
import { storage } from '@forge/api';
export const postInstallOrUpdateHandler = async (
event: object,
context: object
) => {
console.log('event: ' + JSON.stringify(event));
console.log('context: ' + JSON.stringify(context));
await storage.set('TestEvent', 'hello');
return true;
};
We uninstall and install the app manually before every test, but we get undefined when reading the TestEvent value from storage from the app. Also we cant see the console.log lines anywhere, I guess because the tunnel is not running during the install process.
What is the best way for us to check that the post-install and post-upgrade events are working?
Thanks,