https://supabase.com/ logo
Join DiscordCommunities
Powered by
# javascript
  • j

    Joshios

    07/19/2022, 10:13 PM
    Like make an update to the database specifically
  • j

    Jesuscc9

    07/20/2022, 2:49 AM
    Hi, I have hours, with this issue, realtime is simply not working 😭 What I have done - Disable RLS on all my tables - Enable replication for all my tables It seems to be receiving the data correctly on the browser (as you can see in the image in the network tab) But my callback function is never called. this is my code
    Copy code
    jsx
      const [listener, setListener] = useState()
    
      useEffect(() => {
        if (typeof metrics === 'undefined') return
        if (typeof listener !== 'undefined') return
        console.log('added listener')
    
        setListener(
          supabase
            .from('metrics')
            .on('INSERT', (payload) => {
              alert('hola')
            })
            .subscribe((status) => {
              console.log({ status }) // Prints "CLOSED" then "SUBSCRIBED" and finally "CLOSED" idk why
            })
        )
    
        return () => {
          supabase.removeSubscription(listener)
          console.log('remove listener')
        }
      }, [metrics])
    as you can see is, very simple, I already tried with a non state variable but still not working BTW, in my realtime schema, in the subscriptions table I DO have the subscription
  • t

    Tekey

    07/20/2022, 3:01 AM
    You can try removing the dependency maybe?
  • j

    Jesuscc9

    07/20/2022, 3:02 AM
    yes, and also trying with different versions of supabase
  • t

    Tekey

    07/20/2022, 3:04 AM
    Removing the dependencies and disabling strict mode solves it for me yesterday, both has to be done tgt, have u tried doing both tgt?
  • j

    Jesuscc9

    07/20/2022, 3:06 AM
    what is tgt? 😳
  • t

    Tekey

    07/20/2022, 3:06 AM
    together
  • t

    Tekey

    07/20/2022, 3:06 AM
    just doing 1 of it doesn't solve it for me, both needs to be done
  • j

    Jesuscc9

    07/20/2022, 3:07 AM
    removing dependencies you mean deleting node modules?
  • t

    Tekey

    07/20/2022, 3:07 AM
    [metrics] becomes [ ]
  • t

    Tekey

    07/20/2022, 3:07 AM
    im not very sure tho..u can try
  • t

    Tekey

    07/20/2022, 3:07 AM
    and disabling strict mode along with this
  • j

    Jesuscc9

    07/20/2022, 3:09 AM
    I already tried them, and restarted my server but still not working
  • j

    Jesuscc9

    07/20/2022, 3:10 AM
    I didnt say it but my subscribe function is actually printing something:
  • t

    Tekey

    07/20/2022, 3:11 AM
    https://discord.com/channels/839993398554656828/997205421217558529/998962981444534333
  • t

    Tekey

    07/20/2022, 3:11 AM
    yea i got this ytd too
  • j

    Jesuscc9

    07/20/2022, 3:15 AM
    what is your react version tho?
  • j

    jaitaiwan

    07/20/2022, 3:24 AM
    @Jesuscc9 have you done any of these steps? https://supabase.com/docs/guides/database/replication
  • j

    Jesuscc9

    07/20/2022, 3:47 AM
    yes, I ve already reproduce the steps on the video
  • j

    Jesuscc9

    07/20/2022, 4:09 AM
    okey so after hours of trying I solved in this way
    Copy code
    jsx
      useEffect(() => {
        console.log('added listener')
    
        const previousSubscriptions = supabase.getSubscriptions()
    
        if (previousSubscriptions.length > 0) return // <--- THIS
    
        const listener = supabase
          .from('metrics')
          .on('INSERT', handleNewInsert)
          .subscribe((status) => {
            console.log({ status })
          })
    
        return () => {
          supabase.removeSubscription(listener)
        }
      }, [])
  • j

    Jesuscc9

    07/20/2022, 4:09 AM
    hope its useful for someone else
  • o

    owonwo

    07/20/2022, 9:05 AM
    I kinda have the same problem. But my subscription channel closes immediately after a successful subscription. I had to number every subscription, just to be sure it wasn't from my code. Anyone also experiencing the same issue?
  • o

    owonwo

    07/20/2022, 9:43 AM
    This is a serious issue for me. Can anyone help out? @User
  • l

    ltanady

    07/20/2022, 9:58 AM
    @owonwo can you open a ticket from the dashboard so we can look into your project specifically?
  • o

    owonwo

    07/20/2022, 10:24 AM
    Okay
  • j

    Jesuscc9

    07/20/2022, 2:17 PM
    I had the same problem, did you tried with my code?
  • j

    Jesuscc9

    07/20/2022, 2:18 PM
    and also I removed strict mode from react, idk if that also helped
  • l

    lazerrouge

    07/20/2022, 3:04 PM
    Hey! Is there a way to implement anonymous authentication with supabase? Exactly like in how it’s in firebase
  • g

    garyaustin

    07/20/2022, 3:09 PM
    This issue has some info on that topic: https://github.com/supabase/gotrue/issues/68
  • f

    fachofacho

    07/20/2022, 4:19 PM
    I have a working example of supabase running on an extension using chrome or firefox
1...727374...81Latest