Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Chris Molozian
@novabyte
And with Lua I should probably write something detailed up on how to go about testing
can you ask the question on the forums and I'll put my notes there?
Thanks @fsufyan do you think it's something I should incorporate into the next client sdk release? Make it clearer how to set the various SSL cert versions the client sdk will be allowed to accept?
Cameron Hall
@CamDHall
@novabyte as I commented on the Github issue, I'm not just running "client.NewSocket()". I'm using the exact code in the docs. With the Connected and Closed listeners and ConnectAsync being called. There's nothing different about our Unity code, except we're using " UnityWebRequestAdapter.Instance" per your suggestion. Our token is set to expire after 8 minutes. I pull this out and put it in a test project with no other code, and I get the same results.
@novabyte I can confirm it creates the user successfully, with no errors.
Mohsen
@mohsenyz
Hello guys, I was looking in my leaderboard records, in database. I wondered that there were records assigned to usernames that didn't belong to anyone. For example, there was a record submitted by user X, while there is not any user named X. In my scenario, users have a default username before registration, and after registration, the username changes by the user. I think leaderboard records are not updated after updating the username, leading me to this issue, Am I right?
Now I'm almost sure that updating account doesn't update leaderboard records, I checked the records owner id, It belongs to a valid user, with a valid username Y. while still record username is X
Chris Molozian
@novabyte
@CamDHall How are you running the server at the moment? Is it behind a load balancer or proxy of some kind?
@mohsenyz Yes leaderboard records are not retroactively updated after the user changes their username. The username field in the entry is cached and replaced only on a new score submission
As you can imagine the performance would be terrible if we retroactively updated all old leaderboard records for a user any time they update their username
Cameron Hall
@CamDHall
@novabyte yes it's behind an nginx proxy.
Andrei Mihu
@zyro
@CamDHall The server never sends generic response codes with no reason. What's the reason message in the client error?
Cameron Hall
@CamDHall
400 Bad Request.
Cameron Hall
@CamDHall
08-17 12:22:54.622 30420 30436 E Unity : InvalidHttpResponseCodeException: 400 Bad Request
08-17 12:22:54.622 30420 30436 E Unity : at Nakama.Ninja.WebSockets.WebSocketClientFactory.ThrowIfInvalidResponseCode (System.String responseHeader) [0x00071] in <0b8079027a0346b2a98515fbce966890>:0
08-17 12:22:54.622 30420 30436 E Unity : at Nakama.Ninja.WebSockets.WebSocketClientFactory+<ConnectAsync>d__7.MoveNext () [0x000bd] in <0b8079027a0346b2a98515fbce966890>:0
08-17 12:22:54.622 30420 30436 E Unity : --- End of stack trace from previous location where exception was
Andrei Mihu
@zyro
What version of the client are you using? Make sure you're on 2.2.2
Because all responses will carry a reason, not just a generic "Bad Request"
Cameron Hall
@CamDHall
Yes I'm on 2.2.2. Please reference what I just put up. That's it. That's all I get back from Nakama. I understand what you're saying, but that's all that's actually being thrown.
Andrei Mihu
@zyro
I did reference what you just put up. The reason I stress it is because Unity client versions ~2.2.0 and lower (iirc) had an issue where the error message wasn't parsed out of the response, and this was fixed in 2.2.1+
So it was a common problem to see where the reason message was swallowed before the client presented it to you
If that's not the case then there's something else odd going on
You're going through nginx, right? Have you tried without it - hit Nakama directly?
Cameron Hall
@CamDHall
Yes I'm on "v2.2.2". Unity Version 2019.1.6f1. The difference for the client code is that we're using "UnityWebRequestAdapter.Instance" when we create the client, as without it we run into the Unity libc issue referenced here: heroiclabs/nakama-unity#74
I'm able to create and authenticate users properly. They all show up in the DB. But I can't do anything else until I get the connection working.
Cameron Hall
@CamDHall
Iif I hit it directly I get the same exception.
Chris Molozian
@novabyte
This is very strange it's as though you cannot reach the /ws endpoint with the right input arguments
What happens if you just navigate to your server address with the /ws
You should see an error from Nakama about an invalid session token
can you confirm you get that error?
Cameron Hall
@CamDHall
Yes. I get "Missing or invalid token"
Chris Molozian
@novabyte
Ok that's good
can you send me the output of session.AuthToken field?
I'd like to decode the session token and inspect the contents
Cameron Hall
@CamDHall
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NjYwNjI2MzQsInVpZCI6IjI1ODExYWI1LTM1YzctNDU5OC04Zjk1LWU5MzZjMGU4MmEzMiIsInVzbiI6IkZyRmpNUXRPV1kifQ.9Wu-YJOiA8lacUxuMP9qOsZds3qef0Cf7vlFxRvzjzI"
Chris Molozian
@novabyte
Ok it looks like the token is valid:
{
  "exp": 1566062634,
  "uid": "25811ab5-35c7-4598-8f95-e936c0e82a32",
  "usn": "FrFjMQtOWY"
}
It decodes correctly and the signature verifies against the default signing key
@CamDHall What version of Unity engine do you use?
Cameron Hall
@CamDHall
2019.1.6f1
Chris Molozian
@novabyte
Ok and does the problem occur in editor as well as on device?
Cameron Hall
@CamDHall
I'm not sure. Let me check
Cameron Hall
@CamDHall
Yes it occurs both in editor and on Android
Chris Molozian
@novabyte
Ok I'll test with that version of Unity engine
Chris Molozian
@novabyte
@CamDHall I ran the SDK with this code attached to a game object in Unity engine at 2019.1.6f1 version
using System;
using System.Threading.Tasks;
using Nakama;
using UnityEngine;

public class Example : MonoBehaviour
{
    private IClient _client;
    private ISocket _socket;

    private async void Awake()
    {
        _client = new Client("defaultkey", UnityWebRequestAdapter.Instance);
        _socket = _client.NewSocket();
        _socket.Closed += () => Debug.Log("Socket closed.");
        _socket.Connected += () => Debug.Log("Socket connected.");
        _socket.ReceivedError += e => Debug.LogErrorFormat("Socket error: {0}", e.Message);

        var deviceId = SystemInfo.deviceUniqueIdentifier;
        var session = await _client.AuthenticateDeviceAsync(deviceId);
        await _socket.ConnectAsync(session);
        Debug.Log("After socket connected.");
    }

    private void OnApplicationQuit() => _socket?.CloseAsync();
}
I get no errors at all
I ran it with our docker-compose file using the latest Nakama 2.6.0 release of the server
Cameron Hall
@CamDHall
I have the same code. Still getting a bad request 400 response. Our compose file is back to stock, and I get the same response. Still getting a "missing or invalid token" when I got to the ws endpoint. I'm also on 2.6.0.
Chris Molozian
@novabyte
@CamDHall can you zip up your project or some minimal example I can reproduce the issue with and I'll run it locally?
Cameron Hall
@CamDHall
@novabyte can I dm a zip?
Chris Molozian
@novabyte
Sure :thumbsup: