Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

An invalid State Machine file causes the trigger to fail #188

@aclavio

Description

@aclavio

If a bad state-machine is present in the database, then calls to getAllStateMachinesContextQuery() will cause an exception. This causes the trigger to fail with the following stack trace:

2021-09-22 14:52:37.951 Notice: JS-JAVASCRIPT: const context = domain.context || []; -- Error running JavaScript request: TypeError: Cannot read property 'context' of undefined
2021-09-22 14:52:37.951 Notice:+in /state-conductor/state-conductor.sjs, at 333:25, in getStateMachineContextQuery() [javascript]
2021-09-22 14:52:37.951 Notice:+in /state-conductor/state-conductor.sjs, at 364:27, in getStateMachines.toArray.map() [javascript]
2021-09-22 14:52:37.951 Notice:+in /state-conductor/state-conductor.sjs, at 364:5, in getAllStateMachinesContextQuery() [javascript]
2021-09-22 14:52:37.951 Notice:+in /state-conductor/trigger/state-conductor-item-trigger.sjs, at 22:17, in registerCtxQuery() [javascript]
2021-09-22 14:52:37.951 Notice:+in /state-conductor/trigger/state-conductor-item-trigger.sjs, at 39:20, in getCtxRegQueryId() [javascript]
2021-09-22 14:52:37.951 Notice:+in /state-conductor/trigger/state-conductor-item-trigger.sjs, at 47:22, in checkUriAgainstContext() [javascript]
2021-09-22 14:52:37.951 Notice:+in /state-conductor/trigger/state-conductor-item-trigger.sjs, at 74:4 [javascript]
2021-09-22 14:52:37.951 Notice:+in /state-conductor/trigger/state-conductor-item-trigger.sjs [javascript]

In this case the state-machine didn't contain the required "mlDomain" root level element.

The correct behavior for this scenario is that invalid state-machines are skipped (after logging an error), and no errors bubble up causing the trigger to fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions