supabase-community / supabase-kt

A Kotlin Multiplatform Client for Supabase.
https://supabase.com/docs/reference/kotlin/introduction
MIT License
418 stars 37 forks source link

[Question]: error: Could not find: io.github.jan-tennert.supabase/postgrest-kt-iossimulatorarm64 #273

Closed eric-ampire closed 1 year ago

eric-ampire commented 1 year ago

General info

What is your question?

Adding the dependency io.github.jan-tennert.supabase:postgrest-kt:VERSION is crashing on ios saying "error: Could not find: io.github.jan-tennert.supabase/postgrest-kt-iossimulatorarm64/1.3.0-rc-2"

Is there any way to fix this ?

jan-tennert commented 1 year ago

What do you mean crashing? On import or when running the app? Also how is your project structured? The dependency is not missing on maven central. Can you share your build file?

eric-ampire commented 1 year ago

The supabase dependency present on my KMM project like this

val commonMain by getting {
    dependencies {
      api("io.github.jan-tennert.supabase:postgrest-kt:1.2.0")
    }
}

When I compile the Android app, everything went well, but went it come to compile the ios app I'm getting the error saying "Could not find: io.github.jan-tennert.supabase/postgrest-kt-iossimulatorarm64"

I've just go through all the sample projects currently available "https://github.com/supabase-community/supabase-kt/tree/master/demos" and I've not seen any ios targed, it mean that the iOS target is not supported yet ?

jan-tennert commented 1 year ago

No, ios is supported. There is no ios target in the demos because I cant run ios apps for testing. Is this the full error?

eric-ampire commented 1 year ago

I've just fixed the issue, the version 1.2.0 wasn't compatible with kotlin 1.8.21

jan-tennert commented 1 year ago

Okay great! Do you need any further help?

eric-ampire commented 1 year ago

Right now I'm trying to use gotrue for auth,

apiClient.gotrue.signUpWith(Email) {
  email = "sample@gmail.com"
  password = "pass"
}

But I'm getting this error "(POST) failed with message: Failed to connect to localhost/127.0.0.1:443", there's any particular reason for that ?

jan-tennert commented 1 year ago

Did you add the internet intent? (Assuming this is on android)

eric-ampire commented 1 year ago

I do also have an error on iOS, I've the internet permission on Android

NSErrorFailingURLStringKey=https://localhost/auth/v1/token?grant_type=password&redirect_to=https%3A%2F%2Fbe-served.com, NSErrorFailingURLKey=https://localhost/auth/v1/token?grant_type=password&redirect_to=https%3A%2F%2Fbe-served.com, _kCFStreamErrorDomainKey=1}

jan-tennert commented 1 year ago

Okay, I assume you have your correct supabase url in the supabase client? Which Ktor engines are you using?

eric-ampire commented 1 year ago

I've just double check, the supabase url is correct https://.supabase.co

eric-ampire commented 1 year ago

Is there anykind of config I need to do in order to make it work

createSupabaseClient(
  supabaseKey = BuildConfig.SUPABASE_TEST_API_KEY,
  supabaseUrl = BuildConfig.SUPABASE_TEST_URL,
  builder = {
    install(Postgrest)
    install(GraphQL)
    install(GoTrue)
  }
)
jan-tennert commented 1 year ago

No that seems right. Localhost is fallback url for internet problems, did you test this on an emulated device? Or could you try your code on a real device?

(Closing issue as this is off-topic)

jan-tennert commented 1 year ago

@eric-ampire Do you use the CIO ktor engine? Maybe that's doing some trouble, I also had a similar problem when I used this engine

eric-ampire commented 1 year ago

Yeah I've used that engine

jan-tennert commented 1 year ago

Try OkHttp for Android and Darwin for IOS, maybe that will help