Did you set the env variables and are you using a ...
# off-topic
w
Did you set the env variables and are you using a development framework e.g. CRA or nextjs?
b
yes I use nextjs and set .env.local.
I can successfully use this import to query supabase data.
w
you are accessing the env variables in the client. In order to expose them to the client you have to prefix them with
NEXT_PUBLIC_
b
oh, I will try
and make sure not to expose your supabase service key in the browser by prefixing it with NEXT_PUBLIC 🙂
b
Thanks a lot, I set URL and KEY in .env.local and used in createClient, is this the right way and safe?
w
glad it worked
If you are referring to the supabase "anon" key by your
NEXT_PUBLIC_SB_KEY
, you should be are fine