Kaiteki-Fedi / Kaiteki

The comfy SNS client for everything, everywhere
https://kaiteki.app
GNU Affero General Public License v3.0
490 stars 31 forks source link

Exception on deserialization of Misskey API response while probing instance #135

Closed ThatOneCalculator closed 2 years ago

ThatOneCalculator commented 2 years ago

I keep getting the error type Null is not a subtype of type 'bool' in type cast. It also can't detect my instance's software.

Tried with stop.voring.me, misskey.ai, jigglypuff.club and snug.moe, none of them worked.

Using app-release.apk from the latest git commit with flutter build apk.

Screenshot_20220522-202719.png Screenshot_20220522-202708.png
ThatOneCalculator commented 2 years ago

It seems Pleroma and Mastodon work fine, so it's just a problem with Misskey instances.

Craftplacer commented 2 years ago

Can you enable breaking on all exceptions and tell me where it breaks? Hearing the error message makes me think that a model class failed to deserialize from Misskey's API.

ThatOneCalculator commented 2 years ago

Can you enable breaking on all exceptions

How do I do that? I'm running on an Android phone (Pixel 6) but I can run it on Android Studio if needed.

Craftplacer commented 2 years ago

Ok, I assumed you were debugging from an IDE at the moment. Hang on I'll try on my end.

Craftplacer commented 2 years ago

Apparently Mr. Syuilo managed to remove some data out of nowhere.

image

ThatOneCalculator commented 2 years ago

Yea, iirc it was either at 12.109.0 or 12.110.0 that MiAuth had some breaking changes. Thanks, Syuilo... :face_exhaling:

Craftplacer commented 2 years ago

Yea, iirc it was either at 12.109.0 or 12.110.0 that MiAuth had some breaking changes. Thanks, Syuilo... 😮‍💨

For more insight, I enforce null-safety, and Misskey's API is really poorly documented if something IS ACTUALLY null. We'll see how it progresses in the future, but for now I'm updating fediverse_objects.

ThatOneCalculator commented 2 years ago

but for now I'm updating fediverse_objects.

That should solve the issue (for now), yea?

Craftplacer commented 2 years ago

but for now I'm updating fediverse_objects. That should solve the issue, yea?

Yes, fediverse_objects is the library for Kaiteki that provides the data models from Misskey, etc.

Craftplacer commented 2 years ago

Judging from the output of ApiToDart, it seems like Misskey did have many breaking changes.

ThatOneCalculator commented 2 years ago

Pictured: the development process of 12.110

A gif of a person smashing a keyboard

Craftplacer commented 2 years ago

BTW; Kaiteki isn't using MiAuth, it is using the private API endpoints intended for the instance frontend. Just the API from Misskey in general has changed

Craftplacer commented 2 years ago

image

Apparently Misskey's API schema became bloated as well, mixing schemas together, which means I have even longer classes to generate..

ThatOneCalculator commented 2 years ago

I love Misskey, it's such well designed software with no flaws, absolutely perfect

Craftplacer commented 2 years ago

Currently I am hand copy-pasting data fields from one generated class to another because ApiToDart doesn't support this yet...

Craftplacer commented 2 years ago

I need to manually correct the nullability of Meta's secure field. Will properly fix everything once I have time today.

image

Craftplacer commented 2 years ago

Fixed with https://github.com/Kaiteki-Fedi/ApiToDart/commit/578b1b57e45c63a20004cd07588adbe5a5d28701, https://github.com/Kaiteki-Fedi/ApiToDart/commit/95cf41c6cc1d60aba576c653d34ecb6e7768b40b, https://github.com/Kaiteki-Fedi/ApiToDart/commit/fdc5226e0213b7821294a3a5e013fb2f455322dd and https://github.com/Kaiteki-Fedi/fediverse_objects/commit/b8f635e04ab8d46c61a0d27d5162e5927181d300.

ThatOneCalculator commented 2 years ago

@Craftplacer I think this issue should be reopened.... 😖

This is from the latest commit

Craftplacer commented 2 years ago

image

Misskey's API specification is unreliable still.

ThatOneCalculator commented 2 years ago

Also, what instance are you using to test Misskey support?

Craftplacer commented 2 years ago

Also, what instance are you using to test Misskey support?

misskey.io

ThatOneCalculator commented 2 years ago

Ah. I think misskey.io runs stock 12.110.1 while a lot of instances like stop.voring.me and snug.moe run the develop branch version, which is going to be a release tag very soon. Not sure if there's also API changes between the release tag and the develop branch.

That being said, misskey.io doesn't work in the app either, same exact error :shrug:

ThatOneCalculator commented 2 years ago

Oh yea have fun dealing with this :skull:

https://github.com/misskey-dev/misskey/blob/f90c947036dc6d9c0b7e4ea7cfa1dc53a0b98c15/CHANGELOG.md?plain=1#L24 image

Craftplacer commented 2 years ago

Oh yea have fun dealing with this 💀

https://github.com/misskey-dev/misskey/blob/f90c947036dc6d9c0b7e4ea7cfa1dc53a0b98c15/CHANGELOG.md?plain=1#L24 image

Kaiteki's sign-in routine can invoke another login prompt (like 2FA), so this only a matter of implementing it.

Craftplacer commented 2 years ago

fediverse_objects has been updated again and Kaiteki makes it past the instance entry now

image

ThatOneCalculator commented 2 years ago

The correct command to upgrade before building again is git pull && flutter pub upgrade, yea?

Craftplacer commented 2 years ago

git pull doesn't affect Dart's package manager, you should run flutter pub upgrade and then flutter pub get.

ThatOneCalculator commented 2 years ago

Sick! Now time for captcha, I suppose...

Should I make a new issue?

Screenshot_20220523-161630.png

Craftplacer commented 2 years ago

I suppose..

Jokiller230 commented 2 years ago

I am currently experiencing the same issue.

Using the latest release of the apk and trying to log into my instance https://social.jokiller230.tk

Error: type 'Null' is not a subtype of type 'String' in type cast

ThatOneCalculator commented 2 years ago

Update the app, the issue should have been fixed a while ago.

Jokiller230 commented 2 years ago

Hey! I just updated to the latest version and this issue is still happening. I have no idea what triggers this but I've noticed that it's not happening on bigger servers like misskey.io. It seems however that multiple smaller Single-User instances are running into this issue since I've tried multiple instances hosted by friends and they all seem to have this issue.

I'm running Misskey 12.111.1 using docker on a raspberry pi 400 with raspberry-pi-OS 64bit. Node.js version 18.0.0 PostgreSQL 12.2 Redis 4.0.14 Vue 3.2.37

my instance: https://social.jokiller230.tk There don't seem to be any issues with my Misskey install as far as I'm aware.

ThatOneCalculator commented 2 years ago

Try upgrading to Redis 7 and Node 18.4.0. It doesn't happen on my instance https://stop.voring.me so matching the deps might help

ThatOneCalculator commented 2 years ago

OOOH wait you said docker...try without docker. The docker image for Misskey has some issues.

Craftplacer commented 2 years ago

bannerUrl wasn't documented to be null. Thanks @\syuilo.

Jokiller230 commented 2 years ago

just applied a banner image to my server. Issue fixed thanks!