medic/cht-gateway

Enable Polling fails with no clear message to user

ngaruko opened this issue · 2 comments

Instructions

If reporting a bug, please fill in the template below. This instructional section should be deleted before submitting the issue.

Log files

Please do not include log files with issue reports. Log files are _very_helpful, and sometimes essential for tracking down and fixing bugs in the software. However, they may contain personal information including the phone numbers of users interacting with the gateway, or contents of the SMS messages that the gateway has sent and received.

Device details

For each device, please fill in a column of the Device(s) tested table.


Device(s) tested

key value(s)
medic-gateway version _master _
device make Samsung
device model AO15F
can the problem be recreated on this device? _yes _

Observed behaviour

When I install the gateway, then select Enable Polling

Expected behaviour

I would expect to be connected to the instance...

Steps to recreate

  1. Install gateway and open...
  2. On the server url connection screen, enter a valid server url,
  3. select Enable polling
  4. press save and see the error :
    image

Logs (in logcat, no error in API logs)

2021-04-20 11:38:23.437 17356-17986/medic.gateway.alert.generic I/MedicGateway: Exception caught while trying to validate server URL: https://gamma-b.dev.medicmobile.org :: org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
    org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
        at org.json.JSON.typeMismatch(JSON.java:112)
        at org.json.JSONObject.<init>(JSONObject.java:168)
        at org.json.JSONObject.<init>(JSONObject.java:181)
        at medic.gateway.alert.JsonResponse.<init>(SimpleJsonClient2.java:306)
        at medic.gateway.alert.SimpleJsonClient2.responseFrom(SimpleJsonClient2.java:140)
        at medic.gateway.alert.SimpleJsonClient2.get(SimpleJsonClient2.java:54)
        at medic.gateway.alert.SimpleJsonClient2.get(SimpleJsonClient2.java:44)
        at medic.gateway.alert.WebappUrlVerifier.verify(WebappUrlVerifier.java:31)
        at medic.gateway.alert.SettingsDialogActivity$SaveTask.doInBackground(SettingsDialogActivity.java:333)
        at medic.gateway.alert.SettingsDialogActivity$SaveTask.doInBackground(SettingsDialogActivity.java:325)
        at android.os.AsyncTask$3.call(AsyncTask.java:378)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

Not sure if it is linked to #108

@ngaruko can you try an url like: https://[user]:[password]@gamma-b.dev.medicmobile.org/api/sms

Sample: https://admin:pass@gamma-b.dev.medicmobile.org/api/sms
Because it needs to authenticate in the server.

I usually use this type of URL. I'm not sure if any other is valid, let me know if anything :)

@latin-panda _ it works with that. Thanks. Will close it as non-issue