Supabase Auth (login error when filling the roles)

Hey there,
I hope you’re all doing well!
I have an issue with the Supabase auth.

When I add the roles to my supabse auth plugin, the login action returns an error

_
Any idea why ?

Could that be the name of my tables that need to match exactly a certain string ?

name: "TypeError"
stack: "TypeError: Cannot read properties of null (reading 'map') at Object.getUserRoles (https://cdn.weweb.io/components/1fa0dd68-5069-436c-9a7d-3b54c340f1fa/ddaa95e9-ca4c-42d6-8e76-e4efe9108ca7/dist/man..."
message: "Cannot read properties of null (reading 'map')"

In the meantime, I removed the Supabase Auth plugin, reverted to the table names provided by WeWeb, namely:

  • roles
  • userRoles with userId and roleId I then reinstalled the Auth plugin and tested my login action again. But I’m still getting the same error…

Check your RLS, this means that the table is not available, or WeWeb can’t find the columns/can’t access it to look up the roles.

I thought so too @Broberto, so i’ve disabled the RLS on my tables, especially roles and userRoles table, but i keep getting the same issue.

Here is the thing:
in the public schema, I have a table called user, with the id being the FK to my auth.users,
AND I also have a table operator with the id also being the FK to my auth.users.

Those operators are some sort of admin of the app.

Maybe this is where the error lies…

I think I get where the error lies.
my Supabase action “Sign in” look in the table “user” and not operator, and since there isn’t any email matching the auth.users it returns an empty array.


Hi Matt, I have the exact same problem, how did you fix it ? Thanks

@Louis.adb I’ve given up to use the native role like weweb offers it to do. I just leave it blank in the configuration.

And I’ve create an app workflow that checks the user role, and redirect if he hasn’t got the right role

1 Like