bhaskar
07/29/2022, 10:07 PMauth.role() = 'authenticated'
in a function. it returns false when i refresh the page on the ui, even when i have a valid cookie.HEAVYPOLY
07/30/2022, 12:51 AMpocin
07/30/2022, 9:26 AMpgTAP
tests against localhost deployment?
(or install pg_prove
fwiw)
https://supabase.com/docs/guides/database/extensions/pgtap#running-a-test ?
I have troubles understanding the docs https://pgtap.org/pg_prove.htmlmhaezaragoza
07/30/2022, 12:11 PMpocin
07/30/2022, 2:26 PMThe AI
07/30/2022, 2:33 PMstukennedy
07/30/2022, 5:18 PMsupabase link
and the subabase db reset
but when I run it, there's no tables or anything in the setup. The link to supbase studio works but everything is empty and just continually loading.
So it feels like I'm just missing some way of getting a migration running or something to clone the data of my actual project onto the local instance.
Any ideas?
Anyone got this working.
Supabase running inside gitpod with my whole dev env in there would be total magic.unknown1337
07/30/2022, 7:23 PMb----nessmen
07/30/2022, 8:37 PMsudoramen
07/30/2022, 10:16 PMawait supabase.storage.listBuckets()
but I get an error message: Migration failed. Reason: An error occurred running 'pathtoken-column'. Rolled back this migration. No further migrations were run. Reason: relation "storage.objects" does not exist
. Am I missing something?Needle
07/30/2022, 11:20 PMAlexRodgers
07/30/2022, 11:38 PMprofile.png
. Is there a way to create a unique file name in supabase like how unique ids are generated for db rows using uuid
or do I have to create the unique name myself?Sree
07/31/2022, 6:23 AMprojects
and a runs
table, where runs.project_id
has a foreign key mapping projects.id
. Another column on the projects
table is the user_id
which maps to the user who created the project.
I've also created a RLS policy on the runs
table as such:
create or replace function get_runs_for_user(user_id uuid) returns setof uuid as $$
select runs.id from runs, projects where runs.project_id = projects.id AND projects.user_id = $1
$$ stable language sql security definer;
create policy "Allow individual read access for user's runs" on runs
for select using (
id in ( select get_runs_for_user(uid()))
);
Essentially the user selecting into the runs
table must match the project's user_id
. However, as a result of this policy my inserts are failing (due to the default insert + select behavior). I was wondering if anyone has a suggestion to do the insert? I use graphql to create the mutation that does the insert and I do the insert into the projects
and runs
table in the same mutationRían
07/31/2022, 9:21 AMVilian
07/31/2022, 10:59 AMTARS
07/31/2022, 11:37 AMSTILLWATER;
07/31/2022, 1:30 PMLior539
07/31/2022, 2:36 PMQBeast
07/31/2022, 6:10 PMconst session = supabase.auth.session();
setUser(session?.user ?? null);
This part works. The part that I can't get to work is getting the list of contacts. The SQL is easy:
select * from auth.users where id in (select c.contact_id from public.contacts f where f.user_id = '<uuid>')
I created an rpc function called getUserContacts that returns a set of users:
create or replace function getUserContacts(userId uuid)
returns setof users
language sql
as $$
select * from auth.users where id in (select c.contact_id from public.contacts f where f.user_id = userId)
$$
Calling the function returns this error:
{"code":"42501","details":null,"hint":null,"message":"permission denied for table users"}
Is the auth.users table not supposed to be referenced? This is a brand new database I just created from scratch. Is there a way to do this kind of query using the supabase client? I couldn't figure that part out which is why I created the rpc function.
Any tips or help would be greatly appreciated!aetinx
07/31/2022, 6:16 PM{
"message": "No API key found in request"
}
Albert [tox/cis]
07/31/2022, 6:45 PMpublic
schema?Pragy
07/31/2022, 7:32 PMsql
create table example
(
id uuid default uuid_generate_v4() not null primary key,
name text not null,
description text not null,
created_at timestamptz default now() not null
);
create view public.example_view as
select *
from example;
Generated definitions:
ts
example: {
id: string;
name: string;
description: string;
created_at: string;
};
example_view: {
id?: string;
name?: string;
description?: string;
created_at?: string;
};
PS: just to point out - it seems that nullable columns on views is a limitation of Postgres - it doesn't seem to keep track of nullability properly.
https://stackoverflow.com/questions/17301323/why-are-my-views-columns-nullable/17310913
So my question basically is, is there a simple workaround for this via supabase? Some way we could force the view API to have the same nullability as the underlying table?rizistt
07/31/2022, 7:42 PMVillage
07/31/2022, 10:43 PMaetinx
08/01/2022, 12:09 AMunalive8
08/01/2022, 1:10 AMonAuthStateChange
is never called unless I changed tabs. if I stay on the page even for 5 min after being redirect nothing happensIze_Cubz
08/01/2022, 4:01 AMMarkeem
08/01/2022, 8:26 AMshiro44
08/01/2022, 9:44 AMlooni
08/01/2022, 10:09 AMSELECT
DISTINCT column1
FROM
table_name;