Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wasm app crash with error "unreachable executed" #761

Open
dipendrapkrl opened this issue Jan 13, 2025 · 0 comments
Open

Wasm app crash with error "unreachable executed" #761

dipendrapkrl opened this issue Jan 13, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@dipendrapkrl
Copy link

dipendrapkrl commented Jan 13, 2025

Ktorfit version

2.2.0

What happened and how can we reproduce this issue?

I am using following related libraries in my project:
KSP version: 2.1.0-1.0.29
Ktorfit version and ktorfitConvertersResponse version: 2.2.0
compose: 1.7.3
kotlin: 2.1.0
AGP: 8.2.2
ktor:3.0.1

The app compiles and runs fine in android, desktop and ios targets.
It runs fine in wasm target but only in development builds. When I do production build, the app will crash as soon as it encounters the following code.

val api = ktorfit.createTestApi()

Sample ktorfit api.

interface TestApi {
    @GET
    suspend fun getRedirectUrl(
        @Url url: String,
    ): Result<HttpResponse>

}

ktorfit:

val ktorfit = ktorfit {
    baseUrl(BASE_URL_PLACEHOLDER)
    httpClient(HttpClient {
        install(ContentNegotiation) {
            json(Json { isLenient = true; ignoreUnknownKeys = true }, contentType = ContentType.Any)
        }
        defaultRequest {
            header("Content-Type","application/json; charset=utf-8")
        }
    })
    converterFactories(ResponseConverterFactory(), ResultResponseConverter())
}

following works fine:
wasmJsBrowserDevelopmentRun -t --quiet

However, crashes as soon as it encounters usage of KtorfitApi with following command:
composeApp:wasmjsBrowserProductionRun

Screenshots:
image

image
image
image

What did you expect to happen?

There should be no crash. It looks like js optimizer is unable to deal with generated output.

Is there anything else we need to know about?

No response

@dipendrapkrl dipendrapkrl added the bug Something isn't working label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant