Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something goes wrong in Node 0.12.14 #3

Closed
sp00x opened this issue Jun 23, 2016 · 1 comment
Closed

Something goes wrong in Node 0.12.14 #3

sp00x opened this issue Jun 23, 2016 · 1 comment

Comments

@sp00x
Copy link

sp00x commented Jun 23, 2016

Not sure what's going on, but with node 0.12.14 this blows up:

My configuration:

        this._queueStates = StateMachine

            .configure()

                .initialState('idle')

                    .onEnter(() => {
                        if (this._queue.length > 0) this._queueStates.handle('enqueue');
                    })

                    .on('enqueue').transitionTo('process')

                .state('process')

                    .onEnter(() => {
                        this._processNextQueuedJob()
                    })

                    .on('idle').transitionTo('idle')

                .global()
                    .onStateEnter((state: string) => this._log.info(`QUEUE: Entering state ${state}`))
                    .onUnhandledEvent((event: string, state: string) => this._log.info(`QUEUE: Unhandled event '${event}' in state '${state}.'`))

            .start();

Then I enqueue something and tell the SM to "enqueue":

        this._queue.push(qj);
        this._queueStates.handle('enqueue');

and BOOM!

TypeError: undefined is not a function
    at StateMachine.selectTransition (XYZ\node_modules\finity\lib\core\StateMachine.js:304:26)
    at StateMachine.getTransitionForEvent (XYZ\node_modules\finity\lib\core\StateMachine.js:149:61)
    at StateMachine.processEvent (XYZ\node_modules\finity\lib\core\StateMachine.js:121:35)
    at XYZ\node_modules\finity\lib\core\StateMachine.js:83:25
    at StateMachine.execute (XYZ\node_modules\finity\lib\core\StateMachine.js:98:9)
    at StateMachine.handle (XYZ\node_modules\finity\lib\core\StateMachine.js:82:14)
    at AdobeMediaEncoder.enqueueJob (XYZ\src\ame.ts:708:27)
    at XYZ\testing\test-ame.js:54:26
    at _fulfilled (XYZ\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (XYZ\node_modules\q\q.js:863:30)

Works fine in Node 4.4.5

(Just switching versions using nodist)

Apprently this is within selectTransition() where the "transitions" object is JSON.stringify(transitions) -> "[{"targetState":"process","isInternal":false,"actions":[],"condition":null}]" which does not have any find() method so this blows up trying to call "undefined";

return transitions.find(function (t) {
        return !t.condition || t.condition(context);
      });

(And why am I using 0.12.14? Well.. long story)

@nickuraltsev
Copy link
Owner

Fixed in v0.4.5. Thank you for digging into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants