This page contains common problems and solutions for the supabase-kt library.
To see debug logs, you have to change the defaultLogLevel
in the SupabaseClientBuilder
to LogLevel.DEBUG
:
val supabase = createSupabaseClient(supabaseUrl, supabaseKey) {
defaultLogLevel = LogLevel.DEBUG
}
supabase-kt is trying to connect to "localhost"
If you are on android, make sure you add the following intent:
<uses-permission android:name="android.permission.INTERNET" />
Also check if you are using the correct url. If you are using the Supabase hosted version, use https://<project-id>.supabase.co
as the url. If you are using your own Supabase instance, use the url of your instance.
Request failed with TLS sessions are not supported on Native platform
Assuming you are on the iOS target, try to use the Darwin Ktor client engine.
[Android] Retrieving data in the background does not work
By default, if the App changes into background, the Auth plugin clears the session from memory as auto-refresh is also disabled. To disable this behavior, change the enableLifecycleCallbacks
property in the Auth config to false
.
Note that this will generally disable the automatic session refresh and session loading, so you have to handle this yourself.
My postgrest select request / bucket list request returns an empty list
Make sure you are using the correct table name. Also, if you have RLS enabled, make sure your user has access to the table.
Serializer for Class 'YourClass' not found
If you are trying to use a custom class as a parameter in a postgrest request, you have to register a serializer for that class. You can do this by adding the following line to your code:
@Serializable
data class YourClass(
val id: String,
val name: String
)
I get an error when I try to use the Realtime plugin: IllegalArgumentException: Engine doesn't support WebSocketCapability
Not all Ktor client engines support Websockets. If you are using Android, you can use OkHttp or CIO instead.
Auth#sessionStatus doesn't change when signing up
If you don't have auto confirm enabled, your user has to confirm their email/phone number before they can sign in. Once they confirm, the session status will change. On Android and iOS, you can use deeplinking to automatically sign-in when the user clicks on the confirmation link.
Deeplinking successful, but there is no session in the Auth plugin
Make sure you call the handleDeeplinks
method in your activity/fragment. This method will check if the deeplink is valid and if so, it will initialize a session.
Also make sure you specified the right schema and host in the Auth plugin.
If that doesn't help, enable logging and check for errors.
If your problem does not occur here, feel free to create an issue or a discussion.