Olyno
08/17/2022, 6:54 AMsbr
08/17/2022, 6:50 AMselect raw_user_meta_data::json->'sub' from auth.users where id=[user_id]
but how can I do the opposite?
Thanks!Alan Coppin
08/17/2022, 7:15 AMpeterkimzz
08/17/2022, 7:50 AMomar
08/17/2022, 9:37 AMrison
08/17/2022, 10:50 AMsupabase db remote commit
on my terminal after linking to a new project. This created the migration file.
But after that, any time I run supabase start
or supabase db remote commit
, I get the following error.
Error: Error starting shadow database: ERROR: relation "pgsodium.key_key_id_seq" does not existError: Error starting shadow database: ERROR: relation "pgsodium.key_key_id_seq" does not exist
I'm not sure what's going wrong. Please help.maysa
08/17/2022, 11:11 AMcdedreuille
08/17/2022, 1:03 PMLukas V
08/17/2022, 1:10 PMlet { data, error, count } = await supabase
.from('recipes')
.select(
`*,
instructions(instructions)
`,
{ count: 'exact' }
)
.eq('id', id);
But I get the data this way:
ingredients: (2) [{…}, {…}]
instructions: {instructions: '{"root":{"children":[{"children":[{"detail":0,"for…format":"","indent":0,"type":"root","version":1}}'}
How can I flatten my returned data, so that I don't have to call instructions.instructions
?Mihai Andrei
08/17/2022, 1:40 PMresponse = supabase.storage().from_("images").upload(filename, file)
But it seems the "file" should be a path? So i would need to store the file on my server, upload it to supabase and delete it later?tinus
08/17/2022, 1:46 PMcode: "428C9"
details: "Column \"id\" is an identity column defined as GENERATED ALWAYS."
hint: "Use OVERRIDING SYSTEM VALUE to override."
message: "cannot insert a non-DEFAULT value into column \"id\""
Is there a setting I need to adjust for making this work? I'm using supabase-js to do the upsert.
const { data, error } = await supabase
.from("posts")
.upsert({ ...form, price: Number(form.price) * 100 }) // price in cents
.single();
Twisted Chaz
08/17/2022, 2:17 PMnew row violates row-level security policy for table \"objects\"
. Can someone guide me in the right direction of how to setup these policies correctly.
My Policies are as follows
albums
* None
Other policies under storage.objects
* Enable insert for authenticated users only
* Enable update for authenticated users only
Policies under storage.buckets
* NoneMathiassio
08/17/2022, 2:30 PMjs
import { supabase } from "@/utils/supabaseClient";
import { getRole } from "@/utils/supabaseData";
export default async (req: any, res: any) => {
const session = supabase.auth.session();
console.log(session);
const userId = session?.user?.id;
try {
const data = await getRole(userId);
return res.status(200).json(data);
} catch (err) {
console.error(err);
res.status(500).json({ msg: "Something went wrong." });
}
res.end();
};
How can I get the session and the data into my API file?sb
08/17/2022, 2:57 PMlucasneg
08/17/2022, 3:38 PMbubuq
08/17/2022, 4:03 PMWiewiorkaMixedRubbish
and WiewiorkaSegregatedRubbish
but it shows me error: `cannot redeclare block-scoped variable 'data'
js
export const getStaticProps: GetStaticProps = async () => {
const supabaseAdmin = createClient(
process.env.NEXT_PUBLIC_SUPABASE_URL || "",
process.env.SUPABASE_SERVICE_ROLE_KEY || ""
);
const { data } = await supabaseAdmin
.from("WiewiorkaMixedRubbish")
.select("*")
.order("id");
return {
props: {
mixedRubbish: data,
},
};
// second table i wanted to query at the first supabaseAdmin query. I want return it as another prop called segregatedRubbish
const { data } = await supabaseAdmin
.from("WiewiorkaSegregatedRubbish")
.select("*")
.order("id");
return {
props: {
segregatedRubbish: data,
},
};
};
how can i Combite 1 data query with another table called WiewiorkaSegregatedRubbish
?Smardrengr
08/17/2022, 5:26 PMauth
in a SvelteKit app. With Supabase, it appears you can run supabaseClient.auth.signIn({ email: form.email, password: form.password });
server- or client-side:
1. Send username
and password
to a server-side route (/api/login
) which then runs supabaseClient.auth.signIn()
server-side, gets back a user and session, registers session and returns data to client for Supabase to know who's logged in. (This is how I did my first SvelteKit + Supabase app according to )
2. Do auth in the client, then send session object back to the server so that SvelteKit's backend can register session
and then knows that the user is logged-in (or not), which helps with SSR protected routes (if not logged in, redirect to /login
). This appears to be how most of the tutorials now are structured, but it feels kinda weird... Like, I feel the server should be the source of truth, not the web browser.
Does this make any sense? Any thoughts or opinions?Gruce
08/17/2022, 5:40 PMdubo
08/17/2022, 6:44 PMcreate policy "Users can manage their own teams." on teams
for all with check (auth.uid() = owner);
I tried turning off RLS and it works fine.
Am not familiar with SQL, is the above command correct?Leonardo-ironeko
08/17/2022, 6:47 PMerror: {
statusCode: '401',
error: 'Invalid JWT',
message: 'new row violates row-level security policy for table "objects"'
}
when trying to upload files.
I've added RLS:
bucket_id = 'avatars' AND storage."extension"(name) = 'jpg' AND storage."extension"(name) = 'png' AND LOWER((storage.foldername(name))[1]) = 'public' AND auth.role() = 'anon'
But upload is still failing with:
const {error, data} = await supabase.storage.from("avatars").upload(`twitter-990977436916551680.jpg`, buffer, {
upsert: true,
});
did something change? How can I allow my API to upload files to storage again?Jesse
08/17/2022, 6:48 PMimport { SupabaseClient } from "@supabase/supabase-js";
import type { Database } from "../types";
import { useContext } from "react";
import { Context } from "../context";
export const Context = createContext<SupabaseClient<Database> | undefined>(
undefined
);
export const useSupabaseClient = (): SupabaseClient<Database> => {
const client = useContext(Context);
if (client === undefined)
throw Error("No client has been specified using Provider.");
return client;
};
const { data, error } = await supabase.from("account").select(");
The from is autofilled by my IDE, but when selecting, it will only suggest *, not the rows. They do exist in the types.ts. Anything I am missing?felsey
08/17/2022, 7:50 PMtheuknowner
08/17/2022, 8:31 PMBrad Dwyer
08/17/2022, 9:12 PMjltino
08/17/2022, 10:32 PMAlanK
08/17/2022, 10:40 PMSELECT AddGeometryColumn('public','address_point_extract_wgs84','geom',4326,'POINT',3);
the result was
Failed to run sql query: function addgeometrycolumn(unknown, unknown, unknown, integer, unknown, integer) does not exist
This has worked before so I am lost... Any advice would be helpful.49Ryann
08/18/2022, 1:43 AMlavenderlav
08/18/2022, 4:03 AMAmusedGrape
08/18/2022, 4:16 AM