al3x
09/15/2022, 9:51 PMthestepafter
09/15/2022, 10:00 PMJuicyBenjamin
09/15/2022, 10:10 PMpostgres
declare
new_amount int;
begin
select amount
into new_amount
from public.collection
where id = card_id
new_amount = new_amount + 1;
update public.collection
set amount = new_amount
where id = card_id;
return new_amount;
end
I've set the argument to be card_id.
The specific error is: Failed to create function: failed to create pg.functions: syntax error at or near "new_amount"Tony_n
09/15/2022, 11:04 PMimport { serve } from "https://deno.land/std@0.131.0/http/server.ts";
import Stripe from "https://esm.sh/stripe?target=deno&no-check";
// import { getAccountLink } from '../shared/index.ts';
serve(async (req) => {
const stripe = Stripe(Deno.env.get("STRIPE_API_KEY") ?? "", {
// This is needed to use the Fetch API rather than relying on the Node http
// package.
httpClient: Stripe.createFetchHttpClient(),
apiVersion: "2020-08-27",
});
// console.log(stripe)
return new Response(
JSON.stringify({ accountLink: 'https://google.com' }),
{ headers: { "Content-Type": "application/json" }, status: 200, statusText: 'OK' },
)
})
Bicijay
09/15/2022, 11:06 PMScott
09/15/2022, 11:25 PMurl argument is missing
when trying to use supabaseClient.auth.signIn()
with a magiclink/otp. I get this error in the supabase-js client, but oddly enough the same error occurs when using the Supabase UI to send a magiclink for a user.
This used to work, but I changed my Site URL and it stopped working afterwards. I'm not sure what's wrong, I can't seem to find this error in the docs anywhere.aleemrehmtulla
09/16/2022, 1:01 AMmydomain.com/callbackurl
that goes to the supabase. Is there any better way? What's official way to do so :)jyn
09/16/2022, 1:47 AMTeiem
09/16/2022, 4:40 AMconst channel = supabase
.channel("public:channelName")
.on(
"postgres_changes",
{
event: "INSERT",
schema: "public",
table: "channelName"
},
(payload) => {
console.log("INSERT", payload);
})
.subscribe();
In this case payload
has the type any
. I did pass my Typescript definitions to the constructor when creating the SupabaseClient
(const supabase = createClient<Database>
) and get correct types for normal queries.Mathiassio
09/16/2022, 4:44 AMIndra Zulfi
09/16/2022, 4:48 AMnew row violates row-level security policy for table "objects
All policies have been setup. But the issue still persist.cataxcab
09/16/2022, 8:12 AMtonyhart
09/16/2022, 8:34 AMFunHellion
09/16/2022, 10:09 AMtrue
SELECT
(uid() IN ( SELECT team_members.user_id
FROM team_members
WHERE (team_members.team_id = teams.id)))
Hopefully someone can help me with this, thanks in advance!Showdey
09/16/2022, 10:41 AMxerox_04
09/16/2022, 11:45 AMmohammed-io
09/16/2022, 1:21 PMPgPool
from pg
package on Node js?chientrm
09/16/2022, 1:43 PMChuckatron
09/16/2022, 1:46 PMMrSARS
09/16/2022, 1:56 PMDarthJarJar
09/16/2022, 2:07 PMjs
const mySubscription = supabase
.from('testlist')
.on('*', (payload) => {
console.log('Change received!', payload)
if (payload.eventType === "INSERT") {
datalist = [...datalist, payload.new]
}
if (payload.eventType === "DELETE") {
console.log(datalist.indexOf(payload.old))
removeFromDataList(payload.old.id)
console.log(datalist)
datalist = datalist
}
})
.subscribe()
silvanet
09/16/2022, 2:36 PMgesusc
09/16/2022, 4:10 PMJonathan_Nathan
09/16/2022, 7:18 PMrishav
09/16/2022, 8:15 PMNin
09/16/2022, 9:13 PMuseEffect(() => {
if (user) {
const subscription = supabase
.from(`profile:id=eq.${user.id}`)
.on("UPDATE", (payload) => {
setUser({ ...user, ...payload.new });
})
.subscribe();
return () => {
supabase.removeSubscription(subscription);
};
}
}, [user]);
Above is my code, the value is only updating when the screen goes out of focus and I have no idea what this is? Attached is a GIF that shows my screen. I don't understand what's wrong?[GodderE2D]
09/16/2022, 11:14 PMsupabase-js@1.35.4
, Supabase returned a 400 error on PUT /auth/v1/user
. I was trying to edit user metadata in my database.
Not using prisma.
Client code: (React 17 with Next 12)
ts
const [title, setTitle] = useState("");
const [description, setDescription] = useState("");
const [slug, setSlug] = useState("");
const [tags, setTags] = useState<string[]>([]);
const [content, setContent] = useState("");
const [contentMode, setContentMode] = useState("code");
const [MDXContent, setMDXContent] = useState<MDXContent>();
useEffect(() => {
const interval = setInterval(async () => {
if (!title && !description && !slug && !tags.length && !content) return;
if (title === supabase.auth.user()?.user_metadata.title) return;
if (description === supabase.auth.user()?.user_metadata.description)
return;
if (slug === supabase.auth.user()?.user_metadata.slug) return;
if (tags === supabase.auth.user()?.user_metadata.tags) return;
if (content === supabase.auth.user()?.user_metadata.content) return;
const { error } = await supabase.auth.update({
data: {
blogDraft: {
title,
description,
slug,
tags,
content,
},
},
});
if (error) {
console.error(error);
toast.error(
"An unexpected error occurred while saving a draft. Refer to the console for details."
);
}
}, 5000);
return () => clearInterval(interval);
}, [title, description, slug, tags, content]);
Server API log:
- Status: 400
- Method: PUT
- Timestamp: 1663368211264000
- Client: supabase-js/1.35.4
- Referer:
Request body:
json
{
"cf": [
{
"asOrganization": "Verizon Fios",
"asn": 701,
"botManagement": [
{
"score": 98,
"staticResource": false,
"verifiedBot": false
}
],
"city": "XXX",
"clientAcceptEncoding": "gzip, deflate, br",
"clientTcpRtt": null,
"clientTrustScore": 98,
"colo": "XXX",
"continent": "NA",
"country": "US",
"edgeRequestKeepAliveStatus": 1,
"httpProtocol": "HTTP/3",
"isEUCountry": null,
"latitude": "XXX",
"longitude": "XXX",
"metroCode": "XXX",
"postalCode": "XXX",
"region": "XXX",
"regionCode": "XXX",
"requestPriority": null,
"timezone": "America/New_York",
"tlsCipher": "AEAD-AES128-GCM-SHA256",
"tlsClientAuth": [
{
"certPresented": "0",
"certRevoked": "0",
"certVerified": "NONE"
}
],
"tlsExportedAuthenticator": [
{
"clientFinished": "XXX",
"clientHandshake": "XXX",
"serverFinished": "XXX",
"serverHandshake": "XXX"
}
],
"tlsVersion": "TLSv1.3"
}
],
"headers": [
{
"accept": "*/*",
"cf_connecting_ip": "XXX",
"cf_ipcountry": "US",
"cf_ray": "74bd1f181ed67fed",
"content_length": "518",
"content_range": null,
"content_type": "text/plain;charset=UTF-8",
"date": null,
"host": "mqzswyobtehomvpicltf.supabase.co",
"referer": "https://www.godder.xyz/",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
"x_client_info": "supabase-js/1.35.4",
"x_forwarded_proto": "https",
"x_forwarded_user_agent": null,
"x_real_ip": "XXX"
}
],
"host": "mqzswyobtehomvpicltf.supabase.co",
"method": "PUT",
"path": "/auth/v1/user",
"protocol": "https:",
"sb": [
{
"auth_user": "b9d73cee-2922-4daa-9cfb-bb6701f65ce3"
}
],
"search": null,
"url": "https://mqzswyobtehomvpicltf.supabase.co/auth/v1/user"
}
Bee
09/16/2022, 11:26 PMconst { data, error, loading } = await supabase
.from('posts')
.select()
if(loading){
console.log("loading")
}
But this didn't seem to return loading at all even when it was clear data was loading. I don't see loading anywhere in the docs so not sure if it's doable or not.mansedan
09/17/2022, 7:16 AMilike
match in either column (home_team or away_team) both serving as a Foreign Key to the same table. We are trying like this:
js
const { data, error } = await supabaseClient.from('table').select(`home_team!inner(*),away_team!inner(*)`).or(`mascot.ilike.%${q}%`, { foreignTable: 'home_team' }).or(`mascot.ilike.%${q}%`, { foreignTable: 'away_team' })
and
js
const { data, error } = await supabaseClient.from('table').select(`home_team!inner(*),away_team!inner(*)`).or(`mascot.ilike.%${q}%`, { foreignTable: ['home_team', 'away_team'] })
With no real luck. Is there a way to do the query we are attempting?nickreed
09/17/2022, 8:12 AMauth.admin.listUsers
, so it seems like I have the client setup with the correct full-permission service role token, but I get an error that I cant figure out when trying to inviteUserbyEmail (AuthRetryableFetchError {"size":0,"timeout":0}
) .
My code for listing/importing, using @supabase/supabase-js@2.0.0-rc.10
const rootSupabase = createClient(
process.env.SUPABASE_URL,
process.env.SUPABASE_SECRET_SERVICE_ROLE,
);
const {
data: { users },
error: usersError,
} = await rootSupabase.auth.admin.listUsers();
console.log({ users, usersError });
if (usersError) {
throw new Error(usersError);
}
const { data: inviteData, error: inviteError } =
await rootSupabase.auth.admin.inviteUserByEmail(email);
if (inviteError) {
throw new Error(inviteError);
}
console.log('inviteData:', inviteData);
stack trace:
AuthRetryableFetchError: {"size":0,"timeout":0}
at /Users/nickreed/code/voiplabs/callingio-api/node_modules/@supabase/gotrue-js/dist/main/lib/fetch.js:33:16
at Generator.next (<anonymous>)
at /Users/nickreed/code/voiplabs/callingio-api/node_modules/@supabase/gotrue-js/dist/main/lib/fetch.js:8:71
at new Promise (<anonymous>)
at __awaiter (/Users/nickreed/code/voiplabs/callingio-api/node_modules/@supabase/gotrue-js/dist/main/lib/fetch.js:4:12)
at handleError (/Users/nickreed/code/voiplabs/callingio-api/node_modules/@supabase/gotrue-js/dist/main/lib/fetch.js:27:40)
at /Users/nickreed/code/voiplabs/callingio-api/node_modules/@supabase/gotrue-js/dist/main/lib/fetch.js:86:35