jellyfin / jellyfin-androidtv

Android TV Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
2.69k stars 458 forks source link

Error trying to login (auth or quickconnect) due to client exception #3347

Closed fungos closed 7 months ago

fungos commented 7 months ago

Describe the bug

I'm trying to use Jellyfin Android TV with a generic Android TV box but trying to connect to my server always fails on this device. On the issue #2503 there is a Debug version of jellyfin which I tried while monitoring logs on both sides, then the following exception was triggered on the client:

02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse: Deserialization failed
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse: kotlinx.serialization.MissingFieldException: Fields [SupportsContentUploading, SupportsSync] are required for type with serial name 'org.jellyfin.sdk.model.api.ClientCapabilities', but they were missing at path: $.SessionInfo.Capabilities at path: $.SessionInfo.Capabilities at path: $.SessionInfo.Capabilities
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:90)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlinx.serialization.json.Json.decodeFromString(Json.kt:95)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at org.jellyfin.sdk.api.operations.UserApi.authenticateWithQuickConnect(UserApi.kt:332)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at org.jellyfin.sdk.api.operations.UserApi$authenticateWithQuickConnect$1.invokeSuspend(Unknown Source:15)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at android.os.Handler.handleCallback(Handler.java:942)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at android.os.Handler.dispatchMessage(Handler.java:99)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at android.os.Looper.loopOnce(Looper.java:201)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at android.os.Looper.loop(Looper.java:288)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at android.app.ActivityThread.main(ActivityThread.java:7884)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at java.lang.reflect.Method.invoke(Native Method)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse: Caused by: kotlinx.serialization.MissingFieldException: Fields [SupportsContentUploading, SupportsSync] are required for type with serial name 'org.jellyfin.sdk.model.api.ClientCapabilities', but they were missing at path: $.SessionInfo.Capabilities at path: $.SessionInfo.Capabilities
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:90)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:79)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at org.jellyfin.sdk.model.api.AuthenticationResult$$serializer.deserialize(AuthenticationResult.kt:12)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at org.jellyfin.sdk.model.api.AuthenticationResult$$serializer.deserialize(AuthenticationResult.kt:12)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       ... 13 more
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse: Caused by: kotlinx.serialization.MissingFieldException: Fields [SupportsContentUploading, SupportsSync] are required for type with serial name 'org.jellyfin.sdk.model.api.ClientCapabilities', but they were missing at path: $.SessionInfo.Capabilities
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:90)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:79)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at org.jellyfin.sdk.model.api.SessionInfo$$serializer.deserialize(SessionInfo.kt:27)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at org.jellyfin.sdk.model.api.SessionInfo$$serializer.deserialize(SessionInfo.kt:27)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       ... 18 more
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse: Caused by: kotlinx.serialization.MissingFieldException: Fields [SupportsContentUploading, SupportsSync] are required for type with serial name 'org.jellyfin.sdk.model.api.ClientCapabilities', but they were missing
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlinx.serialization.internal.PluginExceptionsKt.throwMissingFieldException(PluginExceptions.kt:20)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at org.jellyfin.sdk.model.api.ClientCapabilities.<init>(ClientCapabilities.kt:14)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at org.jellyfin.sdk.model.api.ClientCapabilities$$serializer.deserialize(ClientCapabilities.kt:14)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at org.jellyfin.sdk.model.api.ClientCapabilities$$serializer.deserialize(ClientCapabilities.kt:14)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
02-04 11:45:24.962  2951  2951 E org.jellyfin.sdk.api.client.RawResponse:       ... 23 more
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect: Unable to sign in with Quick Connect secret
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect: org.jellyfin.sdk.api.client.exception.InvalidContentException: Deserialization failed
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at org.jellyfin.sdk.api.operations.UserApi.authenticateWithQuickConnect(UserApi.kt:338)
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at org.jellyfin.sdk.api.operations.UserApi$authenticateWithQuickConnect$1.invokeSuspend(Unknown Source:15)
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at android.os.Handler.handleCallback(Handler.java:942)
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at android.os.Handler.dispatchMessage(Handler.java:99)
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at android.os.Looper.loopOnce(Looper.java:201)
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at android.os.Looper.loop(Looper.java:288)
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at android.app.ActivityThread.main(ActivityThread.java:7884)
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at java.lang.reflect.Method.invoke(Native Method)
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
02-04 11:45:24.967  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect: Caused by: kotlinx.serialization.MissingFieldException: Fields [SupportsContentUploading, SupportsSync] are required for type with serial name 'org.jellyfin.sdk.model.api.ClientCapabilities', but they were missing at path: $.SessionInfo.Capabilities at path: $.SessionInfo.Capabilities at path: $.SessionInfo.Capabilities
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:90)
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlinx.serialization.json.Json.decodeFromString(Json.kt:95)
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at org.jellyfin.sdk.api.operations.UserApi.authenticateWithQuickConnect(UserApi.kt:332)
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         ... 11 more
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect: Caused by: kotlinx.serialization.MissingFieldException: Fields [SupportsContentUploading, SupportsSync] are required for type with serial name 'org.jellyfin.sdk.model.api.ClientCapabilities', but they were missing at path: $.SessionInfo.Capabilities at path: $.SessionInfo.Capabilities
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:90)
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:79)
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at org.jellyfin.sdk.model.api.AuthenticationResult$$serializer.deserialize(AuthenticationResult.kt:12)
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at org.jellyfin.sdk.model.api.AuthenticationResult$$serializer.deserialize(AuthenticationResult.kt:12)
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         ... 13 more
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect: Caused by: kotlinx.serialization.MissingFieldException: Fields [SupportsContentUploading, SupportsSync] are required for type with serial name 'org.jellyfin.sdk.model.api.ClientCapabilities', but they were missing at path: $.SessionInfo.Capabilities
02-04 11:45:24.968  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:90)
02-04 11:45:24.969  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
02-04 11:45:24.969  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:79)
02-04 11:45:24.969  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at org.jellyfin.sdk.model.api.SessionInfo$$serializer.deserialize(SessionInfo.kt:27)
02-04 11:45:24.969  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at org.jellyfin.sdk.model.api.SessionInfo$$serializer.deserialize(SessionInfo.kt:27)
02-04 11:45:24.969  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
02-04 11:45:24.969  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         ... 18 more
02-04 11:45:24.969  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect: Caused by: kotlinx.serialization.MissingFieldException: Fields [SupportsContentUploading, SupportsSync] are required for type with serial name 'org.jellyfin.sdk.model.api.ClientCapabilities', but they were missing
02-04 11:45:24.969  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlinx.serialization.internal.PluginExceptionsKt.throwMissingFieldException(PluginExceptions.kt:20)
02-04 11:45:24.969  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at org.jellyfin.sdk.model.api.ClientCapabilities.<init>(ClientCapabilities.kt:14)
02-04 11:45:24.969  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at org.jellyfin.sdk.model.api.ClientCapabilities$$serializer.deserialize(ClientCapabilities.kt:14)
02-04 11:45:24.969  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at org.jellyfin.sdk.model.api.ClientCapabilities$$serializer.deserialize(ClientCapabilities.kt:14)
02-04 11:45:24.969  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
02-04 11:45:24.969  2951  2951 E AuthenticationRepositoryImpl$authenticateQuickConnect:         ... 23 more

