Sophic
12/14/2021, 5:28 AMtheboss
12/14/2021, 8:37 AMtheboss
12/14/2021, 8:45 AMPoypoypoy
12/14/2021, 9:27 AMshivam51
12/14/2021, 12:46 PMjs
let { data: todo, error } = await supabase
.from('todos')
.insert({ task, user_id: user.id })
.single()
What does data:todo mean here?shivam51
12/14/2021, 12:47 PMlet {todo, error}
be enough?chipilov
12/14/2021, 12:48 PMchipilov
12/14/2021, 12:48 PMshivam51
12/14/2021, 12:51 PMshivam51
12/14/2021, 12:52 PMdata
?chipilov
12/14/2021, 12:56 PMMuphet
12/14/2021, 1:23 PMshivam51
12/14/2021, 1:39 PMkorayem
12/14/2021, 1:55 PMDECLARE
status_result integer;
BEGIN
SELECT status INTO status_result FROM
net.http_post(
url:='https://api.cloudflare.com/',
body:='{"key":true}'::jsonb,
headers:='{"Content-Type": "application/json","Authorization": "Bearer authkey"}'::jsonb
);
RETURN NULL;
END;
Just tie that function to a table trigger and you're good to go
Just thought of sharing in case anyone is struggling the samechipilov
12/14/2021, 2:05 PMdcuk89
12/14/2021, 2:19 PMTimJMartin
12/14/2021, 3:06 PMgaryaustin
12/14/2021, 3:40 PMTimJMartin
12/14/2021, 4:33 PMFabian B.
12/14/2021, 5:02 PMjsonb
field in it, it just completely doesn't work and throws errors. It even kicks me off the websocket connection after the errors happen. I connect to the table like in the docs
const mySubscription = supabase
.from('notes')
.on('*', payload => {
console.log('Change received!', payload)
})
.subscribe()
on the initial connection itsself, everything works. But as soon as the content changes, I get these errors in the JavaScript Console:
Could not convert cell of type jsonb and value [object Object]
This is the error: SyntaxError: Unexpected token o in JSON at position 1
These errors are thrown from JS files provided by the supabase extension, so it's not my code throwing them. (transformers.ts
and browser.js
)
after this happens, the websocket connection just completely closes and the console shows:
WebSocket connection to 'wss://uzmluoivxnndbkjoajhn.supabase.co/realtime/v1/websocket?apikey=MY_API_KEY_IS_HERE&vsn=1.0.0' failed:
am I missing something? Is Realtime not working for jsonb
fields yet? Or is this a known bug somehow. If not, I would create an issue in the supabase/realtime repo in GitHub.
Thanks for your help in advance!codesalim
12/14/2021, 5:44 PMmohnish
12/14/2021, 5:59 PMFabian B.
12/14/2021, 6:05 PMCREATE VIEW ...
sql code. after that, you can select the view like it's a table.bishop
12/14/2021, 8:22 PMjensen
12/14/2021, 9:21 PMjordan801
12/15/2021, 3:09 AMkathy
12/15/2021, 5:53 AMjensen
12/15/2021, 5:58 AMprofiles
and private_profiles
table. Then I make a trigger on auth.users
to add records to those tables. The profiles
are visible by auth.role() = 'authenticated'
and the profiles_private
are only visible by auth.role() = user_id
. I have an example here https://github.com/jensen/chatatat/blob/main/src/services/schema/tables.sql at the top of the file. Although in this version I opened up the profiles to all users, but users can browse without auth, just can't post.. so in this case it is what I needed.kathy
12/15/2021, 6:14 AMjensen
12/15/2021, 6:42 AM