BoogersLLC
05/01/2023, 12:22 PMRytterboi
05/01/2023, 12:43 PMError in fetching data:
, error);
}
return new Response("Data fetched and logged", { headers: corsHeaders });
}
return new Response("Not Found", { status: 404 });
});
// Helper function to read the entire stream
async function readEntireStream(stream) {
const reader = stream.getReader();
let result = "";
const decoder = new TextDecoder();
try {
while (true) {
const { done, value } = await reader.read();
if (done) {
break;
}
result += decoder.decode(value);
}
} catch (error) {
console.error("Error reading stream:", error);
} finally {
reader.releaseLock();
}
return result;
}tr1cksnl
05/01/2023, 1:32 PMmattposgate
05/01/2023, 2:10 PMMusashiGarami
05/01/2023, 2:12 PMsystemaddict
05/01/2023, 2:29 PMRONEN
05/01/2023, 3:02 PMBassemAzizi
05/01/2023, 3:45 PMnimo
05/01/2023, 4:56 PMencode(COLUMN, 'escape')
but this function doesn't appear to exist in supabase.
https://cdn.discordapp.com/attachments/1102639808163102730/1102639808284741782/Screenshot_2023-05-01_at_12.55.49_PM.pngā¾
brt
05/01/2023, 5:01 PMMiles
05/01/2023, 5:40 PMsignOut
or any changes happening in the user's account.
For the requests hitting a 401, basically around the time the token expires and should refresh, calling try await client.auth.session
and immediately sending a server request sometimes gives an error when then trying to use that token on the server (await getSupabaseAdmin().auth.getUser(accessToken)
). It is always expired within 60s, meaning I think this is a very simple case of refreshing the token too late in the logic of auth.session
in the swift library. Does anyone have a fix for this?
For the user sometimes getting signed out, sometimes I just get a random sign out event and sometimes the auth.session
calls always throw an error: GoTrue.GoTrueError.APIError(message: nil, msg: nil, code: nil, error: Optional("invalid_grant"), errorDescription: Optional("Invalid Refresh Token: Refresh Token Not Found")
. Does anyone know how to fix this?
Thanks a lot in advance!DignifiedSwine
05/01/2023, 7:27 PMš²šššš
05/01/2023, 9:25 PMcreate or replace function entry_decit(jid_ int, choice text)
returns void
language sql
as $$
update journal
set status = case when (choice = 'y') then ('apr') when (choice = 'n') then ('rej') else ('und') end
where journal.jid = jid_;
$$;
Running select entry_decit(49, 'y')
, from the SQL editor runs the function as expected. But calling that same function from the front end produces the following errors...
[Project URL]/rest/v1/rpc/entry_decit 400
(anonymous) @ VM146 supabase-js@2:7
(anonymous) @ VM146 supabase-js@2:7
o @ VM146 supabase-js@2:7
Promise.then (async)
l @ VM146 supabase-js@2:7
(anonymous) @ VM146 supabase-js@2:7
o @ VM146 supabase-js@2:7
(anonymous) @ VM146 supabase-js@2:7
then @ VM146 supabase-js@2:7
VM150 app.js:393 {code: '21000', details: null, hint: null, message: 'UPDATE requires a WHERE clause'}
apr_jrnl_entry @ VM150 app.js:393
await in apr_jrnl_entry (async)
onclick @ VM155 jrnl_entry.html:1
{code: '21000', details: null, hint: null, message: 'UPDATE requires a WHERE clause'}
I'm sure it's not a RLS thing because another function that makes changes to another table works as expected when called from the frontend. It has the same RLS policies as this table.
this is the call BTW...
async function apr_jrnl_entry(ch) {
//does not want to work for sum reason
let jrnl_id = (new URL(document.location)).searchParams.get('journal')
console.log(ch + jrnl_id);
let { data, error } = await sb.rpc('entry_decit', {jid_: jrnl_id, choice: ch})
if (error) {
console.error(error)
} else {
console.log(data)
}
}
Thanks in advance.Hugos
05/01/2023, 10:30 PMbrt
05/02/2023, 12:27 AMHartaithan
05/02/2023, 1:00 AMnoOne
05/02/2023, 1:06 AMfortuitoustortoise
05/02/2023, 1:47 AMhttps://cdn.discordapp.com/attachments/1102773380073132193/1102773380261888050/Screen_Shot_2023-05-01_at_20.45.03.pngā¾
Vireve
05/02/2023, 2:22 AMpublic.profiles
that is essentially 1 to 1 with auth.users
.
Should I just make the primary key of public.profiles
the same as auth.users
? As a follow up, for all tables that depend on a user, should I make sure to reference auth.user.user_id
Dawnmist
05/02/2023, 3:16 AMBravoSix
05/02/2023, 4:48 AMshiftkeyisbroke
05/02/2023, 6:18 AMuseUser
from @supabase/auth-helpers-react
returns back an authenticated session?Jon
05/02/2023, 6:29 AMWarlando
05/02/2023, 7:56 AMGOTRUE_MAILER_TEMPLATES_INVITE=<URL>
but I'm not planning to self host and only want to be able to set my own email templates in local dev. How could I achieve this?RB_Gaura
05/02/2023, 8:06 AMLAH
05/02/2023, 8:08 AMCREATE OR REPLACE FUNCTION check_role(uid_input uuid) RETURNS text
LANGUAGE plpgsql
AS $$
BEGIN
RETURN (
SELECT role
FROM auth.users
WHERE id = uid_input
);
END;
$$;
but I have issues calling it in the policy:
(check_role(auth.uid()) = 'admin'::text)
my user has the role "admin" and when running the same code (as in the policy) in the "SQL editor" with the uid hardcoded it returns true.
the role "admin" has permissions to see the table because if I only write "true" as the policy expression everything works as expected.BakaPresident
05/02/2023, 9:47 AMerik-beus
05/02/2023, 9:54 AMselect
cast(timestamp as datetime) as timestamp,
event_message,
r.status_code
from edge_logs
cross join unnest(metadata) as m
cross join unnest(m.response) as r
where
r.status_code >= 500
order by
timestamp desc
limit 100
Hugos
05/02/2023, 9:58 AMRB_Gaura
05/02/2023, 10:36 AMsql
BEGIN
-- Insert a row into public.profiles with metadata and profile data
INSERT INTO public.profiles(id, created_at, updated_at, display_name)
VALUES (NEW.id, NEW.created_at, NEW.created_at, NEW.raw_user_meta_data->>'name'
);
RETURN NEW;
END;