knoppoly
07/26/2022, 7:31 PMstevharve
07/26/2022, 8:02 PMgorbypark
07/26/2022, 10:56 PMduggiemitchell
07/26/2022, 11:15 PMgesusc
07/27/2022, 12:24 AMb----nessmen
07/27/2022, 2:48 AMJude
07/27/2022, 5:15 AMCervantes
07/27/2022, 8:06 AMEpailes
07/27/2022, 8:58 AMEret1k
07/27/2022, 10:27 AMb----nessmen
07/27/2022, 10:53 AMserve({
"/": home,
});
async function home(request: Request) { ... }
with functions? Because when it's served locally, it works completely normal, but when I try to deploy, it doesn't work anymore.hannesnussmueller
07/27/2022, 11:14 AMstores
and products
). a store can have multiple products. products table has columns like price
and stock
. in the stores table the products column references to the products table. when i want to add a row in stores, i cannot enter data for stock
and price
as this is coming from the products table already. how can i solve this? i'm not good with sql.theuknowner
07/27/2022, 11:16 AMHallidayo
07/27/2022, 12:37 PMgorbypark
07/27/2022, 2:20 PMjs
await supabase
.from('user_addresses')
.update({is_primary: false})
.match({is_primary: true})
.then(() =>
supabase
.from('user_addresses')
.update({is_primary: true})
.match({id: addressId}),
);
Embm
07/27/2022, 2:35 PMpublic.users_profiles
table and query results when querying various RLS-enabled tables, i.e redirect client if a specific select
returns empty). From my understanding, the easy way to implement this implies initing (and disposing?) a new supabase client on a per-request basis and using the sveltekit client's request cookies for authing the sb call. I was wondering, are there any performance pitfalls that could come out of this?b----nessmen
07/27/2022, 2:49 PMfranfernandez
07/27/2022, 3:12 PMDoggoBot
07/27/2022, 3:50 PMsante | kiftdao
07/27/2022, 4:49 PMaccess_token
gets returned via a hash route using #
instead of a query param using ?
which I'm not sure how to parse correctly, I think its not matching a path in react-router which causes the app to refresh which loses the access_token. It's really weird, I can see the access_token in the url and then it disappears.zenny.eth
07/27/2022, 4:58 PMqbit
07/27/2022, 5:19 PMsylar815
07/27/2022, 5:24 PMWaldemar
07/27/2022, 6:29 PMauth.uid()
with a hardcoded real user UUID, so it seems to be OK apart from the auth.uid
part.
Then I've seen on GitHub and in the source code of the auth.uid()
function that it will be deprecated and that I should Use auth.jwt() -> ''sub'' instead (...two ticks is a typo...?), so I've modified my policy to:
ALTER TABLE profile ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Enable users to read their own profile"
ON profile for SELECT USING (
profile.user_id == (auth.jwt()->>'sub')::uuid
)
but then I'm getting this error in Supabase:
Failed to run sql query: operator does not exist: uuid == uuid
I've also tried auth.jwt()->'sub'
and casting profile.user_id
to text, but no luck.stevharve
07/27/2022, 6:38 PMtheuknowner
07/27/2022, 8:08 PMcptCrunch
07/27/2022, 8:39 PMbhaskar
07/27/2022, 9:29 PMtEjAs
07/28/2022, 12:44 AMHEAVYPOLY
07/28/2022, 12:57 AMimport { supabase } from "../../../utils/supabaseClient"
import cookie from 'cookie';
const handler = async (req, res) => {
const { user } = await supabase.auth.api.getUserByCookie(req);
if (!user) {
return res.status(401).send("Unauthorized");
}
// res.send(user);
const token = cookie.parse(req.headers.cookie)['sb-access-token'];
supabase.auth.session = () => ({
access_token: token,
token_type: 'Bearer',
user
});
const { data: { stripe_customer }} = await supabase
.from('profile')
.select("stripe_customer")
.eq("id", user.id)
.single();
res.send({
...user,
stripe_customer,
});
};
. Is there something I'm doing wrong here? if I console log the token I get a long string of random letters and numbers