© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
2 replies
tpz

Error in createClient

Hello,
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 --debug
supabase functions serve supaconnect --debug


I 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:18
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:18


This error shows only when calling
createClient()
createClient()
, please note that I provided supabase api url, both tried inside variable and string directly in parameters

Any help is greatly appreciated.

Thank you
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

createClient typescript auth helpers
SupabaseSSupabase / help-and-questions
4y ago
Stubbing createClient gives an error about "error sending request for url"
SupabaseSSupabase / help-and-questions
3mo ago
Uncaught SyntaxError ambiguous indirect export createClient
SupabaseSSupabase / help-and-questions
4y ago
Importing createClient into edge function throws TS error and cannot start
SupabaseSSupabase / help-and-questions
4y ago