Error in Custom Authentication

Hi I’m using Unity 2020.3.11 and Nakama 2.9.2 Unity SDK. My server is running on Nakama 3.3.0 and JS.

I’m using a webservice that will give a unique id to the user who login on my Game. It’s working fine as expected. But sometimes. I’m facing issue on the server while authenticating new account.

{“level”:“error”,“ts”:“2021-06-16T13:17:44.346Z”,“caller”:“server/core_authenticate.go:119”,“msg”:“Error looking up user by custom ID.”,“error”:“context canceled”,“customID”:“ludodealplayer-4833”,“username”:“xJukIFZfof”,“create”:true}

I’m not sure why I’m getting this error. and it’s not happening on every signups. it’s happening in some rare case. but at that time my whole server gets crashed and all the match are closing.

My Unity Code Snippet:

if (!string.IsNullOrEmpty(GameManager.Instance.CustomId))
{
GameManager.Instance.Session =
await GameManager.Instance.Client.AuthenticateCustomAsync(“ludodealplayer-” +
GameManager.Instance.CustomId);
//Debug.LogFormat(“New user: {0}, {1}”, GameManager.Instance.Session.Created, GameManager.Instance.Session);
GameManager.Instance.uniqueId = GameManager.Instance.Session.UserId;
await GameManager.Instance.Socket.ConnectAsync(GameManager.Instance.Session, true, 5);
}

Is there is any possibility to stop the match close and socket disconnect due to this error. because this error is totally out of the match state. but still it’s disconnecting the whole player from the server.

@ragavendranbala That error cannot crash the server - it just means the request took long enough that the server’s timeout kicked in and cancelled the request. I’m not sure how you’ve set up your server and database but it could indicate insufficient resources, bad config, bad runtime code (for example do you have custom runtime code that uses raw SQL queries?) or various other issues.

If your server is indeed crashing this will not be the reason. Look for panics or fatal errors in either your logs or stdout capture, based on your particular setup.

@zyro
I’m using Linq module(npm install linq) for iterating over the players based on userID.

config.txt (1.3 KB)
docker-compose.txt (1.1 KB)

These are the docker compose file and config file i have set the logger level to error. and i haven’t seen errors other than this. For panics and fatal, should i need to change the logger level?

I’m using a webservice that will give a unique id to the user who login on my Game.

@ragavendranbala is this webservice some kind of central identity or central player accounts system? How long do network calls to that service typically take? Do you have application performance metrics you can look at for that service to indicate whether it might be slow?

It’s also not possible to help with your project just with the Docker compose and configuration files. You’re running the servers yourself so it’s up to you to ensure you’ve provisioned the right hardware and have the database and game server on their own dedicated resources. An alternative if you’re at a point where the project will be in production is to look at the Heroic Cloud where the infrastructure can be managed and optimized for you.