Error in createClient
Hello,
I am trying to create an edge function that connects to supabase.
This is my code:
And when running
I got these:
This error shows only when calling
Any help is greatly appreciated.
Thank you
I am trying to create an edge function that connects to supabase.
This is my code:
import { createClient } from 'https://deno.land/x/supabase/mod.ts';
const supabase = createClient(
MY_SUPABASE_URL,
MY_SUPABASE_SERVICE_ROLE,
);import { createClient } from 'https://deno.land/x/supabase/mod.ts';
const supabase = createClient(
MY_SUPABASE_URL,
MY_SUPABASE_SERVICE_ROLE,
);And when running
supabase functions serve supaconnect --debugsupabase functions serve supaconnect --debugI got these:
Serving supabase/functions/supaconnect
2022/10/26 21:16:13 Sent Header: Host [docker]
2022/10/26 21:16:13 Sent Header: User-Agent [Go-http-client/1.1]
2022/10/26 21:16:13 Sent Header: Content-Length [736]
2022/10/26 21:16:13 Sent Header: Content-Type [application/json]
2022/10/26 21:16:13 Send Done
2022/10/26 21:16:13 Recv First Byte
Watcher Process started.
error: Uncaught TypeError: Cannot read properties of undefined (reading 'href')
if (!url) url = window.location.href
^
at getParameterByName (https://deno.land/x/gotrue@3.0.0/src/lib/helpers.ts:17:35)
at new GoTrueClient (https://deno.land/x/gotrue@3.0.0/src/GoTrueClient.ts:94:57)
at new SupabaseAuthClient (https://deno.land/x/supabase@1.3.1/src/lib/SupabaseAuthClient.ts:6:5)
at SupabaseClient._initSupabaseAuthClient (https://deno.land/x/supabase@1.3.1/src/SupabaseClient.ts:166:12)
at new SupabaseClient (https://deno.land/x/supabase@1.3.1/src/SupabaseClient.ts:69:22)
at createClient (https://deno.land/x/supabase@1.3.1/src/index.ts:11:10)
at file:///home/deno/functions/newhello/index.ts:4:18Serving supabase/functions/supaconnect
2022/10/26 21:16:13 Sent Header: Host [docker]
2022/10/26 21:16:13 Sent Header: User-Agent [Go-http-client/1.1]
2022/10/26 21:16:13 Sent Header: Content-Length [736]
2022/10/26 21:16:13 Sent Header: Content-Type [application/json]
2022/10/26 21:16:13 Send Done
2022/10/26 21:16:13 Recv First Byte
Watcher Process started.
error: Uncaught TypeError: Cannot read properties of undefined (reading 'href')
if (!url) url = window.location.href
^
at getParameterByName (https://deno.land/x/gotrue@3.0.0/src/lib/helpers.ts:17:35)
at new GoTrueClient (https://deno.land/x/gotrue@3.0.0/src/GoTrueClient.ts:94:57)
at new SupabaseAuthClient (https://deno.land/x/supabase@1.3.1/src/lib/SupabaseAuthClient.ts:6:5)
at SupabaseClient._initSupabaseAuthClient (https://deno.land/x/supabase@1.3.1/src/SupabaseClient.ts:166:12)
at new SupabaseClient (https://deno.land/x/supabase@1.3.1/src/SupabaseClient.ts:69:22)
at createClient (https://deno.land/x/supabase@1.3.1/src/index.ts:11:10)
at file:///home/deno/functions/newhello/index.ts:4:18This error shows only when calling
createClient()createClient(), please note that I provided supabase api url, both tried inside variable and string directly in parametersAny help is greatly appreciated.
Thank you