I get this error `Error code: 5` on Chrome when i ...
# compose-web
a
I get this error
Error code: 5
on Chrome when i run
wasmBrowserProductionRun
works ok on Firefox and even Safari but Chrome is crashing without any stacktrace. Normal
wasmBrowserRun
works fine. Any idea how to debug this?
It's definatelly something in my app. Replaced App() with just a text and it works. Will do step by step to find what is causing this
w
Yeah, it's very unfortunate how much manual bisecting of composables is required to get a site working. 😢
a
Let's keep it constructive Winson
e
it's chrome crashing, not compose, so see if chrome://crashes has it
today i learned 1
c
a
Nice find @Chrimaeon. Will give it a shot later. Got the dmp file but seems involved to find the crash and battery is dying
e
a
Still searching. If anyone knows how to speed up the wasm production build (by disabling optimizations or obfuscation somehow) let me know. takes more than a minute to try solutions and that is killing me rn
Was able to make it crash on debug. Chrome doesnt crash but Compose does Seems like it's: https://youtrack.jetbrains.com/issue/KTOR-8124/Runtime-error-BodyStreamBuffer-was-aborted It has something to do with loading images using coil and scrolling a lazy list EDIT: It was unrelated. Turns out I forgot to add
implementation(libs.ktor.client.js)
on the wasm target. Fixed dev but still crash on production
This took forever. Ended up changing the optimization level on WASM. The following gradle task lets you change the optimization flags:
Copy code
tasks.withType<org.jetbrains.kotlin.gradle.targets.js.binaryen.BinaryenExec> {
    binaryenArgs = mutableListOf(
        // Required flags:
        "--enable-gc",
        "--enable-reference-types",
        "--enable-exception-handling",
        "--enable-bulk-memory",
        "--enable-nontrapping-float-to-int",

        // Optional flags (can be removed):
        "--inline-functions-with-loops",
        "--traps-never-happen",
        "--fast-math",

        "--gufa",
// either -03 or -0z breaks my app
//        "-O3",
//        "-Oz",
// 02 is fine
         "-O2",
    )
}
Using flag -03 or -0z breaks my app. -02 works fine on chrome