supabase: URL.hostname is not implemented

Bug report

Describe the bug

Just upgraded to supabase v2.0.0-rc.1 and getting a URL.hostname is not implemented error.

This is a React Native/Expo app.

To Reproduce

Do the following in an expo app:

export const supabase = createClient<Database>(SUPABASE_URL, SUPABASE_ANON_KEY, {
  auth: {
    persistSession: true,
    autoRefreshToken: true,
    detectSessionInUrl: true,
  },
})

Screenshot

image

Additional context

Never had problems in v1, so this is related to the latest update.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

error disappeared after importing this polyfill in the same file where I was importing the client:

import 'react-native-url-polyfill/auto'

import { createClient } from '@supabase/supabase-js'

Hello! I just got this error as well and I do not understand why this was closed @monicakh; The solution by @vbylen is more a workaround than anything else

I can confirm the issue still exists with supabase 2.4.0, react 18.1.0 and react-native 0.70.5.

The workaround works, but I guess a fix is still needed.

You’re right @ski043 @ildaneta @Garabed96, the docs needed to be updated. Ideally for RN supabase-js wouldn’t need to depend on hostname() (or have its own implementation), but in the mean time react-native-url-polyfill/auto is the best solution.

Docs have been updated as of https://github.com/supabase/supabase/pull/14207, thank you again @faizanraso.

May 2023, this is still an issue. “@supabase/supabase-js”: “^2.21.0” “expo”: “~48.0.11” “react-native”: “0.71.7”

import ‘react-native-url-polyfill/auto’ fixed it as @vbylen said but why close it without adding it to the documentation in: https://supabase.com/docs/guides/getting-started/tutorials/with-expo

@vbylen Should we close this issue ?

I’m here to confirm that this error is still happening.

Installing react-native-url-polyfill works, but a fix is necessary, or maybe update the documentation to explain better about it.

"react-native": "0.70.5",
"@supabase/supabase-js": "^2.7.0",
"expo": "~47.0.12"

Both Android and iOS: Screenshot 2023-02-04 at 10 49 42

Any resolutions to this error? I’m still getting this.

Same problem led me this way. Should definitely be mentioned in the quick start guide!