Closed heapwalker closed 8 years ago
Btw, here is the server log I captured from Skygear Developer Portal after a test case I made, with some private info replaced with *****
2016-06-29 18:03:46 X-Forwarded-Port: [80]
2016-06-29 18:03:46 X-Skygear-Api-Key: [*****]
2016-06-29 18:03:46 Opening DBConn: {pq skygearprototype postgresql://*****:*****@*****}
2016-06-29 18:03:46 {\"action\":\"auth:signup\",\"username\":\"ryanpang3\",\"email\":null,\"password\":\"*****\",\"api_key\":\"*****\"}
2016-06-29 18:03:46 Connection: [close]
2016-06-29 18:03:46 Content-Type: [application/json]
2016-06-29 18:03:46 User-Agent: [Dalvik/1.6.0 (Linux; U; Android 4.3; C5303 Build/12.1.A.1.207)]
2016-06-29 18:03:46 Accept-Encoding: [gzip]
2016-06-29 18:03:46 POST /auth/signup
2016-06-29 18:03:46 ------ Request: ------
2016-06-29 18:03:46 X-Forwarded-For: [172.20.44.35]
2016-06-29 18:03:46 ------ Header: ------
2016-06-29 18:03:46 Get DB OK
2016-06-29 18:03:46 X-Forwarded-Proto: [http]
2016-06-29 18:03:46 Content-Length: [127]
2016-06-29 18:03:49 Opening DBConn: {pq skygearprototype postgresql://*****:*****@*****}
2016-06-29 18:03:49 X-Skygear-Api-Key: [*****]
2016-06-29 18:03:49 Connection: [close]
2016-06-29 18:03:49 Get DB OK
2016-06-29 18:03:49 User-Agent: [Dalvik/1.6.0 (Linux; U; Android 4.3; C5303 Build/12.1.A.1.207)]
2016-06-29 18:03:49 Content-Length: [127]
2016-06-29 18:03:49 Accept-Encoding: [gzip]
2016-06-29 18:03:49 Content-Type: [application/json]
2016-06-29 18:03:49 POST /auth/signup
2016-06-29 18:03:49 ------ Request: ------
2016-06-29 18:03:49 X-Forwarded-For: [10.2.4.0]
2016-06-29 18:03:49 ------ Header: ------
2016-06-29 18:03:49 {\"action\":\"auth:signup\",\"username\":\"ryanpang3\",\"email\":null,\"password\":\"*****\",\"api_key\":\"*****\"}
2016-06-29 18:03:49 X-Forwarded-Proto: [http]
2016-06-29 18:03:49 X-Forwarded-Port: [80]
@cpryanpang Do you think it is related to auth provider? I remember skygearprototype is using facebook auth provider.
@rickmak How do I determine? What/Where should I check?
I I think @cpandrewchung or @cpdavidng can advise on the where is the repos hosted? Since you are using https://skygearprototype.staging.skygeario.com/
I have figured out the reason: the web service request elapsed too long and Android Volley
library timeout-ed the request. That's why, as described above, on server side an user record with my username was created, but on client side the app failed to receive anything
FYR, below is how I figured out the reason:
// class io.skygear.skygear.Request
@Override
public void onErrorResponse(VolleyError error) {
+ Log.d("Request", "#onErrorResponse " + error.toString());
// ...
}
The logcat output:
07-05 12:50:41.582 30644-30644/io.skygear.skygear_example D/Request: #onErrorResponse com.android.volley.TimeoutError
The default timeout limit is 2.5 second (com.android.volley.DefaultRetryPolicy.DEFAULT_TIMEOUT_MS
)
Following http://stackoverflow.com/questions/17094718/change-volley-timeout-duration , below is my quick tuning to enlarge the timeout limit and prove the timeout is really the key reason:
// class io.skygear.skygear.RequestManager
public void sendRequest(final Request request) {
// ...
JsonObjectRequest jsonRequest = new JsonRequest(
url,
new JSONObject(data),
this.getExtraHeaders(),
request,
request
);
+ jsonRequest.setRetryPolicy(new DefaultRetryPolicy(
+ 10 * 1000,
+ DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
+ DefaultRetryPolicy.DEFAULT_BACKOFF_MULT
+ ));
// ...
}
I think It would be good if the SDK provide some setter functions to allows us adjust such timeout (and possibly the retry count)?
Let add a standard way to set the time out in coming release first. For retry, I think it will better to handle by application code? I believe the application will want to prompt for user that the internet have some problem and we are retrying.
Right, I go along with you. Thx :)
At Sign Up procedure, SDK invoked onAuthFail callback while a user record is created on server DB. From logcat, such error message appears after android fire a web service request:
Steps to reproduce:
io.skygear.skygear_example.MyApplication
, specify the correct Endpoint and API Key.SignupActivity
, fill the username and password.SignupActivity#doSignup
, at theonAuthFail
callback):Server DB Data
However, when I log into server's postgresql, I see that the user record with my username was created. I am not sure whether the SDK really faced some (network) error
Control Trial
The same outcome would occur even I created a new Android Studio project and import the SDK via gradle: