After updating my nakama server from 3.23 to 3.25 I obviously had to rebuild my go runtime. I changed the version of that and rebuilt with runtime 1.35 and deployed it to my server. When I restarted my docker container it picked up the new backend.so file but reported “plugin was built with a different version of package runtime”.
I created a clean new project for the runtime as described here: Go Runtime - Heroic Labs Documentation
Built and deployed that, but still received the same errors. This is the log of the server from startup:
+ exec /nakama/nakama --name nakama1 --database.address root@cockroachdb:26257 --metrics.prometheus_port 9100 --config /nakama/data/my-config.yml
INF server/config.go:93 > ts=2025-01-09T12:42:22.568Z msg=Successfully loaded config file path=/nakama/data/my-config.yml
WRN server/config.go:333 > ts=2025-01-09T12:42:22.568Z msg=WARNING: insecure default parameter value, change this for production! param=console.signing_key
WRN server/config.go:341 > ts=2025-01-09T12:42:22.568Z msg=WARNING: insecure default parameter value, change this for production! param=session.encryption_key
WRN server/config.go:345 > ts=2025-01-09T12:42:22.568Z msg=WARNING: insecure default parameter value, change this for production! param=session.refresh_encryption_key
WRN server/config.go:349 > ts=2025-01-09T12:42:22.568Z msg=WARNING: insecure default parameter value, change this for production! param=runtime.http_key
INF main.go:140 > ts=2025-01-09T12:42:22.568Z msg=Nakama starting
INF main.go:141 > ts=2025-01-09T12:42:22.568Z msg=Node name=nakama1 version=3.25.0+592b52c6 runtime=go1.23.3 cpu=12 proc=12
INF main.go:142 > ts=2025-01-09T12:42:22.568Z msg=Data directory path=./data/
INF main.go:153 > ts=2025-01-09T12:42:22.568Z msg=Database connections dsns=["root@cockroachdb:26257"]
DBG server/db.go:116 > ts=2025-01-09T12:42:22.569Z msg=Complete database connection URL raw_url=postgres://root@cockroachdb:26257/nakama?sslmode=prefer
INF server/db.go:140 > ts=2025-01-09T12:42:22.572Z msg=Database information version=CockroachDB CCL v23.1.25 (x86_64-pc-linux-gnu, built 2024/08/13 17:55:29, go1.19.13)
INF server/metrics.go:178 > ts=2025-01-09T12:42:22.574Z msg=Starting Prometheus server for metrics requests port=9100
INF server/leaderboard_rank_cache.go:140 > ts=2025-01-09T12:42:22.577Z msg=Initializing leaderboard rank cache
INF server/runtime.go:655 > ts=2025-01-09T12:42:22.577Z msg=Initialising runtime path=data/modules
INF server/leaderboard_rank_cache.go:201 > ts=2025-01-09T12:42:22.577Z msg=Leaderboard rank cache initialization completed successfully cached=[] skipped=[] duration=68.441µs
INF server/runtime.go:662 > ts=2025-01-09T12:42:22.577Z msg=Initialising runtime event queue processor
INF server/runtime.go:664 > ts=2025-01-09T12:42:22.577Z msg=Runtime event queue processor started size=65536 workers=8
INF server/runtime_go.go:2900 > ts=2025-01-09T12:42:22.577Z msg=Initialising Go runtime provider path=data/modules
ERR server/runtime_go.go:2996 > ts=2025-01-09T12:42:22.582Z msg=Could not open Go module path=data/modules/backend.so error=plugin.Open("data/modules/backend"): plugin was built with a different version of package runtime
ERR server/runtime.go:670 > ts=2025-01-09T12:42:22.582Z msg=Error initialising Go runtime provider error=plugin.Open("data/modules/backend"): plugin was built with a different version of package runtime
fatal main.go:201 > ts=2025-01-09T12:42:22.582Z msg=Failed initializing runtime modules error=plugin.Open("data/modules/backend"): plugin was built with a different version of package runtime
The go.sum shows that the correct version of the runtime was used:
github.com/heroiclabs/nakama-common v1.35.0 h1:gO3J2v2E12sZ2uL258lt5YF6yNO1tiPtvL7ZwV8t/n0=
github.com/heroiclabs/nakama-common v1.35.0/go.mod h1:E4kw2QpsINoXXJS7aOjen1dycPkoo9bD9pYPAjmA8rc=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
I did rename the backend.so file to something else to see in the logs if the server actually read the new file or loads an old one but this confirmed the newly built file is used by the server.
Hello @anteaters,
Have you had a look at the dependency pinning guide?
Also make sure you’re running the following to start the Docker containers:
docker compose up --build
Hope this helps
Hi sesposito,
I looked at the guide but that didn’t help. The modules.txt in the vendors dir specifies the correct versions are used:
# github.com/heroiclabs/nakama-common v1.35.0
## explicit; go 1.23.3
github.com/heroiclabs/nakama-common/api
github.com/heroiclabs/nakama-common/rtapi
github.com/heroiclabs/nakama-common/runtime
# google.golang.org/protobuf v1.36.2
## explicit; go 1.21
google.golang.org/protobuf/encoding/prototext
google.golang.org/protobuf/encoding/protowire
google.golang.org/protobuf/internal/descfmt
google.golang.org/protobuf/internal/descopts
google.golang.org/protobuf/internal/detrand
google.golang.org/protobuf/internal/editiondefaults
google.golang.org/protobuf/internal/encoding/defval
google.golang.org/protobuf/internal/encoding/messageset
google.golang.org/protobuf/internal/encoding/tag
google.golang.org/protobuf/internal/encoding/text
google.golang.org/protobuf/internal/errors
google.golang.org/protobuf/internal/filedesc
google.golang.org/protobuf/internal/filetype
google.golang.org/protobuf/internal/flags
google.golang.org/protobuf/internal/genid
google.golang.org/protobuf/internal/impl
google.golang.org/protobuf/internal/order
google.golang.org/protobuf/internal/pragma
google.golang.org/protobuf/internal/protolazy
google.golang.org/protobuf/internal/set
google.golang.org/protobuf/internal/strs
google.golang.org/protobuf/internal/version
google.golang.org/protobuf/proto
google.golang.org/protobuf/reflect/protoreflect
google.golang.org/protobuf/reflect/protoregistry
google.golang.org/protobuf/runtime/protoiface
google.golang.org/protobuf/runtime/protoimpl
google.golang.org/protobuf/types/known/timestamppb
google.golang.org/protobuf/types/known/wrapperspb
I run the nakama server as a stack in portainer. I had it repull the images to redeploy but that did not help. The server stills complains the plugin was built with a different runtime version.
Have you also updated the nakama-pluginbuilder
to the same versions as Nakama in your Dockerfile?
I have not touched that anywhere. I use this stack:
version: '3'
services:
cockroachdb:
image: cockroachdb/cockroach:latest-v23.1
command: start-single-node --insecure --store=attrs=ssd,path=/var/lib/cockroach/
restart: "unless-stopped"
volumes:
- /srv/nakama/db_data:/var/lib/cockroach
expose:
- "8080"
- "26257"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health?ready=1"]
interval: 3s
timeout: 3s
retries: 5
nakama:
image: registry.heroiclabs.com/heroiclabs/nakama:3.25.0
networks:
- www
- default
entrypoint:
- "/bin/sh"
- "-ecx"
- >
/nakama/nakama migrate up --database.address root@cockroachdb:26257 &&
exec /nakama/nakama --name nakama1 --database.address root@cockroachdb:26257 --metrics.prometheus_port 9100 --config /nakama/data/my-config.yml
restart: "unless-stopped"
links:
- "cockroachdb:db"
depends_on:
cockroachdb:
condition: service_healthy
prometheus:
condition: service_started
volumes:
- /srv/nakama/nakama_data:/nakama/data
ports:
- "7349:7349"
- "7350:7350"
# - "7351:7351"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:7350/"]
interval: 10s
timeout: 5s
retries: 5
prometheus:
image: prom/prometheus
entrypoint: /bin/sh -c
command: |
'sh -s <<EOF
cat > ./prometheus.yml <<EON
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: nakama
metrics_path: /
static_configs:
- targets: ['nakama:9100']
EON
prometheus --config.file=./prometheus.yml
EOF'
restart: "unless-stopped"
expose:
- 9090
networks:
www:
external: true
and throw my backend.so into the modules directory. This worked fine in 3.23. Do I have to build the docker image myself instead of pulling it from your registry to be able to use the go-runtime?
I think the issue is that perhaps your Go local version is different from the one that was used to build Nakama (go 1.23.3
).
We recommend you build the plugin using our plugin-builder Docker image so that we ensure that all those things match, you can see an example here.
I downloaded go.1.23.3 and re-vendored and built the library. The modules.txt recognized the lowered version:
# github.com/heroiclabs/nakama-common v1.35.0
## explicit; go 1.23.3
github.com/heroiclabs/nakama-common/api
github.com/heroiclabs/nakama-common/rtapi
github.com/heroiclabs/nakama-common/runtime
# google.golang.org/protobuf v1.35.2
## explicit; go 1.21
google.golang.org/protobuf/encoding/prototext
google.golang.org/protobuf/encoding/protowire
google.golang.org/protobuf/internal/descfmt
google.golang.org/protobuf/internal/descopts
google.golang.org/protobuf/internal/detrand
google.golang.org/protobuf/internal/editiondefaults
google.golang.org/protobuf/internal/encoding/defval
google.golang.org/protobuf/internal/encoding/messageset
google.golang.org/protobuf/internal/encoding/tag
google.golang.org/protobuf/internal/encoding/text
google.golang.org/protobuf/internal/errors
google.golang.org/protobuf/internal/filedesc
google.golang.org/protobuf/internal/filetype
google.golang.org/protobuf/internal/flags
google.golang.org/protobuf/internal/genid
google.golang.org/protobuf/internal/impl
google.golang.org/protobuf/internal/order
google.golang.org/protobuf/internal/pragma
google.golang.org/protobuf/internal/set
google.golang.org/protobuf/internal/strs
google.golang.org/protobuf/internal/version
google.golang.org/protobuf/proto
google.golang.org/protobuf/reflect/protoreflect
google.golang.org/protobuf/reflect/protoregistry
google.golang.org/protobuf/runtime/protoiface
google.golang.org/protobuf/runtime/protoimpl
google.golang.org/protobuf/types/known/timestamppb
google.golang.org/protobuf/types/known/wrapperspb
But to no avail. I’ll give the lua or js runtimes a try instead.