In our plugin code we’re checking an error returned from group creation. We need to import Nakama server module to be able to inspect if an error is of type that is expected.
import (
"github.com/heroiclabs/nakama/v3/server"
)
func CreateTeam(ctx context.Context,
logger runtime.Logger,
db *sql.DB,
nk runtime.NakamaModule,
payload string) (string, error) {
// ...
group, err := nk.createGroup(ctx, ...)
if errors.Is(err, server.ErrGroupNameInUse) {
// Group already exists (this is sometimes expected)
// Handle, e.g. try a different name
} else {
// Unexpected error
return "", err
}
// ...
}
In our Docker compose file we have
nakama:
container_name: nakama
image: heroiclabs/nakama:3.5.0
That is, we’re using Nakama server version 3.5.0 so in our plugin’s go.mod we’ve put
require (
...
github.com/heroiclabs/nakama/v3 v3.5.0
...
)
However, when starting up the server we get
{"level":"error","ts":"2021-09-27T07:12:50.027Z","caller":"server/runtime_go.go:2492","msg":"Could not open Go module","path":"/nakama/data/modules/plugin_code.so","error":"plugin.Open(\"/nakama/data/modules/plugin_code\"): plugin was built with a different version of package github.com/heroiclabs/nakama/v3/apigrpc"}
We would have expected this to work since the plugin is referring to the version of the server that the plugin is executed in. Are we doing something wrong or is there a limitation that in the plugin we cannot refer to public variables of the server module?