Debug runtime code

Hi is there a way to debug runtime code? By debugging I mean attaching a debugger and adding breakpoints/inspecting execution. Yesterday I had a hard time figuring out issues with my runtime code which I could have easily solved in debugger mode

1 Like

Hi @laimonas welcome :wave:

Which language do you use with the server runtime? There’s a way to attach the Delve debugger to your Go code but at the moment there’s no way to attach the debugger to the Lua virtual machine inside the game server.

1 Like

Hey thank you for the reply :slight_smile: So far I’ve been writing runtime code in Lua but if theere’s no debugging option for it I’ll probably switch to Go. Are there known technical limitations as to why Lua debugging is not supported and are there plans to support Lua debugging in the future?

@laimonas The main challenge with debugger support for Lua in Nakama is that the virtual machine implementation is in pure Go. We’d need to implement the symbol analysis and debug data capture to support live stack and heap inspection.

Perhaps we’ll tackle it in the future but right now we’re focused on JavaScript support as another scripting language which developers can use to write server logic in. You can see progress on it on GitHub.

Thanks for clarifying :slight_smile:

1 Like

Hi! What about debug javascript server logic?

Hello @formatCvt. Currently, we have support for javascript but not to the extend required to use debuggers. The debugging limitations presented by @novabyte apply to this runtime too.

To allow you to test the code, maybe you could use a test-oriented approach by leveraging mocking libraries, such as ts-jest or ts-auto-mock . It would allow you to stub the runtime calls and assert over their args.

Could you send me the docker & docker compose files because I couldn’t manage to work with delve.

1 Like

Hello. Is there a way to use debugger in WebStorm or any IDE now?. It doesn’t matter with or without docker. (JavaScript)

Hello @Faircyan , there’s still no support for debuggers on the javascript runtime. See @flavio’s post above.

1 Like

yep, goja (the JS engine Nakama uses) have no debugger support, but they working on it Goja debugger · Issue #294 · dop251/goja · GitHub

1 Like

Even the current jest, although already good for test code, is still looking forward to the JS debugging support.