jinsley8
05/12/2023, 9:09 PMsupabase
repo?
https://github.com/supabase/supabaseThisIsJustin
05/12/2023, 9:22 PMhttps://cdn.discordapp.com/attachments/1106692845705895937/1106692845907218575/image.png▾
KiwiHour
05/12/2023, 9:52 PMhttps://cdn.discordapp.com/attachments/1106700354801909760/1106700355116466247/image.png▾
formigueiro
05/12/2023, 10:41 PMjs
const reqData = await req.json()
let { id, url } = reqData.record;
const { data: urlExist } = await supabase
.from('url_data')
.select('id')
.ilike('url', `%${url}%`)
it getting empty array, but there is a item with url with that value, for example https://supabase.com/docs/guides/database/webhooks
zavbala
05/12/2023, 11:23 PMblackstock
05/12/2023, 11:42 PMhttps://cdn.discordapp.com/attachments/1106728178048839750/1106728178254352394/Screenshot_2023-05-12_at_5.29.46_PM.png▾
https://cdn.discordapp.com/attachments/1106728178048839750/1106728178673799258/Screenshot_2023-05-12_at_5.33.28_PM.png▾
https://cdn.discordapp.com/attachments/1106728178048839750/1106728179017723984/Screenshot_2023-05-12_at_5.35.50_PM.png▾
bhaskar
05/13/2023, 12:38 AMToe
05/13/2023, 1:10 AMmalphine2
05/13/2023, 2:02 AMRecon1st
05/13/2023, 4:44 AMHG_SHGYT
05/13/2023, 5:32 AMsql
sql
Copy code
((auth.uid() = uid) OR (EXISTS ( SELECT 1
FROM profile profile_1
WHERE ((profile_1.uid = auth.uid()) AND ('ADMIN'::roles = ANY (profile_1.roles))))))
The first part of the rule (auth.uid() = uid) works fine and gets the user's own profile data, but we're having trouble with the second part. We want users with the ADMIN role to be able to get all profile data, but this part of the rule doesn't seem to be working. Can you help us figure out what's wrong with the rule or suggest a better way to implement this functionality?shnoman
05/13/2023, 9:01 AMHG_SHGYT
05/13/2023, 10:23 AMhttps://cdn.discordapp.com/attachments/1106889472328613918/1106889472550899712/image.png▾
RyanLuttrell
05/13/2023, 11:51 AMhttps://cdn.discordapp.com/attachments/1106911584699301978/1106911585047416843/IMG_2022.jpeg▾
HG_SHGYT
05/13/2023, 1:15 PMDxlan
05/13/2023, 1:17 PM/pages
router I would just use session
from the useSession
hook to determine weather or not to render the login page - but i'm not sure if this is the same case when using the /app
router.
There's a page(https://supabase.com/docs/guides/auth/auth-helpers/nextjs-server-components) in the docs on building auth flows with nextjs 13 but on the repo it seems that the Login
client component is rendered regardless of the user's auth status. Can I use the useSession
hook in page.tsx
?
https://cdn.discordapp.com/attachments/1106933186203762718/1106933186467987456/Screenshot_2023-05-13_at_8.09.52_AM.png▾
Yuu
05/13/2023, 1:41 PMNin
05/13/2023, 2:06 PMimport { serve } from "https://deno.land/std@0.187.0/http/server.ts";
import { Receiver } from "https://deno.land/x/upstash_qstash@v0.3.7-canary.0/mod.ts";
import supabase from "../_shared/supabase.ts";
serve(async (req: Request) => {
const r = new Receiver({
currentSigningKey: Deno.env.get("QSTASH_CURRENT_SIGNING_KEY")!,
nextSigningKey: Deno.env.get("QSTASH_NEXT_SIGNING_KEY")!,
});
const payload = await req.json();
const isValid = await r
.verify({
signature: req.headers.get("Upstash-Signature")!,
body: payload,
clockTolerance: 5,
})
.catch((err: Error) => {
console.error(err);
return false;
});
if (!isValid) {
return new Response("Invalid signature", { status: 401 });
}
console.log(JSON.stringify(isValid));
console.log("The signature was valid");
return new Response("OK", { status: 200 });
});
When a message comes in, this is what my console sputters:
TypeError: Failed to execute 'digest' on 'SubtleCrypto': Argument 2 is not an ArrayBuffer or a view on one
at makeException (ext:deno_webidl/00_webidl.js:88:10)
at Array.converters.BufferSource (ext:deno_webidl/00_webidl.js:564:11)
at SubtleCrypto.digest (ext:deno_crypto/00_crypto.js:458:30)
at Receiver.verifyWithKey (https://deno.land/x/upstash_qstash@v0.3.7-canary.0/pkg/receiver.ts:73:50)
at async Receiver.verify (https://deno.land/x/upstash_qstash@v0.3.7-canary.0/pkg/receiver.ts:28:25)
at async Server.<anonymous> (file:///home/deno/functions/hex-explored/index.ts:10:21)
at async Server.#respond (https://deno.land/std@0.187.0/http/server.ts:220:24)
When reaching out to QStash they made an example on Deno which was working fine. Anyone has an idea?aar2dee2
05/13/2023, 2:36 PM"invalid json response body at https://<project-id>.supabase.co/rest/v1/rpc/update_embeddings reason: Unexpected end of JSON input
error when making a bulk update on a table using an rpc:
ts
interface allEmbeddings {
ada_002_embeddings: number[];
ada_002_total_tokens: number;
ada_002_prompt_tokens: number;
id: string;
}[]
const supabaseHeaders = {
"Content-Type": "application/json",
apikey: supabaseKey,
Authorization: `Bearer ${supabaseKey}`,
};
const updateEmbeddingResponse = await fetch(
`${supabaseUrl}/rest/v1/rpc/update_embeddings`,
{
method: "POST",
headers: { ...supabaseHeaders },
body: JSON.stringify({
json_array: allEmbeddings,
}),
}
);
The Postgres function code:
sql
CREATE OR REPLACE FUNCTION public.update_embeddings(json_array jsonb)
RETURNS VOID
LANGUAGE plpgsql
AS $$
DECLARE
_record public.search_dataset;
BEGIN
FOR _record IN
SELECT * FROM json_populate_recordset(null::public.search_dataset, json_array::jsonb)
LOOP
UPDATE public.search_dataset
SET ada_002_embeddings = _record.ada_002_embeddings,
ada_002_total_tokens = _record.ada_002_total_tokens,
ada_002_prompt_tokens = _record.ada_002_prompt_tokens
WHERE id = _record.id;
END LOOP;
EXCEPTION
WHEN others THEN
RAISE NOTICE 'Error occurred: %', SQLERRM;
END;
$$;
If I use a simple update
on the table, I'm able to update date, but I want to call the rpc to bulk update. No issues with RLS here.netdesignr
05/13/2023, 3:22 PMven
05/13/2023, 3:41 PMmalphine2
05/13/2023, 4:42 PMhttps://cdn.discordapp.com/attachments/1106984733939867668/1106984734233460886/image.png▾
osamita
05/13/2023, 5:33 PMDoc
05/13/2023, 6:54 PMhttps://cdn.discordapp.com/attachments/1107018127356727456/1107018232017199164/image.png▾
MATTI
05/13/2023, 7:41 PMerodozer
05/14/2023, 1:11 AMproxy_cache off;
set on my nginx instance that was in front of my local supabase 😩Master5157
05/13/2023, 8:20 PMFile "C:\Users\alpla\Desktop\SUIFrogs\Chatter-Project\ChatImposter\main.py", line 30, in <module>
from supabase import create_client, Client
File "C:\Users\alpla\AppData\Local\Programs\Python\Python311\Lib\site-packages\supabase\__init__.py", line 1, in <module>
from postgrest import APIError as PostgrestAPIError
ModuleNotFoundError: No module named 'postgrest'
I have been working with supabase for a week or so now and after some package conflicts I wanted to make a new venv and Docker later, but this error appears everytime. I've installed everything I can think of from supabase, supabase-py, postgrest, postgres, postgrest-py and a couple other ones. Any help is appreciated.justJosuke
05/13/2023, 8:50 PMPatrity
05/13/2023, 9:14 PMTavish
05/13/2023, 9:20 PMts
const updateItem = async (id: string, item: Partial<IItemRemote>) => {
const update = await client.from('items').update({
...item,
id,
}).eq('id', id)
}
and in images you will find the policy how it stands now
I do have users has one of the columns in the items table and it works with uuid
Hope anybody can give me some pointers on this issue
Thank you in advance!
https://cdn.discordapp.com/attachments/1107054683220090990/1107054683471745045/Screenshot_2023-05-13_231631.png▾