Connect Lifecycle in the Manifest

Does anyone know the syntax of the lifecycle declaration for connect in the manifest. So what comes after

connectModules:
  jira:lifecycle:

I tried

connectModules:
  jira:lifecycle:
    - key: "connect-installed"
      installed: "/installed"
    - key: "connect-uninstalled"
      uninstalled: "/uninstalled"
    - key: "connect-enabled"
      enabled: "/enabled"
    - key: "connect-disabled"
      disabled: "/disabled"

but it gives the error

'jira:lifecycle' should contain only one element  valid-connect-module-required

And

connectModules:
  jira:lifecycle:
    - installed: "/installed"
    - uninstalled: "/uninstalled"
    - enabled: "/enabled"
    - disabled: "/disabled"

Gives the error

found duplicate connect module key 'undefined'  valid-connect-module-required
'jira:lifecycle' should contain only one element  valid-connect-module-required

Regards
Paul

Hi Paul,
I think the the lifecycle modules expects an array of the lifecycle elements, so it should be something like this:

connectModules:
  "jira:lifecycle":
    [
      {
          "key": "connect-lifecycle",
          "installed": "/installed"
        }
    ]

Hope this helps!
Thanks

Hi @ragrawal , thanks that worked but if I add an uninstall one then it gives the error

'jira:lifecycle' should contain only one element  valid-connect-module-required

Are you only allowed one lifecycle hook?

Regards
Paul

1 Like

Hey @paul , apologies that the documentation isn’t super clear on this, I think the way it works is that all lifecycle callbacks are within the same module function.

connectModules:
  "jira:lifecycle":
    [
      {
        "key": "connect-lifecycle",
        "installed": "/installed",
        "uninstalled": "/uninstalled"

      }
    ]

Also, it would be good to know your use case in a bit more detail to understand how your app can’t use forge and needs connect features. There are still known limitations if you are building a connect on forge app.

Hi @ragrawal , ahhh that explains all my trouble. I was always trying to add multiple hooks which were always failing.

My use case is that the Forge events that I need are very constrained compared to there connect counterparts. To get around this I have life cycle events on both Forge and Connect. The Forge one registers itself with the Connect app and the Connect one uses the life cycle events to record the Jira instance involved. All events are sent to Connect which then pushs them back to Forge. It’s a bit crazy but it is the only to get what I want.

Regards
Paul