cashapp / zipline

Run Kotlin/JS libraries in Kotlin/JVM and Kotlin/Native programs
Apache License 2.0
1.98k stars 151 forks source link

worked in serveDevelopmentZipline but crashed in serveProductionZipline #1358

Closed TelephoneTan closed 1 week ago

TelephoneTan commented 1 week ago

If I use serveDevelopmentZipline, everything works as expected, but If I use serveProductionZipline, an exception is thrown:

Exception in thread "main" java.lang.IllegalStateException: A global JavaScript object called app_cash_zipline_inboundChannel was not found. Try confirming that Zipline.get() has been called.
    at app.cash.zipline.QuickJs.getInboundCallChannel(Native Method)
    at app.cash.zipline.QuickJs.getInboundChannel$zipline(QuickJs.kt:120)
    at app.cash.zipline.Zipline$endpoint$1.jsInboundBridge_delegate$lambda$0(Zipline.kt:60)
    at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:81)
    at app.cash.zipline.Zipline$endpoint$1.getJsInboundBridge(Zipline.kt:59)
    at app.cash.zipline.Zipline$endpoint$1.call(Zipline.kt:65)
    at app.cash.zipline.internal.bridge.OutboundCallHandler.callInternal$zipline(OutboundCallHandler.kt:116)
    at app.cash.zipline.internal.bridge.OutboundCallHandler.call(OutboundCallHandler.kt:75)
    at JSZipline$Companion$Adapter$GeneratedOutboundService.hello(JSZipline.kt:4)
    at MainKt$main$1.invokeSuspend(main.kt:7)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:28)
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:99)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:69)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)
    at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
    at MainKt.main(main.kt:5)
    at MainKt.main(main.kt)