eloahsam
02/26/2023, 3:16 PM\ ឵឵឵
02/26/2023, 3:40 PMgrant
is often the tool I would turn to, but this is complicated by not quite using the built-in Postgres role system in the usual way. In addition, I'd be interested in being able to determine the columns dynamically based on other properties of the user/context besides the user role.
What I'm wondering is if there is something similar to the using
clause in `create policy`—where I can use whatever functions etc. that I wish—that can be used to determine which columns should be accessible. Even if this was table-wide, like grant select (...)
, it would be a start, but of course it would also be nice to be able to determine it dynamically based on the content of the row, if necessary.Řambo
02/26/2023, 3:45 PMchrtravels
02/26/2023, 3:48 PMsomoni
02/26/2023, 4:20 PMCreix
02/26/2023, 5:24 PMreturn new Response(null, {
status: 302,
headers: {...corsHeaders, location: accountLink.url, "Content-Type": "application/json"},
});
I took corsHeaders
from supabase edge function docs.
And this is the error that I have on my client:
Access to fetch at 'https://connect.stripe.com/XXXX' (redirected from 'https://XXX.functions.supabase.co/stripe_onboarding') from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
salzar
02/26/2023, 6:18 PMGKL
02/26/2023, 6:26 PMDikiyKazah
02/26/2023, 6:31 PMUnknown Member
02/26/2023, 7:45 PMMichie
02/26/2023, 8:35 PMctulek
02/26/2023, 11:25 PMauthenticated
users. Inserts work fine and I can select records from the table, too. I have a realtime channel set as follows, but it doesn't receive any updates. Looking to the browser network logs, the websocket seems to be connected as I see some heartbeat messages going back and forth.
I have @supabase/auth-helpers-nextjs@0.5.4
and @supabase/supabase-js@2.8.0"
.jdgamble555
02/26/2023, 11:58 PMts
supabase.from('posts')
.select('*, author!inner(*)')
But how do I do this in pure SQL so that the results are inner json like Supabase does?
I'm thinking
sql
select * from posts
join profiles on profiles.id = posts.author
But this won't make the results nested json like I want or give my desired results:
There seem to be lots of confusing examples with json_agg()
, row_to_json()
, array_agg()
and json_build_object()
, none of which are simple or clear.
What's the simple translation for this?
Thanks,
JDeng
02/27/2023, 12:22 AMHayato
02/27/2023, 12:29 AMconst res = await supabase.auth.signInWithPassword({
email: data.email,
password: data.password,
});
console.log(res);
{
"data": {
"user": null,
"session": null
},
"error": {
"name": "AuthApiError",
"message": "Email not confirmed",
"status": 400
}
}
ctulek
02/27/2023, 1:03 AMsupabase db remote commit
I get the following error. Is that an issue with my linked project?
Error: ERROR: relation "supabase_migrations.schema_migrations" does not exist (SQLSTATE 42P01)
imagio
02/27/2023, 2:37 AMeq
?
If so am I correct in thinking that Supabase's realtime change listener capability is significantly more limited than Firestore's? It seems to me from reading the docs that Supabase has the following limitations:
* You must use a different API for querying data and for connecting to and filtering realtime updates
* You cannot fetch and begin listening in a single operation, you have to fetch data then set up a listener as a separate step
* The only operation available for filtering change listeners is eq
* There are significant performance limitations with listening to document updates (the docs only say By default, listening to database changes is disabled for new projects due to database performance and security concerns
)
Are those accurate? If not where can I find more info?
I'd like to figure out if Supabase can fill the requirements to migrate my project from Firebase. Thanks!ctulek
02/27/2023, 3:19 AMsql
CREATE POLICY "policy_name" ON public.messages
FOR INSERT TO authenticated WITH CHECK (true);
Any authenticated user can do the following:
javascript
await supabase.from("messages").insert({ user_id: some_other_users_id, ...other_fields });
Or am I missing something about Supabase REST API?
And is the following a way to shield against that?
sql
CREATE POLICY "policy_name" ON public.messages
FOR INSERT TO authenticated
WITH CHECK ((auth.uid() = user_id));
lampaboy
02/27/2023, 4:18 AMconst { error } = await supabase
.from('countries')
.insert({ id: 1, name: 'Denmark' })
From the docs, it shows the response message below, but is it accessible anywhere?
{
"status": 201,
"statusText": "Created"
}
JumpingBack
02/27/2023, 4:23 AMmct.dev
02/27/2023, 6:54 AM\ ឵឵឵
02/27/2023, 9:04 AMak4zh
02/27/2023, 9:08 AMelliott
02/27/2023, 9:47 AMsignOut()
method does not clear the session or current user on Flutter. Both appear to retain their state. An auth changed event for log out is fired, but those variables remain not cleared.NanoBit
02/27/2023, 10:01 AMimgproxy
and storage
, so turning them off saves some resources.
I didn't see any post on Discord or Github.spiralis
02/27/2023, 10:02 AMsql
INSERT INTO section
(poll_id, slug_id, "label", description)
VALUES(4, 'welcome', 'Welcome', 'Test');
For the record, the table is (was) empty.
RLS is enabled, with one relevant policy:
sql
(EXISTS ( SELECT 1
FROM poll
WHERE ((poll.id = section.poll_id) AND (poll.project_id = ( SELECT project.id
FROM project project
WHERE (project.owner_id = auth.uid()))))))
A project
has an owner_id
. A project
can have many poll
records via poll.project_id
. A poll
can have many section
rows.
The relevant DDL is attached to the post.
This is the client call I am making:
ts
async create({
poll_id,
slug_id,
label,
description,
}: {
poll_id: number
slug_id: string
label: string
description?: string
}) {
const { data: sectionIds, error } = await supabase
.from('section')
.insert([{ poll_id, slug_id, label, description }])
.select('id')
return { id: sectionIds?.[0]?.id, error } as { id: Number; error: PostgrestError }
},
Digging deeper, I find this error-entry in the Supabase "postgres" logs:
ERROR: more than one row returned by a subquery used as an expression
The content json is really interesting, but I am not able to figure it out. Please see the attached file.
Any assistance or tips on working around it would be appreciated.MoreeZ
02/27/2023, 10:33 AMjs
const { data, error } = await supabase
.from("stories")
.select()
.order("index");
This I'm trying to do the same thing for the user_settings
table and it's returning an empty array in data []
js
const { data, error } = await supabase.from("user_settings").select();
Razoth
02/27/2023, 11:00 AMMihai Andrei
02/27/2023, 11:04 AMCardoso
02/27/2023, 11:40 AM