Join Vultr Community
Points, levels & badges
Enter challenges & submit builds
Register to events & meetups
Get your work featured
I'm trying to store API keys for Tavily API and Bifrost Virtual Keys in my Build Functions, but can't seem to connect it to supabase..
Points, levels & badges
Enter challenges & submit builds
Register to events & meetups
Get your work featured
To connect your Next.js build/server functions to Supabase without exposing your Tavily or Bifrost API keys, instantiate a server-side admin client using your SUPABASE_SERVICE_ROLE_KEY (never prefix it with NEXT_PUBLIC_):
Hey Chideraaodesigo! If you're trying to connect your Next.js build/server functions to Supabase and securely manage keys like your Tavily API and Bifrost Virtual Keys, here is the cleanest way to set it up:
.env.local file (and in your deployment dashboard's environment settings):SUPABASE_SERVICE_ROLE_KEY, TAVILY_API_KEY, and BIFROST_VIRTUAL_KEY do not have the NEXT_PUBLIC_ prefix so they stay strictly on the server/build side).@supabase/supabase-js and create a server-side client inside your API route, Server Action, or build script (getStaticProps / Server Component):.env, ensure Row Level Security (RLS) is enabled on that table and only query it from your server-side Next.js routes using the SUPABASE_SERVICE_ROLE_KEY so the keys are never exposed to the browser.Hope this helps get your connection working! Let me know if you're hitting a specific error message.