mattermost-plugin-jira icon indicating copy to clipboard operation
mattermost-plugin-jira copied to clipboard

Deleting the Jira bot user breaks the plugin

Open icelander opened this issue 5 years ago • 3 comments

Steps to Reproduce

  1. Delete the Jira user from the database or by using mattermost user delete
  2. Restart your Mattermost server

Expected Behavior

Jira plugin detects that there is no Jira user and creates a new one automatically

Observed Behavior

Jira plugin crashes and this message is printed to the logs:

error app/plugin.go:753 Failed to install prepackaged plugin {"path": "/opt/mattermost/mattermost-5.21.0/prepackaged_plugins/mattermost-plugin-jira-v2.3.2-linux-amd64.tar.gz", "error": "Failed to install extracted prepackaged plugin /opt/mattermost/mattermost-5.21.0/prepackaged_plugins/mattermost-plugin-jira-v2.3.2-linux-amd64.tar.gz: installExtractedPlugin: app.plugin.restart.app_error, couldn't set profile image: SqlUserStore.Get: store.sql_user.missing_account.const, user_id=hisj7j9ucfy8jnid7m8a4a7efy", "errorVerbose": "installExtractedPlugin: app.plugin.restart.app_error, couldn't set profile image: SqlUserStore.Get: store.sql_user.missing_account.const, user_id=hisj7j9ucfy8jnid7m8a4a7efy
Failed to install extracted prepackaged plugin /opt/mattermost/mattermost-5.21.0/prepackaged_plugins/mattermost-plugin-jira-v2.3.2-linux-amd64.tar.gz
github.com/mattermost/mattermost-server/v5/app.(*App).processPrepackagedPlugin
	github.com/mattermost/mattermost-server/v5@/app/plugin.go:796
github.com/mattermost/mattermost-server/v5/app.(*App).processPrepackagedPlugins
	github.com/mattermost/mattermost-server/v5@/app/plugin.go:751
github.com/mattermost/mattermost-server/v5/app.(*App).InitPlugins
	github.com/mattermost/mattermost-server/v5@/app/plugin.go:175
github.com/mattermost/mattermost-server/v5/app.(*Server).RunOldAppInitialization
	github.com/mattermost/mattermost-server/v5@/app/server_app_adapters.go:148
github.com/mattermost/mattermost-server/v5/app.NewServer
	github.com/mattermost/mattermost-server/v5@/app/server.go:204
github.com/mattermost/mattermost-server/v5/cmd/mattermost/commands.runServer
	github.com/mattermost/mattermost-server/v5@/cmd/mattermost/commands/server.go:64
github.com/mattermost/mattermost-server/v5/cmd/mattermost/commands.serverCmdF
	github.com/mattermost/mattermost-server/v5@/cmd/mattermost/commands/server.go:53
github.com/spf13/cobra.(*Command).execute
	github.com/spf13/[email protected]/command.go:826
github.com/spf13/cobra.(*Command).ExecuteC
	github.com/spf13/[email protected]/command.go:914
github.com/spf13/cobra.(*Command).Execute
	github.com/spf13/[email protected]/command.go:864
github.com/mattermost/mattermost-server/v5/cmd/mattermost/commands.Run
	github.com/mattermost/mattermost-server/v5@/cmd/mattermost/commands/root.go:15
main.main
	github.com/mattermost/mattermost-server/v5@/cmd/mattermost/main.go:31
runtime.main
	runtime/proc.go:203
runtime.goexit
	runtime/asm_amd64.s:1357"}

icelander avatar Apr 01 '20 19:04 icelander

@icelander Hi Paul, I ran into this. Did you find a workaround?

cjohannsen81 avatar Jun 26 '20 03:06 cjohannsen81

Found a workaround: Deleting the Jira plugin in the database (pluginkeyvaluestore) and reinstalling helps.

cjohannsen81 avatar Jun 30 '20 18:06 cjohannsen81

Until this is fixed the SQL query to delete all the jira data would be DELETE FROM PluginKeyValueStore WHERE PluginId = 'jira';

Alternatively one could also try to replace the mmi_botid field in the KVStore table with a new value:

UPDATE PluginKeyValueStore SET PValue = 'newbotid' WHERE PKey = 'mmi_botid' AND PluginId = 'jira'

Note that these queries are largely untested so run them at your own risk!

svelle avatar Aug 20 '20 13:08 svelle

@icelander @cjohannsen81 I tried to reproduce the issue but I was unable to do so. When I am deleting the Jira user from the DB and restarting the server its getting recreated. I think this was fixed with some other PR. Closing for now can reopen if you are still facing the issue. @wiggin77

raghavaggarwal2308 avatar Jul 25 '24 11:07 raghavaggarwal2308