Mattermost Peer-to-Peer Forum

[SOLVED] Sample plugin unable to activate


#1

Summary

I am unable to activate the sample hello-world plugin on Mattermost

Steps to reproduce

Using Mattermost version 5.7 with docker on macOS. Installed using instructions at https://docs.mattermost.com/install/docker-local-machine.html.
I made the sample hello world plugin using the instructions at https://developers.mattermost.com/extend/plugins/server/hello-world/

Observed behavior

The plugin uploaded successfully but failed to enable with the message
This plugin failed to start. Check your system logs for errors.
System log:
{"level":"error","ts":1548344582.903604,"caller":"app/plugin.go:97","msg":"Unable to activate plugin","plugin_id":"com.mattermost.server-hello-world","error":"unable to start plugin: com.mattermost.server-hello-world: fork/exec plugins/com.mattermost.server-hello-world/plugin.exe: exec format error","errorVerbose":"fork/exec plugins/com.mattermost.server-hello-world/plugin.exe: exec format error\nunable to start plugin: com.mattermost.server-hello-world\ngithub.com/mattermost/mattermost-server/plugin.(*Environment).Activate\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/plugin/environment.go:221\ngithub.com/mattermost/mattermost-server/app.(*App).SyncPluginsActiveState\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/plugin.go:95\ngithub.com/mattermost/mattermost-server/app.(*App).InitPlugins.func2\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/plugin.go:172\ngithub.com/mattermost/mattermost-server/app.(*App).InvokeConfigListeners\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/config.go:136\ngithub.com/mattermost/mattermost-server/app.(*App).UpdateConfig\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/config.go:50\ngithub.com/mattermost/mattermost-server/app.(*App).EnablePlugin\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/plugin.go:245\ngithub.com/mattermost/mattermost-server/api4.enablePlugin\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/api4/plugin.go:183\ngithub.com/mattermost/mattermost-server/web.Handler.ServeHTTP\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/web/handlers.go:135\ngithub.com/mattermost/mattermost-server/web.(*Handler).ServeHTTP\n\t<autogenerated>:1\ngithub.com/mattermost/mattermost-server/vendor/github.com/gorilla/mux.(*Router).ServeHTTP\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/vendor/github.com/gorilla/mux/mux.go:162\ngithub.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers.recoveryHandler.ServeHTTP\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers/recovery.go:78\ngithub.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers.(*recoveryHandler).ServeHTTP\n\t<autogenerated>:1\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2741\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1847\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1333"}

Has anybody else faced this issue before?


#2

Hey @anubhav

Did you use GOOS=darwin GOARCH=amd64 go build -o plugin.exe plugin.go to build the plugin?


#3

Hi @Hanzei,

Tried this now. Still got a ‘failed to start’ message with the following log entry:
{"level":"error","ts":1548360499.840271,"caller":"app/plugin.go:97","msg":"Unable to activate plugin","plugin_id":"com.mattermost.server-hello-world","error":"unable to start plugin: com.mattermost.server-hello-world: fork/exec plugins/com.mattermost.server-hello-world/plugin.exe: exec format error","errorVerbose":"fork/exec plugins/com.mattermost.server-hello-world/plugin.exe: exec format error\nunable to start plugin: com.mattermost.server-hello-world\ngithub.com/mattermost/mattermost-server/plugin.(*Environment).Activate\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/plugin/environment.go:221\ngithub.com/mattermost/mattermost-server/app.(*App).SyncPluginsActiveState\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/plugin.go:95\ngithub.com/mattermost/mattermost-server/app.(*App).InitPlugins.func2\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/plugin.go:172\ngithub.com/mattermost/mattermost-server/app.(*App).InvokeConfigListeners\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/config.go:136\ngithub.com/mattermost/mattermost-server/app.(*App).UpdateConfig\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/config.go:50\ngithub.com/mattermost/mattermost-server/app.(*App).EnablePlugin\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/app/plugin.go:245\ngithub.com/mattermost/mattermost-server/api4.enablePlugin\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/api4/plugin.go:183\ngithub.com/mattermost/mattermost-server/web.Handler.ServeHTTP\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/web/handlers.go:135\ngithub.com/mattermost/mattermost-server/web.(*Handler).ServeHTTP\n\t<autogenerated>:1\ngithub.com/mattermost/mattermost-server/vendor/github.com/gorilla/mux.(*Router).ServeHTTP\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/vendor/github.com/gorilla/mux/mux.go:162\ngithub.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers.recoveryHandler.ServeHTTP\n\t/home/ubuntu/jenkins/workspace/msr/mattermost-platform-release/src/github.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers/recovery.go:78\ngithub.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers.(*recoveryHandler).ServeHTTP\n\t<autogenerated>:1\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2741\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1847\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1333"}


#4

Solved it.
I used this command for compiling:
GOOS=linux GOARCH=amd64 go build -o plugin.exe plugin.go

Works perfectly. Thanks a lot for your help