Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot login on private instance #1487

Closed
deliantwo opened this issue May 5, 2024 · 4 comments · Fixed by #1486
Closed

Cannot login on private instance #1487

deliantwo opened this issue May 5, 2024 · 4 comments · Fixed by #1486
Labels
bug Something isn't working

Comments

@deliantwo
Copy link

Jerboa Version

0.0.66

Android Version + Phone

Android 14, Oneplus 11 5G

Describe The Bug

I have set up a selfhosted private instance of lemmy.

Attempting to log in to my instance throws the following error (full stacktrace below):

04-21 22:18:11.157 20138 20138 D login   : io.ktor.serialization.JsonConvertException: Illegal input: Unexpected JSON token at offset 76: Expected start of the array '[', but had 'n' instead at path: $.protocols
04-21 22:18:11.157 20138 20138 D login   : JSON input: .....ersion":"0.19.3"},"protocols":null,"usage":{"users":{"total".....
04-21 22:18:11.157 20138 20138 D login   : 	at io.ktor.serialization.kotlinx.KotlinxSerializationConverter.deserialize(Unknown Source:317)

From what I can understand, the protocol is not expected to be null.
The GET request /nodeinfo/2.0.json on my instance returns:

{
  "version": "2.0",
  "software": {
    "name": "lemmy",
    "version": "0.19.3"
  },
  "protocols": null,
  "usage": {
    "users": {
      "total": 7,
      "activeHalfyear": 1,
      "activeMonth": 1
    },
    "localPosts": 1,
    "localComments": 1
  },
  "openRegistrations": true
}

where you can see the protocol is null. I did not know any other private instances to try.

I have tried other Android clients, but they failed in the same way. However, I have successfully logged in with a desktop client (Lemoa).

To Reproduce

  1. try to login to a private instance
  2. See the login failed toast

In the case of a crash or when relevant include the logs

