0
0
Supabasecloud~10 mins

Environment variables and secrets in Supabase - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to access an environment variable in Supabase.

Supabase
const apiKey = process.env.[1];
Drag options to blanks, or click blank then click option'
ASECRET_KEY
BSUPABASE_URL
CDATABASE_URL
DSUPABASE_API_KEY
Attempts:
3 left
💡 Hint
Common Mistakes
Using the URL variable instead of the API key.
Using a generic secret key name not defined in Supabase.
2fill in blank
medium

Complete the code to load environment variables from a .env file using Supabase CLI.

Supabase
supabase functions deploy --env-file [1]
Drag options to blanks, or click blank then click option'
A.env
Bconfig.env
Cenv.txt
Dvariables.env
Attempts:
3 left
💡 Hint
Common Mistakes
Using a file without the leading dot.
Using a text file with an uncommon extension.
3fill in blank
hard

Fix the error in the code to securely access a secret in a Supabase Edge Function.

Supabase
const secret = Deno.env.[1]('MY_SECRET');
Drag options to blanks, or click blank then click option'
Aget
Bfetch
Cread
Daccess
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like fetch or read.
Trying to access environment variables directly without a method.
4fill in blank
hard

Complete the code to set and access a secret in Supabase Edge Functions.

Supabase
Deno.env.[1]('MY_SECRET', 'secure_value');
const secret = Deno.env.get('MY_SECRET');
Drag options to blanks, or click blank then click option'
Aupdate
Bset
Cdelete
Dreplace
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like delete, update, or replace.
Confusing the set method with get or other operations.
5fill in blank
hard

Fill all three blanks to create a secure connection using environment variables in Supabase.

Supabase
const supabaseUrl = process.env.[1];
const supabaseKey = process.env.[2];
const supabase = createClient([3], supabaseKey);
Drag options to blanks, or click blank then click option'
ASUPABASE_URL
BSUPABASE_API_KEY
CsupabaseUrl
DDATABASE_URL
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up environment variable names.
Passing the environment variable name string instead of the variable.