I tried following the docs but they don't seem to work.
https://github.com/BuilderIO/qwik/issues/3971
Any quick hacks to make it work?
#Anyone was able to make latest Qwik+Supabase work?
15 messages · Page 1 of 1 (latest)
Could you give me a bit more detail on the error, I'm implementing this is the next couple of days so it might be helpful. In case I make it work I'll share the solution
So when add
const supabaseClient = createServerClient(
import.meta.env.PUBLIC_SUPABASE_URL,
import.meta.env.PUBLIC_SUPABASE_ANON_KEY,
requestEv
);
according to the docs ^
We get the TS error:
Argument of type 'RequestEventLoader<QwikCityPlatform>' is not assignable to parameter of type 'RequestEvent<QwikCityPlatform>'.
Type 'RequestEventLoader<QwikCityPlatform>' is missing the following properties from type 'RequestEvent<QwikCityPlatform>': headersSent, exited, getWritableStream, next
I did got it working, just using:
const supabaseClient = createClient(
import.meta.env.PUBLIC_SUPABASE_URL,
import.meta.env.PUBLIC_SUPABASE_ANON_KEY
);
But I'm not sure if this is the correct approach.
what is the requestEv doing exactly? Because for most client libraries (I am imagining using google apis for example), you would only need to get credentials instantiated to make it work
also I don't why this library (supabase-auth-helpers-qwik') would be needed ; in the end it's just javascript
and if you only doing this "const supabaseClient = createClient(
import.meta.env.PUBLIC_SUPABASE_URL,
import.meta.env.PUBLIC_SUPABASE_ANON_KEY
); " then you are not doing anything different than the javascript implementation of it https://supabase.com/docs/reference/javascript/initializing
if you are doing the same as the native javascript implementation I wouldn't bother to add the qwik helper library
unless qwik helper is solving a specific problem
I actually just made it work using only the "createClient" method in '@supabase/supabase-js", I actually only had issues with import.meta.env.PUBLIC_SUPABASE_URL
as putting my env variables inside .env.local is making it return undefined
although the dev server tracks changes inside .env.local
Managed to make it work for some reason (which seems kinda like magic) I need to put the VITE_ word before each variable. I took the idea from this repo. In this repo they also don't use the util library https://github.com/hamatoyogi/qwik-supabase-example/blob/main/src/lib/db.ts
Weird. I was deploying on Vercel, so PUBLIC_ worked for me.
didn't know about vite's env mode https://vitejs.dev/guide/env-and-mode.html, that explains why use PUBLIC_ and VITE_