silentworks
01/04/2022, 11:44 PMSteve
01/05/2022, 1:03 AMAnoushk
01/05/2022, 5:00 AMNascode
01/05/2022, 5:52 AMisAdmin
column. So user can login with anon key clientside.
2. Send the JWT after client side login to serverside. Verify it. And do administrative supabase function with servicekey.Anoushk
01/05/2022, 9:40 AMHal
01/05/2022, 10:20 AMxtc
01/05/2022, 11:05 AMFibrasek
01/05/2022, 1:31 PMrecipes
table with a foreign key named user_id
that is related to users.uid
. Then I created a policy on top of recipes
for users to be able to se only what they have created, so I wrote (auth.uid() = user_id)
. The problem is I can't see anything in my app and the queries always return RLS policy error :/silentworks
01/05/2022, 2:34 PMsilentworks
01/05/2022, 2:38 PMmendozer
01/05/2022, 2:43 PMNick
01/05/2022, 3:48 PMsetAuth
doesn't actually return a user, given a valid access token? https://supabase.com/docs/reference/javascript/auth-setauthsilentworks
01/05/2022, 4:13 PMNick
01/05/2022, 4:15 PMrpc()
features is in alpha preview?silentworks
01/05/2022, 4:26 PMNick
01/05/2022, 4:48 PMcreate or replace function get_or_create_api_key(user_id uuid)
returns setof api_keys
language plpgsql
as $$
declare
kk varchar;
begin
select key from api_keys into kk where api_keys.user_id = get_or_create_api_key.user_id;
if not found then
select digest(gen_random_bytes(32), 'sha512') into kk;
insert into api_keys(key, user_id)
values (kk, get_or_create_api_key.user_id);
end if;
select * from api_keys where api_keys.key = kk;
end;
$$;
Nick
01/05/2022, 4:48 PMcarl-ce
01/05/2022, 4:51 PMlocalhost:54323/project/default/api
is getting a 401 when communicating with kong - is this a known issue with the local setup?Nick
01/05/2022, 5:00 PMNick
01/05/2022, 5:08 PMNick
01/05/2022, 5:09 PMNick
01/05/2022, 5:09 PMgaryaustin
01/05/2022, 5:15 PMNick
01/05/2022, 5:17 PMsilentworks
01/05/2022, 5:18 PMChristopher
01/05/2022, 5:34 PMrudolfbono
01/05/2022, 5:36 PMnpm run build
the Next app before running npm run test
.
Problem: I get the error Error: supabaseUrl is required
during the build step.
This is happening because createClient(process.env.NEXT_PUBLIC_SUPABASE_URL ?? '', process.env.SUPABASE_SERVICE_ROLE_KEY ?? '')
runs on the client-side and I haven't passed those 2 environment variables to the GH action.
Solutions I'm looking at:
a) Add prod DB environment variables to the GH action so createClient()
doesn't throw an error. This feels too dangerous.
b) Create a special 'test' environment and pass its env variables to the GH action. This sounds like a lot of work as I'll have to manually keep the test DB in sync with prod DB.
c) Move createClient()
onto server-side and expose the client instance as an API for my frontend to consume. This way, npm run build
wouldn't need those ENV variables to build correctly. Is this even possible?
Thoughts 🙂 ?Joey Cabal
01/05/2022, 5:52 PMsilentworks
01/05/2022, 6:20 PMsilentworks
01/05/2022, 6:21 PM