burakovali
04/28/2023, 7:30 AMaaa983898943943
04/28/2023, 7:53 AMLeDragunov
04/28/2023, 8:21 AMMirik
04/28/2023, 9:22 AMroom = await supabase
.channel('messages')
.on(
'postgres_changes',
{
event: 'INSERT',
schema: 'public',
table: 'messages',
filter: user_id=eq.${user.id}
},
(payload) => {
console.log('sender');
}
)
.on(
'postgres_changes',
{
event: 'INSERT',
schema: 'public',
table: 'messages',
filter: user_receiver_id=eq.${user.id}
},
(payload) => {
console.log('receiver');
}
)
.subscribe();
karankartikeya07
04/28/2023, 10:28 AMhttps://cdn.discordapp.com/attachments/1101454815814488084/1101454816011636797/supabase_error.png▾
https://cdn.discordapp.com/attachments/1101454815814488084/1101454816301031424/supabase_eror_2.png▾
j3llybeans
04/28/2023, 10:30 AMts
supabaseClient.auth.onAuthStateChange((event, session) => {
// either event.SIGNED_IN or event.INITIAL_SESSION
})
but they fired too often
I'm only looking to save the tokens to an HTTP only cookie on that event, from there on, i'll handle the refreshing part. (this is for a spotify app)DignifiedSwine
04/28/2023, 12:47 PMven
04/28/2023, 1:18 PM|- supabase
| |- functions
|- |- |-_shared (shared .ts files)
| |- |- <function-name>
| |- |- index.ts
|- |- |-import_map.json
|- .env.local
|- .env
|- .gitignore
|- config.toml
|- seed.sql
is it possible to created business logic base nested folders inside of /supabase/functions ? tiaenyo
04/28/2023, 1:42 PMOtherType | OtherType[]
Is there a way to specify that the embedded document can only be a single row?
https://cdn.discordapp.com/attachments/1101503594596925502/1101503594794074123/image.png▾
leoralon
04/28/2023, 1:48 PMhttps://cdn.discordapp.com/attachments/1101505243646275675/1101505243893731368/image.png▾
https://cdn.discordapp.com/attachments/1101505243646275675/1101505244250251314/image.png▾
Flemx
04/28/2023, 1:55 PMbenjamin_dobell
04/28/2023, 2:20 PMlouis030195
04/28/2023, 2:47 PMFlemx
04/28/2023, 3:19 PMniklasd
04/28/2023, 4:29 PM0xAsimetriq
04/28/2023, 4:33 PM/admin/generate_link
endpoint via fetch request below:
const response = await fetch(`${this.#apiUrl}/admin/generate_link`, {
headers: {
apikey: this.#apiKey,
Authorization: `Bearer ${this.#serviceRoleKey}`,
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify({
type: 'magiclink',
redirect_to: 'https://mysite.app',
email: 'myemail@gmail.com'
})
})
But I am getting an error response with following data. Really not sure what is wrong, all those secret this.
values are correct when logged.
{
"message": "no Route matched with those values"
}
ghostlinkz
04/28/2023, 5:37 PMhttps://cdn.discordapp.com/attachments/1101562899132059668/1101562899278864414/supa-statement.jpg▾
Sanctus
04/28/2023, 6:21 PMosamita
04/28/2023, 7:15 PM*,
people:auth_id!inner(*)
,
{
count: "exact",
}
)
.or("name.ilike.%ar%,last_name.ilike.%ur%,users.email.ilike.%aur%", {
foreignTable: "people",
});
this way, supabase responses: failed to parse logic tree ((name.ilike.%ar%,last_name.ilike.%ur%,users.email.ilike.%aur%)).
Second option:
adding other "or()" function under existent or() function, like this:
.or("email.ilike.%aur%", {
foreignTable: "people.system_users",
});
but using the second "or()", supabase does not response with any item [], even though the firs or() could match.Jolly Joy
04/28/2023, 7:52 PMsignUp
or signInWithOtp
method. Once I have identified the user's status (new or existing), I'd like to show different onboarding screens tailored to their experience.
In short, is running an RPC in the auth.users table for the phone number an appropriate way to check if the user is new or existing?
Appreciate any guidance or alternative suggestions on how to handle this situation.joshh
04/28/2023, 7:59 PMVik
04/28/2023, 8:15 PMCREATE OR REPLACE FUNCTION prevent_profile_updates()
RETURNS TRIGGER AS $$
BEGIN
IF NEW.profile_id != OLD.profile_id OR
NEW.joined != OLD.joined OR
NEW.follower_count != OLD.follower_count OR
NEW.following_count != OLD.following_count OR
NEW.post_count != OLD.post_count THEN
RAISE EXCEPTION 'You are not allowed to update this column.';
END IF;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER prevent_profile_updates_trigger
BEFORE UPDATE ON profiles
FOR EACH ROW
EXECUTE FUNCTION prevent_profile_updates();
I also have this trigger to update those columns +1 / - 1 whenever there are inserts or deletes. I created it as a SECURITY DEFINER but it seems even this can not bypass the previous trigger. What are my options?
CREATE OR REPLACE FUNCTION update_profile_counts()
RETURNS TRIGGER AS $$
BEGIN
IF TG_OP = 'INSERT' THEN
UPDATE profiles SET follower_count = follower_count + 1 WHERE profile_id = NEW.user_id;
UPDATE profiles SET following_count = following_count + 1 WHERE profile_id = NEW.followee_id;
ELSIF TG_OP = 'DELETE' THEN
UPDATE profiles SET follower_count = follower_count - 1 WHERE profile_id = OLD.user_id;
UPDATE profiles SET following_count = following_count - 1 WHERE profile_id = OLD.followee_id;
END IF;
RETURN NULL;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;
CREATE TRIGGER update_profile_counts_trigger
AFTER INSERT OR DELETE ON relationships
FOR EACH ROW
EXECUTE FUNCTION update_profile_counts();
gwaiLoFi
04/28/2023, 8:16 PMpg_advisory_lock
that we believe was caused by a broken migration routine... maybe?
Might be coming from pgbounce or something, but we have only just run into this issue today, long after setting up pgbouncer... Posting here in case there is something on the Supabase side or Postgres we should be aware ofb.
04/28/2023, 9:18 PMarthur5005
04/28/2023, 9:19 PMSupabaseClient
class in typescript and overridden the functionsUrl
property to point to the correct functions domain. Not the end of the world, but it's a bit verbose in typescript and was wondering:
1. Is there a better way to use a custom domain with a Supabase client instance along with functions?
2. Am I risking something silly extending the class like this?
Thanks!ven
04/28/2023, 10:18 PMhttps://cdn.discordapp.com/attachments/1101633459501420685/1101633459648213022/supabase_login_not_accepting_token.png▾
ven
04/29/2023, 12:25 AMhttps://cdn.discordapp.com/attachments/1101665489463287888/1101665489656234115/error_on_calling_the_edge_function_from_client.png▾
SunTzu
04/29/2023, 1:16 AMBoogersLLC
04/29/2023, 2:07 AMsql
(EXISTS ( SELECT 1
FROM decks
WHERE ((decks.id = notebook_users.notebook_id) AND (decks.user_id = auth.uid()))))
Here is my service call
notebook_users?notebook_id=eq.9c8f537d-2347-40ea-ad92-5866f04f0599&user_id=eq.090dca08-c31e-4fbb-8513-f96690c5263a
This is my current users id
7eefb80e-b6b1-4681-821c-b6fc713b3153
Thus when I manually write the RLS rule into a select statement I get
sql
select * from notebook_users where notebook_id = '9c8f537d-2347-40ea-ad92-5866f04f0599' and user_id = '090dca08-c31e-4fbb-8513-f96690c5263a'
and exists(select 1 from decks where id = '9c8f537d-2347-40ea-ad92-5866f04f0599' and user_id = '7eefb80e-b6b1-4681-821c-b6fc713b3153')
Which returns the row I'm trying to delete. -- However, I get a 204 success response, and the row does not get deleted.
- Also, I confirmed this is RLS, because if I disable RLS, I can remove the row.
Any ideas? Or suggestions to further debug this?wuxxy
04/29/2023, 2:12 AMSupabase Provider
thing.