Code Monkey home page Code Monkey logo

Comments (8)

brezinajn avatar brezinajn commented on May 20, 2024 1

add this dependency

implementation("io.ktor:ktor-client-cio:2.1.1")

from supabase-kt.

jan-tennert avatar jan-tennert commented on May 20, 2024

Yes you need a Ktor Client Engine, might include this in the readme

from supabase-kt.

bhavinmac avatar bhavinmac commented on May 20, 2024

add this dependency

implementation("io.ktor:ktor-client-cio:2.1.1")

Now getting error "java.lang.IllegalStateException: The schema must be specified"

from supabase-kt.

jan-tennert avatar jan-tennert commented on May 20, 2024

Also the supabase url should just be https://MY_KEY.supabase.co
If you want to have a different URL just for realtime, you can change it in the realtime config but supabase-kt handles the urls for the different modules automatically

General Info

* [x]  I installed the latest version of Supabase-Kt

* [x]  I checked for similar bug report

What happened? (include your code)

class SplashKotlinActivity : AppCompatActivity() {

val supabaseClient = createSupabaseClient {
    supabaseUrl = "https://MY_KEY.supabase.co/realtime/v1"
    supabaseKey = "SUPABASE_KEY"

    install(Realtime)
}

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_splash)
    initializeAndroid(supabaseClient)

}

Run app and it crases and trows errro: java.lang.ExceptionInInitializerError

Platform(s)

Android

Relevant log output

java.lang.ExceptionInInitializerError
        at io.ktor.client.HttpClientJvmKt.HttpClient(Unknown Source:0)
        at io.github.jan.supacompose.SupabaseClientImpl.<init>(SupabaseClient.kt:94)
        at io.github.jan.supacompose.SupabaseClientBuilder.build(SupabaseClientBuilder.kt:30)
        at com.wweevv.SplashKotlinActivity.<init>(SplashKotlinActivity.kt:65)
        at java.lang.Class.newInstance(Native Method)
        at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
        at android.app.Instrumentation.newActivity(Instrumentation.java:1272)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3389)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3620)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2183)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:241)
        at android.app.ActivityThread.main(ActivityThread.java:7617)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
     Caused by: java.lang.IllegalStateException: Failed to find HTTP client engine implementation in the classpath: consider adding client engine dependency.

from supabase-kt.

jan-tennert avatar jan-tennert commented on May 20, 2024

add this dependency

implementation("io.ktor:ktor-client-cio:2.1.1")

Now getting error "java.lang.IllegalStateException: The schema must be specified"

This exception is thrown if you try to listen for db changes without actually specifying a schema.
See https://github.com/supabase-community/supabase-kt/tree/master/Realtime under Listening for Postgres changes for more informations

from supabase-kt.

brezinajn avatar brezinajn commented on May 20, 2024

This actually bugs me. Even though I like the DSL style for settings, it doesn't force the consumer to provide required arguments and results in crash at runtime and it increases difficulty for new users. So maybe we should force required args as function arguments.
e. g.

createSupabaseClient(
    supabaseUrl = "https://MY_KEY.supabase.co/realtime/v1"
    supabaseKey = "SUPABASE_KEY"
) {
    install(Realtime)
    ...
}

Even more so now when this library is part of supabase community (congrats btw :) great job). So there is actually a danger of people using it :D

from supabase-kt.

jan-tennert avatar jan-tennert commented on May 20, 2024

This actually bugs me. Even though I like the DSL style for settings, it doesn't force the consumer to provide required arguments and results in crash at runtime and it increases difficulty for new users. So maybe we should force required args as function arguments. e. g.

createSupabaseClient(
    supabaseUrl = "https://MY_KEY.supabase.co/realtime/v1"
    supabaseKey = "SUPABASE_KEY"
) {
    install(Realtime)
    ...
}

Even more so now when this library is part of supabase community (congrats btw :) great job). So there is actually a danger of people using it :D

Thanks, yea you are right, maybe I should change that!

from supabase-kt.

jan-tennert avatar jan-tennert commented on May 20, 2024

I'd close this issue to keep things clean. Feel free to open another issue when you have any issues!

from supabase-kt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.