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

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

Open
aclavio opened this issue Sep 22, 2021 · 0 comments
Open

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

aclavio opened this issue Sep 22, 2021 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@aclavio
Copy link
Contributor

aclavio commented Sep 22, 2021

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.

@aclavio aclavio added the bug Something isn't working label Sep 22, 2021
@aclavio aclavio added this to the 1.3.0 milestone Sep 22, 2021
@aclavio aclavio added the good first issue Good for newcomers label Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant