Problems debugging using delve

Hi, im trying to get delve up and running in my project.

Using the guide from https://heroiclabs.com/docs/nakama/guides/server-framework/debugging-with-delve/vscode-debugger/

…I get the following error when starting the containers:

nakama_1 | could not launch process: fork/exec /nakama/nakama: function not implemented

Any ideas of how to resolve this?

Hello @gruset,

Looking at the docs I believe /nakama/nakama is the incorrect path to the binary fed to dlv, could you retry by using a relative path nakama instead?

@sesposito
Hello, I wanted to post the same thing and saw this post (so don’t want to duplicate).
The path to nakama executable is correct, I also followed the very same document.
getting the same error.
If you enter incorrect path to nakama executable you will get:

could not launch process: open /nakama/nakamda: no such file or directory

Below are outputs of pwd and ls -la commands.

root@4f96b24b96e3:/nakama# pwd
/nakama
root@4f96b24b96e3:/nakama# ls -la
total 81128
drwxr-xr-x 1 root root 4096 Aug 14 14:50 .
drwxr-xr-x 1 root root 4096 Aug 14 19:38 …
drwxr-xr-x 1 root root 4096 Aug 14 19:37 data
-rwxr-xr-x 1 root root 18071261 Aug 14 14:50 dlv
-rwxr-xr-x 1 root root 64984552 Apr 18 18:42 nakama

I found the problem and solution.
The problem is that I am using macos (silicone) and nakana image does not have tag for arm:

http://registry.heroiclabs.com/heroiclabs/nakama-dsym:3.16.0

As I found out that’s creating problem with debugging capabilities using delve.

The solution:

Build your plugin-builder and Nakama image suitable for arm architecture.

git clone git@github.com:heroiclabs/nakama.git
git checkout {your_specific_version} e.g v3.16.0
cd build

in Dockerfile.dsym: change ENV GOARCH amd64 to ENV GOARCH arm64

docker build "$PWD" --platform "linux/arm64" --file ./Dockerfile.dsym --build-arg commit="$(git rev-parse --short HEAD 2>/dev/null)" --build-arg version=3.16.0 -t heroiclabs/nakama-dsym:3.16.0

One image is ready, now make plugin-builder;

cd pluginbuilder

in Dockerfile: change ENV GOARCH amd64 to ENV GOARCH arm64

docker build "$PWD" --platform "linux/arm64" --file ./Dockerfile --build-arg commit="$(git rev-parse --short HEAD 2>/dev/null)" --build-arg version=3.16.0 -t heroiclabs/nakama-pluginbuilder-custom:3.16.0

use your freshly built images in your Dockerfile.

This is the link I used for building images:

https://github.com/heroiclabs/nakama/tree/master/build

regarding actual breakpoint in code:
I was unable to use breakpoints like it’s mentioned in the document (wanted to place a link but some restrictions…)
instead placed:

runtime.Breakpoint()

but as runtime is imported as Nakama package had to import and use it like this

import (
	rt "runtime"
)
func InitModule(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, initializer runtime.Initializer) error {
	rt.Breakpoint()

Hope this helps anyone.