04-21 22:18:11.157 20138 20138 D login : io.ktor.serialization.JsonConvertException: Illegal input: Unexpected JSON token at offset 76: Expected start of the array '[', but had 'n' instead at path: $.protocols
04-21 22:18:11.157 20138 20138 D login : JSON input: .....ersion":"0.19.3"},"protocols":null,"usage":{"users":{"total".....
04-21 22:18:11.157 20138 20138 D login : at io.ktor.serialization.kotlinx.KotlinxSerializationConverter.deserialize(Unknown Source:317)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.serialization.ContentConverterKt$deserialize$$inlined$map$1$2.emit(Unknown Source:162)
04-21 22:18:11.157 20138 20138 D login : at kotlinx.coroutines.flow.SafeFlow.collect(Unknown Source:89)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.serialization.ContentConverterKt$deserialize$$inlined$map$1.collect(Unknown Source:47)
04-21 22:18:11.157 20138 20138 D login : at kotlin.text.RegexKt.firstOrNull(Unknown Source:72)
04-21 22:18:11.157 20138 20138 D login : at kotlin.ResultKt.deserialize(Unknown Source:81)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.client.plugins.contentnegotiation.ContentNegotiation.convertResponse$ktor_client_content_negotiation(Unknown Source:243)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.client.HttpClient$2.invokeSuspend(Unknown Source:441)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.client.HttpClient$2.invoke(SourceFile:2)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.client.HttpClient$2.invoke(SourceFile:6)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.util.pipeline.SuspendFunctionGun.loop(Unknown Source:35)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.util.pipeline.SuspendFunctionGun.proceed(Unknown Source:21)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.client.HttpClient$4.invokeSuspend(Unknown Source:167)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.client.HttpClient$4.invoke(Unknown Source:40)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.util.pipeline.SuspendFunctionGun.loop(Unknown Source:35)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.util.pipeline.SuspendFunctionGun.proceed(Unknown Source:21)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.util.pipeline.SuspendFunctionGun.proceedWith(Unknown Source:7)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.client.plugins.HttpCallValidator$Companion$install$1.invokeSuspend(Unknown Source:133)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.client.plugins.HttpCallValidator$Companion$install$1.invoke(Unknown Source:46)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.util.pipeline.SuspendFunctionGun.loop(Unknown Source:35)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.util.pipeline.SuspendFunctionGun.proceed(Unknown Source:21)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.util.pipeline.SuspendFunctionGun.execute$ktor_utils(Unknown Source:23)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.util.pipeline.Pipeline.execute(Unknown Source:195)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.client.call.HttpClientCall.bodyNullable(Unknown Source:173)
04-21 22:18:11.157 20138 20138 D login : at it.vercruysse.lemmyapi.LemmyApi.getNodeInfo-gIAlu-s(Unknown Source:125)
04-21 22:18:11.157 20138 20138 D login : at it.vercruysse.lemmyapi.LemmyApi$getNodeInfo$1.invokeSuspend(Unknown Source:12)
04-21 22:18:11.157 20138 20138 D login : at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8)
04-21 22:18:11.157 20138 20138 D login : at kotlinx.coroutines.DispatchedTask.run(Unknown Source:112)
04-21 22:18:11.157 20138 20138 D login : at kotlinx.coroutines.EventLoopImplPlatform.processUnconfinedEvent(Unknown Source:23)
04-21 22:18:11.157 20138 20138 D login : at kotlinx.coroutines.internal.DispatchedContinuation.resumeWith(Unknown Source:74)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(Unknown Source:24)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.util.pipeline.SuspendFunctionGun.loop(Unknown Source:15)
04-21 22:18:11.157 20138 20138 D login : at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(Unknown Source:22)
04-21 22:18:11.157 20138 20138 D login : at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:31)
04-21 22:18:11.157 20138 20138 D login : at kotlinx.coroutines.DispatchedTask.run(Unknown Source:112)
04-21 22:18:11.157 20138 20138 D login : at android.os.Handler.handleCallback(Handler.java:958)
04-21 22:18:11.157 20138 20138 D login : at android.os.Handler.dispatchMessage(Handler.java:99)
04-21 22:18:11.157 20138 20138 D login : at android.os.Looper.loopOnce(Looper.java:257)
04-21 22:18:11.157 20138 20138 D login : at android.os.Looper.loop(Looper.java:368)
04-21 22:18:11.157 20138 20138 D login : at android.app.ActivityThread.main(ActivityThread.java:8826)
04-21 22:18:11.157 20138 20138 D login : at java.lang.reflect.Method.invoke(Native Method)
04-21 22:18:11.157 20138 20138 D login : at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
04-21 22:18:11.157 20138 20138 D login : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)

@deliantwo deliantwo added the bug Something isn't working label May 5, 2024
@MV-GH
Copy link
Collaborator

MV-GH commented May 5, 2024

Hmmm, Lemmy is supposed to return activitypub protocol. I'll take a look to see if it can be null according to the spec. But this is rather bug in Lemmy than Jerboa.

https://lemmy.ml/nodeinfo/2.0.json

@dessalines

@MV-GH
Copy link
Collaborator

MV-GH commented May 5, 2024

Nvm from the Lemmy code this is on purpose. I'll fix this.

https://github.com/LemmyNet/lemmy/blob/main/crates/routes/src/nodeinfo.rs

Edit:

Actually according to the nodeinfo spec, there should be minimum 1 protocol?

http://nodeinfo.diaspora.software/docson/index.html#/ns/schema/2.0

@deliantwo
Copy link
Author

Ok, thank you for diving deep into it.

So, maybe I should open an issue with Lemmy instead?

@MV-GH
Copy link
Collaborator

MV-GH commented May 5, 2024

I'll make an issue in the meantime I'll fix it on my side too. (As Lemmy instances are slow to update, so I ll have to support it)

MV-GH added a commit to MV-GH/jerboa that referenced this issue May 5, 2024
@MV-GH MV-GH mentioned this issue May 5, 2024
dessalines pushed a commit that referenced this issue May 7, 2024
* Update LemmyApi

* Remove some remnants

* Remove some remnants

* Fix #1487
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants