Interact with Supabase CLI in WeWeb

Hi there,

This may seem very ignorant, but I am not sure how to do it.
When interacting with supabase in terminal for a vue.js app for example, all the supabase documentation shows you how to do basically anything from having your own functions, triggers, sending backend emails etc… done from the CLI.

But on Weweb, only the plugin is available to me (sign up, sign in, select, insert, upsert etc…), and trying to use javascript to communicate with supabase for anything else that is more complex will expose my key.

Could you please steer me in the right direction?
Many thanks in advance.

Edit: So, I think I should be using the REST API plugin. I will reply to myself and describe how to do it for future users.

1 Like

Hi @aeynaud :wave:

Could you tell us a bit more about your use case?

I’m currently making a list of tutorials we should record to users work with Supabase and would love to know what would be most helpful.

A word of caution: all the calls made with the REST API plugin are visible in the user’s browser.

1 Like

Hi @Joyce ,

Many thanks for your word of caution, that is something that I would have overlooked.

So, after some digging I understand that I can install the supabase CLI on my local machine, and then link it to a project that I have previously made online (which is the one I use with WeWeb). Then, from the command line I can create custom edge functions like sending custom emails with a third party app etc…

Basically, the CLI gives you full control of your supabase project which is as expected. However, this requires that I host my own linux server with supabase and connect it to WeWeb somehow. And then from WeWeb, get a workflow to somehow tell supabase to execute the function. Hmm.

My usecase: I would like to use custom edge functions in supabase. If a user clicks a button, I want to be able to send an email. There is the weweb email plugin, yes, but something like sending a magic link or custom invitation requests is more obscure and weweb email would not be useful in this case. I understand that this is a Supabase issue, not a Weweb issue - but I wouldn’t know how to make a button that sends an email without using REST for example. So not sure where to go from there.

Hopefully this gives you a good anecdote for when you decide what to include in your Supabase tutorials :slight_smile:

You need to use CLI on your machine indeed, you sign in with your credentials, you write and deploy your Edge Function. After that you can use the Supabase SDK instance which WeWeb (not officially) provided (this is soon gonna be deprecated for a newer version 2).

I think here you can find the exposed instance of supabase to use to trigger the Supabase Javascript Client - Invokes a Supabase Edge Function. but I’m not sure whether you can use this feature this way, might be a question for @Alexis

1 Like

Yes I guess it should works. And as the v1 and V2 signature looks similar it should still work after we upgrade to the v2. But I will note to include a new edge function action in our supabase plugin for the next rework!

4 Likes

Hey Alexis, do you have some information for us, when the upgrade to v2 will be released? :smiley:

Work in progress, should happen this month!

Upgrade to v2 is done but we will have to communicate to people doing custom code with supabase so they can update their project before the release and we still have many new toys to implement we would like to release everything together :slight_smile:

If it take too much time we will probably split in two releases like we did for Xano, so we can ensure supabase will receive an update this month with the v2 of the sdk!

2 Likes

Hey @aeynaud How did u connect supabase cli with Weweb? Can you please help me?