Closed pern0x closed 8 months ago
@desperateCoder we changed this specific part in the latest version, so I can even without stacktrace tell (thanks though for fetching the logs!), that this happend when calling SyncRepository#refreshCapabilities
. We get an OfflineException
with Reason.OFFLINE
as reason.
@pern0x did you used the Deck Android app before? Is it possible that you changed settings like Sync only on Wi-Fi
in the past? (We should already catch this case, but it helps to know)
@pern0x does the output of curl https://<username>:<passwod>@example.com/ocs/v2.php/cloud/capabilities?format=json -H 'OCS-APIRequest: true'
return some json stuff similar to
{
"ocs": {
"meta": {
"status": "ok",
"statuscode": 200,
"message": "OK"
},
"data": {
"version": {
"major": 28,
"minor": 0,
"micro": 1,
"string": "28.0.1",
"edition": "",
"extendedSupport": false
},
}
}
}
Thanks for the quick reply. I did use the deck app before, but I did not activte wifi only. I have delete the storage of the app and uninstall it complete. After both actions the same message was shown. Here is a part of the response from the curl query: {"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},"data":{"version":{"major":28,"minor":0,"micro":3,"string":"28.0.3","edition":"","extendedSupport":false
The connection is not possible on mobile or on wifi
Are you able to provide a temporary test account on your instance and send the credentials to info@niedermann.it ? This way we might be able to debug the cause.
Hi @pern0x,
I tried it myself with your provided credentials and also got an error. Seems like whoever is answering our request behaves quite strangely:
2024-03-19 12:52:17.823 12432-12651 DeckLog it.niedermann.nextcloud.deck.dev E (RequestHelper.java:94) onFailure() → com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException: HTTP request failed with HTTP status-code: 520
at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.onResponse(RequestHelper.java:70)
at com.nextcloud.android.sso.helper.Retrofit2Helper$1.lambda$enqueue$0(Retrofit2Helper.java:87)
at com.nextcloud.android.sso.helper.Retrofit2Helper$1.$r8$lambda$n0izO5V3AflskH7z1H8dSLmVKXo(Unknown Source:0)
at com.nextcloud.android.sso.helper.Retrofit2Helper$1$$ExternalSyntheticLambda0.run(Unknown Source:6)
at java.lang.Thread.run(Thread.java:920)
Caused by: java.lang.RuntimeException: HTTP StatusCode wasn't 2xx:
Got [HTTP 520] for Call [GET http://localhost//ocs/v2.php/cloud/capabilities] with Message:
[java.lang.IllegalArgumentException: Unexpected char 0xfffd at 6 in X-Content-Security-Policy value: allow ���self���;]
at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.buildCause(RequestHelper.java:87)
... 5 more
2024-03-19 12:52:17.824 12432-12651 DeckLog it.niedermann.nextcloud.deck.dev E (IResponseCallback.java:16) onError() → it.niedermann.nextcloud.deck.exceptions.OfflineException: Connection rejected
at it.niedermann.nextcloud.deck.remote.api.ServerCommunicationErrorHandler$Handler.handle(ServerCommunicationErrorHandler.java:52)
at it.niedermann.nextcloud.deck.remote.api.ServerCommunicationErrorHandler.translateError(ServerCommunicationErrorHandler.java:28)
at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.onFailure(RequestHelper.java:95)
at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.onResponse(RequestHelper.java:70)
at com.nextcloud.android.sso.helper.Retrofit2Helper$1.lambda$enqueue$0(Retrofit2Helper.java:87)
at com.nextcloud.android.sso.helper.Retrofit2Helper$1.$r8$lambda$n0izO5V3AflskH7z1H8dSLmVKXo(Unknown Source:0)
at com.nextcloud.android.sso.helper.Retrofit2Helper$1$$ExternalSyntheticLambda0.run(Unknown Source:6)
at java.lang.Thread.run(Thread.java:920)
Whats interesting here are two parts:
HTTP request failed with HTTP status-code: 520
and
[java.lang.IllegalArgumentException: Unexpected char 0xfffd at 6 in X-Content-Security-Policy value: allow ���self���;]
The funny questionmarks aren't added by me or got added while copying, this is the actual response from the server.
By the HTTP-Status of 520 I guess your server is hidden behind CloudFlare? No idea what magic they are doing here, but this often leads to problems of various manner. Bypassing Cloudflare / Turning it off should your issue. And I guess we'll never know why there are funny bytes in the X-Content-Security-Policy
headers.
Sadly we can't do anything on our apps side. If the infrastructure won't let us talk to the server, there's not much we can do about it.
Does this help?
What's really weird though: seems like CURL gets to the server. I'm not sure, but maybe there's actually an issue on our side. I'll have a deeper look at it as soon as I find some time. Would be really nice if we could keep the test account for an additional week or something.
Hey @desperateCoder , I'm not using cloudflare. The instance is self-hosted on a machine at my home. You can use the test account an additional week.
@pern0x ok, I did some further research and found the following:
when i curl
this endpoint, i end up with the following line in the HTTP headers:
X-Content-Security-Policy: allow ‘self’;
In that case the ‘
s seem to be the issue. ATTENTION: I first didn't notice, but this is not a valid '
, but ‘
(french 'accent'/backtick vs. valid single-quote). To me it seems like a misconfiguration of the server, where someone mistook those two.
Is there a configuration on the server side setting this header? usually you'll find something like this in /etc/apache2/conf-available/security.conf
or something like that, i guess you can google that for your environement. Please check that and change it to valid single-quotes ('
), then just retry. Chances are good that it just starts working then.
EDIT:
In case this fixes your issue, feel free to close this issue and delete the test user (thanks for providing the user!)
@desperateCoder thank you very much. It solves my issue.
This issue respects the following points:
Describe the bug
Expected behavior
It should be possible to connect.
Deck Android version
1.24.1
Deck server version
1.12.2
Nextcloud Android version
3.28.0
Nextcloud version
28.0.3
Device
Pixel 8 Pro
Android Version
grapheneos 14
App Store
Stacktrace