moleculerjs / moleculer-repl

REPL module for Moleculer framework
http://moleculer.services/docs/moleculer-repl.html
MIT License
27 stars 25 forks source link

Bug: `call` command tabbing after stopping a node crashes repl. #20

Closed kevyworks closed 5 years ago

kevyworks commented 6 years ago

Description

Loaded node has its own set of actions, after stop a node and issuing a repl command call <tab> crashes repl. broker.registry.getActionList still shows actions but not available.. Connected through repl or moleculer connect

Expected

Should not throw error but instead, not to show commands and should not process commands that are flag as not available or an this.action === null filter getActionList first?.

Error Log

readline.js:1020
            throw err;
            ^

TypeError: Cannot read property 'name' of undefined
    at _.uniq.broker.registry.getActionList.map.item (/Volumes/KB/test/micro/node_modules/moleculer-repl/src/commands/call.js:85:77)
    at Array.map (<anonymous>)
    at data (/Volumes/KB/test/micro/node_modules/moleculer-repl/src/commands/call.js:85:53)
    at handleDataFormat (/Volumes/KB/projects/ecs-llc/micro/node_modules/vorpal/dist/autocomplete.js:411:17)
    at Session.getMatchData (/Volumes/KB/projects/ecs-llc/micro/node_modules/vorpal/dist/autocomplete.js:441:3)
    at Session.exec (/Volumes/KB/projects/ecs-llc/micro/node_modules/vorpal/dist/autocomplete.js:51:20)
    at Session.session.getAutocomplete (/Volumes/KB/projects/ecs-llc/micro/node_modules/vorpal/dist/session.js:245:28)
    at Session.session.getKeypressResult (/Volumes/KB/projects/ecs-llc/micro/node_modules/vorpal/dist/session.js:220:15)
    at Vorpal.vorpal._onKeypress (/Volumes/KB/projects/ecs-llc/micro/node_modules/vorpal/dist/vorpal.js:508:18)
    at UI.<anonymous> (/Volumes/KB/projects/ecs-llc/micro/node_modules/vorpal/dist/vorpal.js:134:10)
    at emitOne (events.js:116:13)
    at UI.emit (events.js:211:7)
    at UI._keypressHandler (/Volumes/KB/projects/ecs-llc/micro/node_modules/vorpal/dist/ui.js:308:12)
    at Prompt.inquirer.prompt.prompts.(anonymous function).onKeypress (/Volumes/KB/test/micro/node_modules/vorpal/dist/ui.js:138:14)
    at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.next (/Volumes/KB/test/micro/node_modules/rx-lite/rx.lite.js:1535:12)
    at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/Volumes/KB/test/micro/node_modules/rx-lite/rx.lite.js:1469:31)
kevyworks commented 5 years ago

@icebob Thanks!

icebob commented 5 years ago

Could you test it? The autocomplete didn't work for me, so it was a blind fixing :)

kevyworks commented 5 years ago

@icebob yup it is fixed, tested before updating vs updated tabbing from a actions -a which are actions marked FAILED did not autocomplete.

icebob commented 5 years ago

Great, thanks!