0
0
Supabasecloud~10 mins

Initializing Supabase client - Interactive Code Practice

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

Complete the code to import the Supabase client creation function.

Supabase
import { createClient } from '[1]';
Drag options to blanks, or click blank then click option'
Asupabase-js
Bsupabase
C@supabase/supabase-js
Dsupabase-client
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'supabase' or 'supabase-js' without the '@supabase/' prefix.
Trying to import from 'supabase-client' which does not exist.
2fill in blank
medium

Complete the code to initialize the Supabase client with the URL.

Supabase
const supabase = createClient(process.env.[1], 'your-anon-key');
Drag options to blanks, or click blank then click option'
ASUPABASE_URL
BsupabaseUrl
CSUPABASE_API_URL
Dsupabase_url
Attempts:
3 left
💡 Hint
Common Mistakes
Using camelCase or lowercase variable names.
Confusing the URL variable with the anon key.
3fill in blank
hard

Fix the error in the code to correctly initialize the Supabase client with environment variables.

Supabase
const supabase = createClient(process.env.[1], process.env.SUPABASE_ANON_KEY);
Drag options to blanks, or click blank then click option'
Asupabase_url
BsupabaseUrl
CSUPABASE_URL_KEY
DSUPABASE_URL
Attempts:
3 left
💡 Hint
Common Mistakes
Using camelCase or lowercase names for environment variables.
Using a wrong or non-existent environment variable name.
4fill in blank
hard

Fill both blanks to create a Supabase client with URL and anon key from environment variables.

Supabase
const supabase = createClient(process.env.[1], process.env.[2]);
Drag options to blanks, or click blank then click option'
ASUPABASE_URL
BSUPABASE_ANON_KEY
CSUPABASE_SERVICE_ROLE_KEY
DSUPABASE_API_KEY
Attempts:
3 left
💡 Hint
Common Mistakes
Using service role key instead of anon key.
Mixing up the order of URL and key.
5fill in blank
hard

Fill all three blanks to import, initialize, and export the Supabase client correctly.

Supabase
import { [1] } from '@supabase/supabase-js';

const supabaseUrl = process.env.[2];
const supabaseAnonKey = process.env.[3];

export const supabase = [1](supabaseUrl, supabaseAnonKey);
Drag options to blanks, or click blank then click option'
AcreateClient
BSUPABASE_URL
CSUPABASE_ANON_KEY
DsupabaseClient
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong import names.
Using incorrect environment variable names.
Trying to call a variable instead of the function.