The normal Android client do work.

Server: 10.9.0 (arch git) Android TV Client (Debug): 0.15.10 debug (Not Working) Android TV Client (Normal): 0.16.4 release (Not Working) Android Client: 2.6.0 (Working) Web Client working Device: RockChip H96_Max_RK3528

Logs

No response

Application version

0.16.4

Where did you install the app from?

Google Play

Device information

RockChip H96_Max_RK3528

Android version

Android TV 13

Jellyfin server version

10.9.0

nielsvanvelzen commented 7 months ago

The app does not support Jellyfin 10.9 yet. We will start on compatibility once the first release candidate for it is available.

fungos commented 7 months ago

I understand, but this can at least require some better handling of exceptions on the app and giving meaningful messages to users?

MichaelRUSF commented 7 months ago

Neils addressed this #3309, but did not implement it. So far, this is only the second time I've seen this issue come up.

nielsvanvelzen commented 7 months ago

We do catch network issues, but in this specific case the app knows it is working with a Jellyfin server but it receives responses with missing fields which it can't work with. This should normally not happen as we're aiming for backwards compatibility, for that reason the "fix" will likely be made on the server side after the first release candidate.

fungos commented 7 months ago

It all makes sense, maybe a good middle ground would be to have any kind of exception being globally caught and shown to the user in the app itself only for debug releases of the app? This can make a lot easier to help users identify the issue without going trough steps to see adb logcat.

nielsvanvelzen commented 7 months ago

When the app crashes it will already upload the crash logs to the last known Jellyfin server so there is no need to use logcat.

fungos commented 7 months ago

Interesting, I was unable to find this. Normally, where that goes? direct into the servers log? it that is the case, mine isn't showing it.

nielsvanvelzen commented 7 months ago

The file will be named something like upload_org.jellyfin.androidtv.debug_0.0.0-dev.1_20240204193026_6fbd647909d84d059977eb224b086812.log. But looking at the QuickConnect code from the app we do catch exceptions so the app shouldn't have crashed.

fungos commented 7 months ago

Sorry, bad wording. The app doesn't crash, so yes the exception is being caught, but from the user perspective, the only information that exists is an error message (can't remember exactly the wording) saying "unable to connect to server". so trying to use the app gives no hint on what is not working.

Also, I can't find any upload .log file in my computer, so unless I need to enable this somewhere in the server, it doesn't seem to be working at least for me.

nielsvanvelzen commented 7 months ago

The app should now work with 10.9 again as we just merged some fixes to the API. We're not going to add additional checks to the login code for this specific case.

MaxiHafer commented 6 months ago

For reference: https://github.com/jellyfin/jellyfin-androidtv/issues/3383

Oni commented 5 months ago

The app should now work with 10.9 again as we just merged some fixes to the API. We're not going to add additional checks to the login code for this specific case.

Now that 10.9 is in beta, I'm commenting this issue.

The login from my fireTV is still failing with an "unable to connect to the server" error message.

My server is the docker image "jellyfin/jellyfin:2024032505" and my client is "jellyfin-androidtv 0.16.7 release".

I would gladly downgrade the server, but I'm unable to find 10.8 docker images.

nielsvanvelzen commented 5 months ago

You can find everything there is to know about 10.9 in this issue: #3467. The login issue is already solved and will be in the next unstable release.

Also, it is not possible to downgrade the server from 10.9 to 10.8 without resetting all your data.

Oni commented 5 months ago

I can confirm: version 'jellyfin/jellyfin:2024032802' fixes the issue.

bonswouar commented 4 months ago

Does this mean anybody that wants to keep using stable releases, and the android tv app as a client, will have to wait months before being able to login?

nielsvanvelzen commented 4 months ago

This issue was closed 3 months ago, the linked issue (#3467) states that support for 10.9 was added weeks ago.

bonswouar commented 4 months ago

My bad, reading the following comments on the linked issue (without paying attention to the dates) it looked like it was fixed only on unstable