"Error: action.pluginId is required" when trying to add menu or toolbar item

I'm using AppImage to launch dev version of Joplin
/tmp/.mount_JoplinmsLh6l/joplin --env dev

(version 1.3.18, desktop, linux)

I have also installed AppImage launcher (https://github.com/TheAssassin/AppImageLauncher)

I'm trying example plugin (
https://github.com/laurent22/joplin/blob/dev/packages/app-cli/tests/support/plugins/selected_text/src/index.ts ) verbatim.

While command is registered correctly (I can access it via Command Palette),
registering menu item or toolbar throws error:

19:32:08 Plugin Service: Starting plugin:  main-html.js:49
19:32:09 Plugin Service: Finished running onStart handler:  (Took 633ms)

/tmp/.mount_Joplinms…ugins/reducer.js:52 Uncaught (in promise) Error: action.pluginId is required. Action was: 
    at Object.reducer (lib/services/plugins/reducer.js:52)
    at Object.<anonymous> (lib/reducer.js:975)
    at node_modules/immer/d….development.js:713
    at Immer.produce (node_modules/immer/d….development.js:728)
    at Object.curriedProduce [as default] (node_modules/immer/d….development.js:710)
    at reducer (lib/BaseApplication.js:564)
    at reducer (app.js:267)
    at dispatch (node_modules/redux/l…/createStore.js:178)
    at Application.<anonymous> (lib/BaseApplication.js:451)
    at Generator.next (<anonymous>)

this is log form main console window, not plugin console.

It seems that plugin id is empty.
Commenting line below launches without error.

so i'm sure code for command works properly.

Any ideas?

EDIT: i'm trying desktop app, is extending menus/toolbars in desktop available?

On version 1.4.7 same error.

Thanks for the detailed report, I'll check

Just to note, error in console is pointing to this line in reducer.ts

Found it.
EDIT:For those who would have same problem,solution is to NOT adding trailing slash to path of the plugin

filename with basename path utils will return empty string when path to plugin ends with slash.
pluginId is generated with filename(path) here:

but doing filename("/home/user/plugin/') will produce empty string.

from basename()

var path="/asdf/foo/";	var s = path.split(/\/|\\/);
	 s[s.length - 1];
var path="/asdf/foo";	var s = path.split(/\/|\\/);
	 s[s.length - 1];

1 Like

Thanks for the info, it's fixed here now: https://github.com/laurent22/joplin/commit/918b76863443f4f3e5f683005c4a3ae50b69189e

1 Like