User_groups_list function returns groups with nil fields

Hello, I’m using Nakama sdk 3.9.0 for Unity game and now adding groups functionality. I just run the example from your website to get user groups, but for some reason it returns nil fields (name, id…). At Nakama Console I see that groups have ids and names, but function is not working correctly.

Code I’m using:

local nk = require(“nakama”)

local function UpdateGroupMetadata(context, payload)

local user_id = "8686545f-af1d-4e44-b045-44f0a5931136"
local groups = nk.user_groups_list(user_id)
for _, g in ipairs(groups) do
  local msg = string.format("User has state %q in group %q", g.state, g.name)
  nk.logger_info(msg)
end
return nk.json_encode({["success"] = true})

end
nk.register_rpc(UpdateGroupMetadata, “UpdateGroupMetadata”)

Result in terminal:

In Nakama Console I see all groups information including ids and names.

Please help…

@electricpunch Can you share the Nakama server version as well? Your issue is with server-side code, so it would help to know the server version.

Thanks for reply. Nakama server version is nakama:3.17.1

Just tried to clear all data and install the server with latest docker-compose.yml file (cockroach:latest-v23.1, nakama:3.19.0), the same problem…

Each result has 2 top-level fields: state which is the membership type of the user to the group (member, admin etc) and group which is the group data itself.

The correct way to access the group fields in your iteration is:

local msg = string.format("User has state %q in group %q", g.state, g.group.name)

We’ll make sure the documentation correctly reflects this. :bowing_man: