Can someone help with an error I am getting when trying to create a match

Hi,

I have an RPC function called findOrCreateMatch.

Which I have taken from this example https :

heroiclabs.com/docs/nakama/concepts/server-authoritative-multiplayer/`

function findOrCreateMatch(context: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama): string {
    const limit = 10
    const isAuthoritative = true;
    const label = "skill=100-150";
    const minSize = 0
    const maxSize = 4;
    var matches = nk.matchList(limit, isAuthoritative, label, minSize, maxSize, "");
    // If matches exist, sort by match size and return the largest.
    if (matches.length > 0) {
        matches.sort((a, b) => a.size >= b.size ? 1 : -1);
        return matches[0].matchId;
    }
    // If no matches exist, create a new one using the "lobby" module and return it's ID.
    var matchId = nk.matchCreate('supermatch', {});
    return JSON.stringify({ matchId });
}

But when I call it on the client side, I get the same error :

GoError: error creating match: error creating match: not found at github.com/heroiclabs/nakama/v3/server.(*runtimeJavascriptNakamaModule).matchCreate.func1 (native)
UnityEngine.Debug:LogWarning (object)

Can you please advise how I can create a game by the server?

@Ahmad2021 Authoritative multiplayer requires match modules to be registered, in your case you’re asking the server to start a match using a module registered as "supermatch". Does this exist in your setup?

If you’re looking for a complete example you can find it in the Nakama Project Template. match_handler.ts and main.ts (line 23) are most relevant. :+1: