heroiclabs / nakama-godot

Godot client for Nakama server written in GDScript.
Apache License 2.0
592 stars 69 forks source link

Getting Request 1 failed with result: 13, response code: 0 on client.authenticate_email_async(email, password) #204

Closed TheBloodhoundBoy closed 5 months ago

TheBloodhoundBoy commented 5 months ago

We are experiencing a peculiar issue with authentication on the Nakama server in our game:

Regardless of the method used, be it authenticate_device_async or via email, it only works partially. It seems to work on roughly 50% of the devices/networks we test.

For the devices/networks where it works, we receive the message "Successful authenticated." However, for the other 50%, we receive the message "failed with result: 13, response code: 0."

Interestingly, when we set a breakpoint at this point and then continue, the request works, and the client is successfully authenticated: (File:res://addons/com.heroiclabs.nakama/client/NakamaHTTPAdapter.gd) godot

Logs: godot logs

Versions used: nakama-godot 3.3.1 Godot 4.1.3, 4.2.1

TheBloodhoundBoy commented 5 months ago

Update: A python script with the same authentication data as Godot works on all clients (working and non-working with nakama-godot):

import requests
import json

url = "https://example.com:443/v2/account/authenticate/device?create=true"

payload = json.dumps({
  "id": "{<device id>}"
})
headers = {
  'Authorization': '<Auth token>',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

The response is a json with the token and the refresh token, so it must be something with nakama-godot or Godot. Interestingly, authentication via Nakama-Godot works on one device across two networks, only in one network. However, the Python script works in both cases. Edit: Now also testet on nakam-godot 3.4.0. The version does not solve the problem.

lugehorsam commented 5 months ago

@TheBloodhoundBoy do you get this issue when you connect to a locally running instance of the server via Docker? How are you hosting the server?

TheBloodhoundBoy commented 5 months ago

@lugehorsam We haven't tested it as a local instance yet, but we will, thanks for the suggestion! However, I have a feeling that it will work locally. We're hosting the server in the cloud as a Docker compose instance on an Ubuntu server. HTTP Response Server Field: nginx/1.18.0 (Ubuntu)

lugehorsam commented 5 months ago

@TheBloodhoundBoy I think if it works locally then this sounds like an issue with your custom infrastructure setup. We aren't able to help with that but recommend a development tier Heroic Cloud (https://heroiclabs.com/heroic-cloud/) for testing your server over the internet.