bug report (claude code msg, got missing serialize...
# supabase-kt
r
bug report (claude code msg, got missing serializer classes for KMP project android / js, android works fine, js does not) The real bug is in supabase-kt — their KtorRealtimeWebsocket uses ws.sendSerialized(message) instead of encoding with an explicit serializer, which breaks on Kotlin/JS IR because serializerOrNull can't find companion serializers across module boundaries. The proper fixes would be: supabase-kt fix — use ws.send(Frame.Text(json.encodeToString(RealtimeMessage.serializer(), message))) instead of sendSerialized. Worth filing at github.com/supabase-community/supabase-kt. Kotlin compiler fix — the IR linker should preserve Companion.serializer() accessibility across modules. Until either ships, the 2-line patch is the least-bad option. It directly fixes what's broken (the JS lookup path), doesn't touch library code, and doesn't require maintaining serializer lists across multiple Json instances.
using
/**
* Json config for the SettingsSessionManager, derived from jsonConfig.
* The default SettingsSessionManager uses its own private Json with no serializersModule.
* On Kotlin/JS dev mode, runtime KClass-based serializer lookup fails for classes from
* dependency modules (UserSession etc.). Contextual serializers provide a fallback path.
* encodeDefaults = true is required by SettingsSessionManager.
*/
@OptIn(kotlinx.serialization.ExperimentalSerializationApi::class)
private val sessionJson by lazy {
Json(from = jsonConfig) {
encodeDefaults = true
serializersModule = SerializersModule {
contextual(UserSession::class, UserSession.serializer())
contextual(UserInfo::class, UserInfo.serializer())
contextual(Identity::class, Identity.serializer())
contextual(UserMfaFactor::class, UserMfaFactor.serializer())
}
}
}
val supabaseClient by lazy {
createSupabaseClient(SB_URL, SB_ANON_PUBLIC_KEY) {
defaultSerializer = KotlinXSerializer(jsonConfig)
j
Is there a Kotlin bug report for that on youtrack?