[New Plugin] Supabase.js - With Auth, Data and Storage

@petersas you mean we use anon keys for client side right? If I don’t use supabase auth, there is no way for me to implement RLS Policy?

Like, I can’t use a rls policy with “Read/Update when user is authenticated” because we use bubble authentication.

I’m thinking if this is doable? Creating one-way sync with bubble auth to supabase auth?

  1. Create a field in user data in bubble “supabase_auth” (this will be the auth_id in supabase)
  2. Create a workflow for users who signed in WITHOUT supabase_auth to “reauthorize” or “reconfirm” password. Then use that reconfirm password to sign up a user in supabase then link that to the user in bubble database “supabase_auth”
  3. Then create a flow to login user in supabase also when that user signed in with bubble database

Hi Peter,

I am receiving the following error when filtering using “Column is in an array” with the any filter. I have not has issues with any of the other filter types.

Typically if there is issue with the filter syntax I will get a postgres error code. Not in this case.

Thanks,

Naveen

Thank you for the heads up @naveenreddyla I’ll take a look!

@shu.teopengco Using Bubble auth and Supabase DB is indeed tricky if it needs to be a private app. Maybe using Auth Hooks can be a help? Otherwise syncing Bubble and Supabase auth can be helpful in this case, and also in similar cases, for later migration too

Hi @petersas I am using your plugin and have some difficulties in loading data that has many to many relationship. Current situation is as below

  • Stories have many categories / categories have many stories
  • they are related through rel_stories_categories table

how can I get story with category infos and use it? kindly advise me. thanks!

[Urgent] @petersas Except if I am wrong, I see that SupabaseAuth.isLoggedIn and SupabaseAuth.hasLoaded always return “no”. Me being logged in with SupabaseAuth or not… It was not the case before.

@kevin41 I haven’t noticed this bug, they both should return yes when auth was successfully initialized and you’re logged in. I’ve just done a quick test, see below.


If the Auth element is not visible that could cause this behaviour

1 Like

Indeed it was not visible. Solved now. Thank you!

1 Like

There’s a quick tutorial I’ve made for loading data, and some advanced querying. There’s also some nice tutorials all around maybe they can be helpful: Supabase Join Queries Explained — Restack, Implementing many-to-many relationships with the UI · supabase · Discussion #710 · GitHub

But it really depends on your DB setup, joint tables are usually the way to go for doing scalable complex queries

Hi there. Thank you for your suggestion. However, I’m trying to sync bubble and supabase auth without success. The problem is, changing bubble password requires a password reset link as well as supabase. By doing so, you can only reset password either on bubble only or supabase only once at a time. How can you suggest doing the syncing? :sweat_smile:

Some new changes for [2.17.0] If you use Expected JSON Response, there’s a breaking change:

  • @shu.teopengco added a Server-side password update action, I’ll add the rest of the Auth Admin actions (like email) too later, maybe this helps!
  • @jamesnd added Invite User by Email as a server side action.
  • After a lot of head scratching Expeted JSON Response is now being renamed: Default Response Values. What it does it’s basically in the name. If there’s any null value coming from Supabase, the plugin will straight replace that with the value from this field. (will update/add tutorial later this week). This makes handling null and or default values a lot easier, and you can also customize it to your likings. Since the fields can take dynamic data from Bubble all the values can be dynamic, which makes ways to a lot of interesting use cases. This will also works now with deeply nested JSON with foreign tables.
  • Calling postgres functions can now take multiple arguments.
  • Data Realtime V2 (Beta) can now work with queries which includes foreign keys, but you need to check a new field has Foreign Table . However it’s still beta and some things will change, so it’s not yet production ready.
  • Edge functions can now have Header values and Method arguments.
1 Like

thanks Peter. Have just tested the invite user function and it works nicely. Very easy to do! Will play around with the best method for updating their ‘profile’ (following supabase videos, they show triggers which create that new user in a profile table). Thanks

1 Like

Thanks for this. Just to clarify, the server-side password update action doesn’t need previous password as well as any token to update password right?

Another one, I’m looking for this feature but can’t seem to find it. Is there any “Bulk Upsert” Feature?

Hi Peter, I’m trying to upload a file but I got this Request failed with status code 400

Yes, you can just set a new one and that’s it.

Not yet, but will add it

Is there any error message? Supabase usually returns why we get the error, so file is malformed, RLS is not correct etc.

Thank you. Looking forward for it. :smiley:
More power on your plugin. :slight_smile:

Hey ! Do you have an expert advice on how to manage the SupabaseAuth component overs several pages?

I am experimenting creating a SupabaseAuth reusable component. BUT I face an issue: I don’t know how to have the event “A SupabaseAuth unhandled error has occured” on the host page.

Would you have guidance on this topic? :pray:

Hi Peter,
First off, I’m not 100% sure if this is a plugin issue or a bubble issue so bare with me.

I have a table for storing custom filters, as these can vary depending on what page the user is on I have tried to make as universal as possible depending on what entity the user is trying to filter. To do this I use a jsonb column, example:

{
 "status": {
   "value": 5,
   "operator": "eq"
 },
 "name": {
   "value": "%something%",
   "operator": "ilike"
 },
 "approved": {
   "value": true,
   "operator": "is"
 },
 ...
}

I have an apiconnector set up for a single entity for testing right now, I have manually created each filter to be identical in structure so they contain all of the options, and then varied the contents of the filter values.

I then pass the apiconnector “thing” into a custom plugin which rips it apart and converts it into a query that the any filter of this plugin can accept.

All of this works absolutely fine for strings and integers. In the example json above, my code returns

.eq('status', 5).ilike('name', '%something%')

You’ll notice the result is missing the “approved” value, my code ignores empty/null values deliberately so as not to break the filter.

Therein lies the problem. Approved isn’t empty. It should be true. But when I use debug mode, the supabase element for the filters table is showing the result for approved is (empty) for every row, but the raw json body shows correctly (approved : true). I have set the apiconnector up to be a yes/no, I have also tried yes/no (+ blank option). Neither work. All of the boolean values in my filter json, every row, they are empty.
IS there something I’m doing wrong, or is there an underlying issue with how bubble interprets this?

I usually stick to 1 auth element per page, it’s easier to just have that on page-level. However triggering workflows from reusable you can use Toolbox plugin, and Run Javascript

It can be a combination of the plugin and Bubble, I have some ideas what it can be but I’ll send you a DM, so we can take a closer look!

No, just that.
this is my wf