lewisd
09/26/2022, 1:35 PMconst { data } = await supabase.from<SbConversation>(CONVERSATIONS_VIEW)
.select("*")
.match({
userId: currentUser.id,
})
.or("lastRead.gt.latestMessage->>createdAt");
I get the response:
invalid input syntax for type timestamp with time zone: \"latestMessage->>createdAt\"
It seems to be selected createdAt
which is nested inside a jsonb
object, since it knows it is a timestamp with time zone
.
Perhaps there's something wrong with using .gt
?Jim
09/26/2022, 1:42 PMError: Get "https://github.com/denoland/deno/releases/latest/download/deno-aarch64-apple-darwin.zip": dial tcp: lookup github.com: i/o timeout
Migu
09/26/2022, 2:05 PMauth-ui-react
UI component coupled with supabase-js@RC
and I noticed that the cookie created is only secure
and not httpOnly
.
Should I be worried about that?
Is the only other solution to manually create the cookie server-side with the flag on and send it to the client? Given that setAuth is no longer available, how would I check if user is valid?MrGandalfAndhi
09/26/2022, 3:28 PMAllYourSupabase
09/26/2022, 3:26 PMhttps://app.supabase.com/
?Miguel Espinoza
09/26/2022, 3:35 PMcreateClient<Database>
But the data returned is of type undefined[] | undefined
.
I'm on supabase-js 2.0.0-rc.10.BoogersLLC
09/26/2022, 3:48 PMimport { session } from '$app/stores'
- __layout.svelte.ts
- hooks.ts
instead of hooks.server.ts
- import type { GetSession } from '@sveltejs/kit'
The Little Cousin
09/26/2022, 5:03 PMccssmnn
09/26/2022, 5:32 PMsupabase-js v2
on both client and server.
I can create the client with the ANON_KEY
, receive the user with client.auth.getUser(bearer-token)
but I fail to set the client context for this user. I need this to have RLS applied to my database calls.
How can I create the supabase client on the server on behalf of the user? supabase.functions.invoke(...)
does not send any cookies, using the authorization header in createClient(...)
does not work.Xzight
09/26/2022, 5:33 PMjs
const { data, error } = await supabase
.rpc('add_task_with_tags', { tags: [{owner_id: 1, title: "tag1"}] })
drunken_warrior
09/26/2022, 5:49 PMCory
09/26/2022, 6:27 PMgalizar
09/26/2022, 7:07 PMtype group = Database['public']['Tables']['groups']['Row'];
const supabase = createClient(url, anonKey);
const propColumns = 'name, isTrashed:is_trashed';
(async () => {
await supabase.auth.signIn({email, password});
const props =
await supabase
.from<group>('groups')
.select(propColumns);
console.log(props);
})();
V2:
const supabase = createClient<Database>(url, anonKey);
const propColumns = 'name, isTrashed:is_trashed';
(async () => {
await supabase.auth.signInWithPassword({email, password});
const props =
await supabase
.from('groups')
.select(propColumns);
console.log(props);
})();
And indeed, the V1 version works as expected, but the V2 one does not return the correct data, it's undefined
I've taken a look at the logs in the app page and there's this key difference in there:
V1:
"sb": [
{
"auth_user": "e92a8280-9d20-4dd9-9c0f-40c441810c41"
}
],
"search": "?select=name%2CisTrashed%3Ais_trashed",
"url": "https://app url/rest/v1/groups?select=name%2CisTrashed%3Ais_trashed"
V2:
"sb": [],
"search": "?select=name%2CisTrashed%3Ais_trashed",
"url": "https://app url/rest/v1/groups?select=name%2CisTrashed%3Ais_trashed"
It seems like the client isn't authenticated with V2, so RLS is doing its job. Is there something I'm missing regarding signInWithPassword
? The way it is talked about in the release notes sounds like it should be a swap in replacement and a quick look at the source seems to confirm that it does basically the same thing as v1's signIn
. Would greatly appreciate any pointerslewisd
09/26/2022, 7:44 PMselect l.*,
"sellerData"."sellerData", "listingLikes"."listingLikes", "lineItems"."lineItems", "listingComments"."listingComments"
from listings l
left join (
select id,
row_to_json(ud.*) as "sellerData"
from "userData" ud
group by ud.id
)
"sellerData" on "sellerData".id = l."sellerId"
left join (
select "userId",
"listingId",
array_agg(jsonb_build_object('id', ud.id, 'username',
ud.username, 'avatar', ud.avatar)) as "listingLikes" from "listingLikes" ll
join "userData" ud on ud.id = ll."userId"
group by ll."userId", ll."listingId"
)
"listingLikes" on "listingLikes"."listingId" = l.id
left join (
select "listingId",
array_agg(row_to_json(li.*)) as "lineItems"
from "lineItems" li group by li."listingId"
)
"lineItems" on "lineItems"."listingId" = l.id
left join (
select "listingId",
array_agg(row_to_json(cm.*)) as "listingComments" from "listingComments" cm
group by cm."listingId"
)
"listingComments" on "listingComments"."listingId" = l.id
The image attached shows that for every row that should be in listingLikes
, it returns a duplicate.
So if a listing
has 5 likes, 5 duplicate rows will be in my view.CanRau
09/26/2022, 8:47 PMsql
ALTER USER postgres SET search_path TO "$user", public, auth;
don't even remember exactly where and what for, just that it was based on a comment suggestion to "fix" something.
Now I'd like to reset it to default but I'm not sure what the default is supposed to be. I'm totally new to Postgres, have some experience with other SQL DBs ๐ค
Found this
sql
ALTER ROLE postgres SET search_path TO "\$user",public,extensions;
in
Would that do? Or, if the value is actually correct better to do
sql
ALTER USER postgres SET search_path TO "\$user",public,extensions;
Reading , my last example might be the right one tho still not completely sure ๐ฌsofaking
09/26/2022, 9:56 PMFALSE
. I was expecting request I made from a page should fail but to my suprize it didn't . What am I missing here?jdgamble555
09/26/2022, 10:24 PMtypescript
q = this.sb.supabase.from('tags')
.select('*, pid!inner(*, author!inner(*))', { count: 'exact' })
.eq('name', tag)
.order('pid.created_at', { ascending: true })
.range(from, to)
tags
- pid (fk to posts.id)
- ...
posts
- created_at
- ...
I'm trying to sort by the posts created at field. I get a 400 error. However, when I comment out the .order()
line, everything works fine.
Jrgfx
09/26/2022, 10:27 PMNotThatBot
09/26/2022, 10:28 PMTypeError [ERR_INVALID_ARG_TYPE]: The "obj" argument must be an instance of Blob. Received an instance of Blob
harsh singh
09/26/2022, 10:56 PMsql
SELECT * FROM project WHERE email = 'example@email.com';
praisethemoon
09/27/2022, 12:48 AMFriendsList
and i am trying to build a query to fetch the friends of a specific user, FriendsList(sender, recipient)
so it is a bit tricky since the current user can be either a sender or a receiver and its giving me a headache since i am not familiar with supabase queries. Any tips would be greatly appreciated ๐uneatenauthor
09/27/2022, 1:21 AMHunterAndersonX
09/27/2022, 2:03 AMmikelyndon
09/27/2022, 2:08 AMsupabase db remote commit
on a fresh local environment but the migration doesn't include the supabase_functions schema or any of the associated tables and functions.
So what would be a reasonable workflow to separate testing from production? I don't want to make changes to the production db while I'm testing. Would I create two projects online - one for production and another for testing? And if so, how can I push changes between the two?
Or, do I use the CLI and create custom functions to mimic the supabase functionality?ZetiMente
09/27/2022, 2:24 AMjuniorco
09/27/2022, 2:30 AM{"message":"no Route matched with those values"}
when trying to hit the endpoint. Can't find any info about it onlinejxyz
09/27/2022, 3:25 AM๋งคํ
09/27/2022, 5:29 AMPrashant Singh
09/27/2022, 5:40 AMJim
09/27/2022, 7:19 AM