android
android copied to clipboard
Nextcloud for Android Crash with Error: Host parameter is null
⚠️ Before posting ⚠️
- [X] This is a bug, not a question or an enhancement.
- [X] I've searched for similar issues and didn't find a duplicate.
- [X] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [X] I agree to follow Nextcloud's Code of Conduct.
Steps to reproduce
- Set up a nextcloud instance
- Proxy it behind a reverse proxy (specifically boringproxy in my case)
- Connect using the android app
Expected behaviour
App loads and allows access to files
Actual behaviour
App crashes with error:
Cause of error
Exception in thread "Thread-3" java.lang.IllegalArgumentException: host parameter is null
at org.apache.commons.httpclient.HttpConnection.<init>(HttpConnection.java:206)
at org.apache.commons.httpclient.HttpConnection.<init>(HttpConnection.java:155)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionWithReference.<init>(MultiThreadedHttpConnectionManager.java:1145)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ConnectionPool.createConnection(MultiThreadedHttpConnectionManager.java:762)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConnection(MultiThreadedHttpConnectionManager.java:476)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnectionWithTimeout(MultiThreadedHttpConnectionManager.java:416)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:153)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at com.owncloud.android.lib.common.OwnCloudClient.executeMethod(OwnCloudClient.java:195)
at com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation.run(GetCapabilitiesRemoteOperation.java:256)
at com.owncloud.android.lib.common.operations.RemoteOperation.execute(RemoteOperation.java:204)
at com.owncloud.android.operations.GetCapabilitiesOperation.run(GetCapabilitiesOperation.java:48)
at com.owncloud.android.lib.common.operations.RemoteOperation.execute(RemoteOperation.java:143)
at com.owncloud.android.lib.common.operations.RemoteOperation.execute(RemoteOperation.java:152)
at com.owncloud.android.operations.common.SyncOperation.execute(SyncOperation.java:64)
at com.owncloud.android.ui.activity.DrawerActivity.lambda$fetchExternalLinks$5$com-owncloud-android-ui-activity-DrawerActivity(DrawerActivity.java:1156)
at com.owncloud.android.ui.activity.DrawerActivity$$ExternalSyntheticLambda6.run(Unknown Source:4)
at java.lang.Thread.run(Thread.java:919)
App information
- ID:
com.nextcloud.client - Version:
30210090 - Build flavor:
gplay
Device information
- Brand:
motorola - Device:
ginna - Model:
moto e - Id:
QPGS30.82-141-15-4 - Product:
ginna_retail
Firmware
- SDK:
29 - Release:
10 - Incremental:
47077
Android version
10
Device brand and model
Motorola Moto e
Stock or custom OS?
Stock
Nextcloud android app version
3.21.0
Nextcloud server version
24.0.3
Using a reverse proxy?
Yes
Android logs
No response
Server error logs
No response
Additional information
No logs available. I'm running stock android with Google Family link (no rooting/Dev options)
I believe this error is being caused by boringproxy rather than Nextcloud, but Nextcloud should have some form of try catch in case the Host header is null.
I was reffered to this error report by the app when it crashed.
When does the app crash? Before or after login?
The app crashes after login
To provide more info, I've reset my Nextcloud for Android. Here's the exact steps taken to reproduce the issue:
- Press log in
- Input my self-hosted address (eg nextcloud.example.com)
- Press log in again, to confirm I do want to give Nextcloud access to Nextcloud
- Input my Nextcloud username and password
- Press Grant Access to finish log in process
- App crashes with the above-given error log and the option to report the issue on GitHub
I had the same issue.Is there any solution?
I think the key is the reverse proxy,I met this problem after I use a reverse proxy writen by myself
This appears to have been an issue with boringproxy not fully/properly handling the Host: HTTP header. The issue on their end is still open but a probable fix was merged awhile ago it looks like.
One could argue we could handle it cleaner, but:
- we'd still fail hard since it's a broken thing the app can't do anything about (and a 100% showstopper preventing the app from proceeding)
- we detected the bogus state properly (that's the point of
IllegalArgumentExceptionessentially)
I'm going to close this. If someone gets bored and feels like adding a fancy pop-up error message about a low likelihood event... Feel free. But I'm not sure telling an end-user to fix their Host: header is really going to be productive IMO.