B4J Question Strange behavior on VPS if i make a post request with httpsutils

Alexander Stolte

Expert
Licensed User
Longtime User
I have the following code:
B4X:
Dim url As String = $"https://identitytoolkit.googleapis.com/v1/accounts:resetPassword?key=${API_KEY}"$
Dim json As JSONGenerator
json.Initialize(CreateMap("oobCode":oobCode))
Dim j As HttpJob : j.Initialize("",Me)
j.PostString(url,json.ToString)
j.GetRequest.SetContentType("application/json")
    
Wait For (j) JobDone(j As HttpJob)
If i run it local on my pc it works as expected, but if i run it on my VPS then the following error message is returned by Firebase:
B4X:
ResponseError. Reason: , Response: {
  "error": {
    "code": 400,
    "message": "MISSING_OOB_CODE",
    "errors": [
      {
        "message": "MISSING_OOB_CODE",
        "domain": "global",
        "reason": "invalid"
      }
    ]
  }
}
The crazy thing is, it happens only every 2-4 times, sometimes more than once in a row, but in the logging I see that the data that is transmitted is always the right one.
OS: Ubuntu 20.04 (64 Bit) non-ui
Has anyone ever had these problems on a server?
 

Alexander Stolte

Expert
Licensed User
Longtime User
Are you making multiple connections at once?
In live mode yes, but in my test locally and then on the server I am the only one who has only made one request.
Better to set the relevant handler to be a single thread handler.
Let me try it out.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
I'm not sure that it is related to this error. You will need to make more tests.
After some tests with several devices, I can say that this was the reason. As soon as I switch the MutliThread Handler again the errors come back.

I execute the code in a different class than the handler and wait for the result, can this be the error?
 
Upvote 0
Top