Supabase Problem

I’m using the SupabaseAuthentication and SupabaseDatabase components. And they’re working fine. The login, the registration, etc. Even fetching data from the table is working fine. But the issue is that whenever i try to insert data in a table, it gives me this error: “Supabase Database Error: Secret API key required”.

I enabled RLS on my tables for security enhancement. However, i tried disabling RLS for the specific database that I’m trying to insert data into and I’ve also tried to add specific policies to allow the insertion for verified users. Both of those solutions didn’t work for me.

And if it’s really about the Secret Key or whatever, there’s no field OR block for a secret key ANYWAY. So, I don’t know what to do with it to be honest.

Does anyone know a solution to that? If so, what? If not, is it a bug?

TL;DR
Supabase is ASKING for the SECRET KEY when inserting data. Any solutions?

Add API key to the request, or use user access token

I’m using the user access token and I have the API key and the url. If i didn’t have them, i wouldn’t be able to fetch the data in tables or login or whatever else. Especially that i have RLS on, so nobody can even view the tables unless they’re authenticated. But it doesn’t let me insert data and it’s weird that it asks for the Secret Key without having any fields or blocks to add it.

Show us how you’re handling your blocks

You need to connect the getter of SupabaseAuthentication to the setter of SupabaseDatabase.

“JWT auth token from SupabaseAuthentication (optional, enables RLS). Set at runtime from SupabaseAuthentication.AccessToken after sign-in.”

That’s exactly what i did above dude.

Sorry,
My page hadn’t refreshed

Try using the local var block
immagine

No problems.
I have tried that now and nothing changed.
Also, keep in mind that through the same table i can fetch data. So i don’t think that’s the issue.

Here I am, sorry I had to step away from the PC.
I’m not sure if it’s related, but I don’t see the table being set before performing the insert.

Just adding something to that, I think best way is to use Web component, as you can see
immagine
there’s no refresh token here, of which user won’t be able to refresh token​:confused: how’s the access token refreshed when session expired?

1 Like

The blocks dedicated to token refresh do exist, so it could be handled, however

I also recommend using the Web component :grin:

1 Like

I don’t think that’s the issue. Although, it might be another issue because i didn’t handle that yet. But i don’t think that that’s what’s causing the request for secret key.

I think that too. But my whole app is dependent on this component now and I’ve wasted a lot of time. Which is what brought me here. I want to figure out whether that’s my problem or a bug. Otherwise, it’ll waste other people’s time too.

If this reply

is referring to…

I’m 100% sure that block needs to be set, so if you’re telling me you haven’t done it yet, do it! :grin:
Even just for the reason that you’ll definitely need it later once we’ve found the issue.

1 Like

It’s already done. I mentioned above that everything is working except the insert.

Yeah i know. I think it’s a bug. It shouldn’t ask me for the secret key. But the tables are set so you know.

1 Like

I also tried it and I can confirm the bug.
I need to step away from the PC for a moment.

As soon as I’m back, I will carry out further checks and if necessary I’ll add it to the BugsTracker.

1 Like

Amazing. Let me know if you find anything.

I’m back!

Let’s do one final check.

Try to verify here whether you are correctly exposing the tables.

(In new projects I believe they need to be enabled manually)

After this change I was able to perform all operations without errors.