KevinnZou / compose-webview-multiplatform

WebView for JetBrains Compose Multiplatform
https://kevinnzou.github.io/compose-webview-multiplatform/
Apache License 2.0
530 stars 69 forks source link

kotlinx.serialization.MissingFieldException: Field 'body' is required for type with serial name 'dev.datlag.kcef.model.GitHubRelease', but it was missing at path: $ #173

Closed asahiqin closed 4 months ago

asahiqin commented 5 months ago

在我试图初始化kcef的时候,出现了这个报错

KevinnZou commented 5 months ago

@asahiqin Could you provide your code?

asahiqin commented 5 months ago

@asahiqin Could you provide your code?

What I do just copy README.desktop.md’s initialization sample code into composeApp/src/desktopMain/kotlin/main.kt, and replace the MainWebview() with App()

asahiqin commented 5 months ago

Alright,it's amazing that the code runs correctly after a night.I just did nothing Should I close this issue?

DatL4g commented 5 months ago

@asahiqin probably just a small GitHub (API) downtime not your fault

D10NGYANG commented 5 months ago

我也遇到了:

io.ktor.serialization.JsonConvertException: Illegal input: Field 'body' is required for type with serial name 'dev.datlag.kcef.model.GitHubRelease', but it was missing at path: $ at io.ktor.serialization.kotlinx.KotlinxSerializationConverter.deserialize(KotlinxSerializationConverter.kt:90) at io.ktor.serialization.ContentConverterKt$deserialize$$inlined$map$1$2.emit(Emitters.kt:224) at kotlinx.coroutines.flow.FlowKtBuildersKt$asFlow$$inlined$unsafeFlow$3.collect(SafeCollector.common.kt:114) at io.ktor.serialization.ContentConverterKt$deserialize$$inlined$map$1.collect(SafeCollector.common.kt:113) at kotlinx.coroutines.flow.FlowKtReduceKt.firstOrNull(Reduce.kt:239) at kotlinx.coroutines.flow.FlowKt.firstOrNull(Unknown Source) at io.ktor.serialization.ContentConverterKt.deserialize(ContentConverter.kt:123) at io.ktor.client.plugins.contentnegotiation.ContentNegotiation.convertResponse$ktor_client_content_negotiation(ContentNegotiation.kt:230) at io.ktor.client.plugins.contentnegotiation.ContentNegotiation$Plugin$install$2.invokeSuspend(ContentNegotiation.kt:262) at io.ktor.client.plugins.contentnegotiation.ContentNegotiation$Plugin$install$2.invoke(ContentNegotiation.kt) at io.ktor.client.plugins.contentnegotiation.ContentNegotiation$Plugin$install$2.invoke(ContentNegotiation.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:131) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:89) at io.ktor.client.HttpClient$4.invokeSuspend(HttpClient.kt:177) at io.ktor.client.HttpClient$4.invoke(HttpClient.kt) at io.ktor.client.HttpClient$4.invoke(HttpClient.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:131) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:89) at io.ktor.util.pipeline.SuspendFunctionGun.proceedWith(SuspendFunctionGun.kt:99) at io.ktor.client.plugins.HttpCallValidator$Companion$install$2.invokeSuspend(HttpCallValidator.kt:142) at io.ktor.client.plugins.HttpCallValidator$Companion$install$2.invoke(HttpCallValidator.kt) at io.ktor.client.plugins.HttpCallValidator$Companion$install$2.invoke(HttpCallValidator.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:131) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:89) at io.ktor.util.pipeline.SuspendFunctionGun.execute$ktor_utils(SuspendFunctionGun.kt:109) at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77) at io.ktor.client.call.HttpClientCall.bodyNullable(HttpClientCall.kt:89) at dev.datlag.kcef.step.fetch.PackageDownloader.downloadPackage(PackageDownloader.kt:136) at dev.datlag.kcef.step.fetch.PackageDownloader$downloadPackage$1.invokeSuspend(PackageDownloader.kt) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702) Caused by: kotlinx.serialization.MissingFieldException: Field 'body' is required for type with serial name 'dev.datlag.kcef.model.GitHubRelease', but it was missing at path: $ at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:93) at kotlinx.serialization.json.Json.decodeFromString(Json.kt:107) at io.ktor.serialization.kotlinx.KotlinxSerializationConverter.deserialize(KotlinxSerializationConverter.kt:82) ... 36 more Caused by: kotlinx.serialization.MissingFieldException: Field 'body' is required for type with serial name 'dev.datlag.kcef.model.GitHubRelease', but it was missing at kotlinx.serialization.internal.PluginExceptionsKt.throwMissingFieldException(PluginExceptions.kt:20) at dev.datlag.kcef.model.GitHubRelease.(GitHubRelease.kt:5) at dev.datlag.kcef.model.GitHubRelease$$serializer.deserialize(GitHubRelease.kt:5) at dev.datlag.kcef.model.GitHubRelease$$serializer.deserialize(GitHubRelease.kt:5) at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70) ... 38 more io.ktor.serialization.JsonConvertException: Illegal input: Field 'body' is required for type with serial name 'dev.datlag.kcef.model.GitHubRelease', but it was missing at path: $ at io.ktor.serialization.kotlinx.KotlinxSerializationConverter.deserialize(KotlinxSerializationConverter.kt:90) at io.ktor.serialization.ContentConverterKt$deserialize$$inlined$map$1$2.emit(Emitters.kt:224) at kotlinx.coroutines.flow.FlowKtBuildersKt$asFlow$$inlined$unsafeFlow$3.collect(SafeCollector.common.kt:114) at io.ktor.serialization.ContentConverterKt$deserialize$$inlined$map$1.collect(SafeCollector.common.kt:113) at kotlinx.coroutines.flow.FlowKtReduceKt.firstOrNull(Reduce.kt:239) at kotlinx.coroutines.flow.FlowKt.firstOrNull(Unknown Source) at io.ktor.serialization.ContentConverterKt.deserialize(ContentConverter.kt:123) at io.ktor.client.plugins.contentnegotiation.ContentNegotiation.convertResponse$ktor_client_content_negotiation(ContentNegotiation.kt:230) at io.ktor.client.plugins.contentnegotiation.ContentNegotiation$Plugin$install$2.invokeSuspend(ContentNegotiation.kt:262) at io.ktor.client.plugins.contentnegotiation.ContentNegotiation$Plugin$install$2.invoke(ContentNegotiation.kt) at io.ktor.client.plugins.contentnegotiation.ContentNegotiation$Plugin$install$2.invoke(ContentNegotiation.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:131) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:89) at io.ktor.client.HttpClient$4.invokeSuspend(HttpClient.kt:177) at io.ktor.client.HttpClient$4.invoke(HttpClient.kt) at io.ktor.client.HttpClient$4.invoke(HttpClient.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:131) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:89) at io.ktor.util.pipeline.SuspendFunctionGun.proceedWith(SuspendFunctionGun.kt:99) at io.ktor.client.plugins.HttpCallValidator$Companion$install$2.invokeSuspend(HttpCallValidator.kt:142) at io.ktor.client.plugins.HttpCallValidator$Companion$install$2.invoke(HttpCallValidator.kt) at io.ktor.client.plugins.HttpCallValidator$Companion$install$2.invoke(HttpCallValidator.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:131) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:89) at io.ktor.util.pipeline.SuspendFunctionGun.execute$ktor_utils(SuspendFunctionGun.kt:109) at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77) at io.ktor.client.call.HttpClientCall.bodyNullable(HttpClientCall.kt:89) at dev.datlag.kcef.step.fetch.PackageDownloader.downloadPackage(PackageDownloader.kt:136) at dev.datlag.kcef.step.fetch.PackageDownloader$downloadPackage$1.invokeSuspend(PackageDownloader.kt) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702) Caused by: kotlinx.serialization.MissingFieldException: Field 'body' is required for type with serial name 'dev.datlag.kcef.model.GitHubRelease', but it was missing at path: $ at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:93) at kotlinx.serialization.json.Json.decodeFromString(Json.kt:107) at io.ktor.serialization.kotlinx.KotlinxSerializationConverter.deserialize(KotlinxSerializationConverter.kt:82) ... 36 more Caused by: kotlinx.serialization.MissingFieldException: Field 'body' is required for type with serial name 'dev.datlag.kcef.model.GitHubRelease', but it was missing at kotlinx.serialization.internal.PluginExceptionsKt.throwMissingFieldException(PluginExceptions.kt:20) at dev.datlag.kcef.model.GitHubRelease.(GitHubRelease.kt:5) at dev.datlag.kcef.model.GitHubRelease$$serializer.deserialize(GitHubRelease.kt:5) at dev.datlag.kcef.model.GitHubRelease$$serializer.deserialize(GitHubRelease.kt:5) at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70) ... 38 more

DatL4g commented 5 months ago

We could get around that issue if we bundle the runtime with jcef directly, however we don't support loading the binaries right now.

I'm super occupied right now and probably won't change for some years, maybe someone want's to jump in @KevinnZou? Maybe @bulletjet786 made some progress in this field already, https://github.com/DatL4g/KCEF/issues/9

bulletjet786 commented 5 months ago

I haven't had a chance to test this solution yet, as I've been focused on another feature. Next, I plan to validate it by initiating the application's JRE through JBR, with the goal of mitigating the requirement to download the bundle as much as feasible. @DatL4g