Good afternoon, in my attempt to read the records of a table created in Supabase, I get the following error.
This is the code...
ResponseError. Reason: , Response: {"error":"invalid_request","error_description":"refresh_token required"}
Token received. Expires: 01/01/1970 01:00:00
Error occurred on line: 186 (Supabase_DatabaseSelect)
java.lang.ClassCastException: class b4j.example.supabase$_supabaseerror cannot be cast to class b4j.example.supabase$_supabasedatabaseresult (b4j.example.supabase$_supabaseerror and b4j.example.supabase$_supabasedatabaseresult are in unnamed module of loader 'app')
at b4j.example.b4xmainpage$ResumableSub_Button1_Click.resume(b4xmainpage.java:124)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:47)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:42)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:156)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:105)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at anywheresoftware.b4a.keywords.Common$3.run(Common.java:1119)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
This is the code...
B4XMainPage:
#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private xSupabase As Supabase
Private KEY As String
End Sub
Public Sub Initialize
B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
KEY = "XXXXXXXXXXXXXXX.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFqdnRiYXN3eXdvenRqbWFqZWNiIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTY5NDY3MjY5MSwiZXhwIjoyMDEwMjQ4NjkxfQ.1D9pOcghLoGnLQl0KhjWP3jbUM_lYxF0DcLGwNpvRN0"
xSupabase.Initialize("https://XXXXXXXXXXX.supabase.co", KEY)' I rechecked anon key again.It is correct'
xSupabase.InitializeEvents(Me,"Supabase")
If xSupabase.IsInitialized = True Then
xSupabase.Auth.RefreshToken
End If
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Private Sub Button1_Click
Dim Query As Supabase_DatabaseSelect = xSupabase.Database.SelectData
Query.Columns("*").From("hidrantes")
Wait For (Query.Execute) Complete (DatabaseResult As SupabaseDatabaseResult)
xSupabase.Database.PrintTable(DatabaseResult)
End Sub