ServicePattern / MobileAPI_Android

Messaging API library and example for Android mobile platform
1 stars 1 forks source link

Demo crashes immediately after entering credentials #20

Closed bramley-stride closed 3 years ago

bramley-stride commented 3 years ago

After entering the provided credentials, the app immediately crashes. Logcat output:

2021-04-05 11:26:47.918 7449-7516/com.brightpattern.chatdemo E/Volley: [550] BasicNetwork.performRequest: Unexpected response code 403 for https://alvm.bugfocus.com/clientweb/api/v2/availability?tenantUrl=https://webjet.dev.bugfocus.com
2021-04-05 11:26:47.924 7449-7449/com.brightpattern.chatdemo D/AndroidRuntime: Shutting down VM
2021-04-05 11:26:47.927 7449-7449/com.brightpattern.chatdemo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.brightpattern.chatdemo, PID: 7449
    java.lang.NullPointerException: it.localizedMessage must not be null
        at com.brightpattern.bpcontactcenter.ContactCenterCommunicator$checkAvailability$2.onErrorResponse(ContactCenterCommunicator.kt:129)
        at com.android.volley.Request.deliverError(Request.java:617)
        at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:104)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
2021-04-05 11:26:47.982 7449-7449/com.brightpattern.chatdemo I/Process: Sending signal. PID: 7449 SIG: 9

After changing this line https://github.com/ServicePattern/MobileAPI_Android/blob/1445990f4f2303dd1f45c4fee5026f67383261c6/BPContactCenter/src/main/java/com/brightpattern/bpcontactcenter/ContactCenterCommunicator.kt#L129 to completion.invoke(Failure(ContactCenterError.CommonCCError(it.toString()))) I am still unable to use the demo due to the http 403 authorization error. These same credentials did work on Wednesday 24th March. Using latest master 673f8de

bramley-stride commented 3 years ago

After spending some time digging, it turns out that baseUrl MUST start with https, and tenantUrl MUST NOT start with https. Your URLProvider class validates the baseUrl but not the tenantUrl. The nullable localizedMessage crash should probably still be fixed tho.