matt-j-stevenson
01/14/2023, 5:33 PManggoran
01/14/2023, 5:43 PMCzarSalad
01/14/2023, 5:44 PM//query the data
const result = await supabase
.from('reactionroles')
.select('*')
.where('emoji', theEmoji)
.and('message_id', theMessage)
.orderBy('id', 'asc')
.offset(2)
.first()
Here is the error I got:
{
"error": {
"message": "supabase.from(...).select(...).where is not a function",
"stack": "TypeError: supabase.from(...).select(...).where is not a function\n at (/functions/events/discord/message/reaction/reaction-role-add.js:19:2)"
}
}
So from what I understand .where and .and literally don't exist in the API. But I have no clue what to replace them with. Can anyone help?rchrdnsh
01/14/2023, 6:16 PMpostgresql
-- 1. Create table
create table string_posts (
id int8 unique not null primary key,
created_at timestamp with time zone,
updated_at timestamp with time zone,
slug text unique,
title text,
description text,
content text
);
-- 2. Enable RLS
alter table string_posts
enable row level security;
-- 3. Create policies for table
create policy "Public profiles are viewable by everyone." on team
for select using (true);
create policy "Only team members can edit posts."
on string-posts
for update using (
right(auth.jwt() ->> 'email', 13) = '@arrowgtp.com'
);
Elliott Storey
01/14/2023, 6:21 PMmotorhead
01/14/2023, 6:26 PMcorey
01/14/2023, 6:27 PMPauline_Cx
01/14/2023, 6:27 PMNin
01/14/2023, 7:25 PMfridon
01/14/2023, 7:48 PMsql
CREATE OR REPLACE FUNCTION is_member_of(_user_id uuid, _organization_id uuid) RETURNS bool AS $$
SELECT EXISTS (
SELECT 1
FROM user_metadata um
WHERE um.org_id = _organization_id
AND um.id = _user_id
);
$$ stable language sql security definer;
I want to allow service_role key to bypass this function and since this function bypasses RLS anyway, I get no data when using the service role.
Is it possible to do so, maybe with CASE or IF statement within the function?luke90275
01/14/2023, 7:48 PMjs
await supabase.storage.from('storage').upload(key, value, { upsert: true });
However, I am running into the following error:
{statusCode: '403', error: '', message: 'new row violates row-level security policy (USING expression) for table "objects"'}
As shown in the image, I believe my policies should allow one to upsert (either update or insert) as they are as lenient as possible [right?]. Any ideas what could be happening here?J0rdan
01/14/2023, 8:53 PMmalachi
01/14/2023, 10:11 PMBruce
01/14/2023, 11:28 PMError: Failed reading config: Invalid db.major_version: 15.
Does someone know why this happens?pablo
01/15/2023, 5:28 AMAlaanor
01/15/2023, 8:33 AMsilentworks
01/15/2023, 10:20 PMauth.users
table, go to the table view and select the auth
schema and look if there is a users
table in there. If there isn't then your project wasn't setup correctly or you have run some sort of migration tool on the project that has wiped that schema/table.KERSTIN
01/15/2023, 10:51 AMMihai Andrei
01/15/2023, 11:46 AMcorey
01/15/2023, 11:58 AMOlyno
01/15/2023, 12:15 PMcould not find array type for data type uuid[]
Here is my function:
sql
create or replace function is_in_organization(id_organization uuid)
returns boolean
language sql
security definer
set search_path = public
stable
as
$$
select exists (
select 1
from organizations
where organizations.id = $1
and (is_owner_of($1) or auth.uid() = any (organizations.members))
)
$$;
I'm using it as RLS check like: ``is_in_organization(id)``
My ``organizations`` table looks like that:Kamael愛
01/15/2023, 12:55 PMconst {data, error, status} = await supabase.from("kuma_resources")
.update({
acid: parseInt(acid),
metal: parseInt(metal),
fossil: parseInt(fossil),
magic_dust: parseInt(magic_dust),
})
.eq("profile_id", stealer.id)
.select()
console.log(data, error, status);
When I run this code, it returns the following response:
json
{
data: [],
error: null,
status: 200
}
why is it returning 200
and doesn't return the affected data even if I have a .select()
? I have checked the stealer.id
in the kuma_resources
table and it exists there.Alexander
01/15/2023, 1:20 PMWuju
01/15/2023, 6:08 PMsupabase/auth-helpers-react
, and Google Oauth provider.
After signing in, my session and my user stay null.
For exemple on this screen, the text never appears even after logging in and returning to the same pageCake
01/15/2023, 7:03 PM<a href="{{ .ConfirmationURL }}/auth/set-password">
the /set-password
bit i found online to be able to redirect to a page where I can tell the user to set their password.
My concern here is: How can i check that the user haven't allready set the password after the initial signup? This is to prevent people from accessing the url /auth/set-password
directly.
Any thoughts on how I can solve this?DDupasquier
01/15/2023, 9:02 PMHugos
01/15/2023, 9:55 PMIkhsan Assaat
01/15/2023, 10:07 PMiStun4Fun
01/15/2023, 11:24 PMdav
01/16/2023, 12:02 AMSELECT count(1) FROM pg_stat_activity where state='idle'
) and there were 13, 9 of which have the usename authenticator