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

    user

    08/15/2021, 8:04 AM
    let { data: users, error } = await supabase.from("users").select("user_id, cash").eq("user_id", userID);
  • u

    user

    08/15/2021, 8:04 AM
    This is my code
  • l

    lawrencecchen

    08/15/2021, 8:05 AM
    Try console.logging the payload inside the callback function. Nothing looks wrong to me. Try looking at the network tab in devtools to see if a websocket connection was created. Also try actually rendering the post variable. I think you're just forgetting to mutate the posts variable when a payload comes in, so you're probably looking for something like
    setPosts([...posts, payload.new])
    **made an update, something was wrong
  • l

    lawrencecchen

    08/15/2021, 8:06 AM
    Is there an error message?
  • z

    Zenon

    08/15/2021, 8:07 AM
    I did that too There is a socket created, but I'm monitoring the response and it's always blank
  • l

    lawrencecchen

    08/15/2021, 8:07 AM
    uh
  • l

    lawrencecchen

    08/15/2021, 8:07 AM
    console.log directly in the callback
  • l

    lawrencecchen

    08/15/2021, 8:07 AM
    supabase is working
  • l

    lawrencecchen

    08/15/2021, 8:08 AM
    don't bother with another effect that reacts to post. just call setPosts in the `.on((payload) => {}) `function
  • z

    Zenon

    08/15/2021, 8:09 AM
    okay
  • z

    Zenon

    08/15/2021, 8:10 AM
    no response
  • l

    lawrencecchen

    08/15/2021, 8:10 AM
    are you sure replication is enabled?
  • l

    lawrencecchen

    08/15/2021, 8:10 AM
    can you screenshot the supabase dashboard?
  • z

    Zenon

    08/15/2021, 8:11 AM
    This is how it's supposed to be, right?
  • l

    lawrencecchen

    08/15/2021, 8:12 AM
    click into tables
  • l

    lawrencecchen

    08/15/2021, 8:12 AM
    right button
  • l

    lawrencecchen

    08/15/2021, 8:12 AM
    and enable posts
  • z

    Zenon

    08/15/2021, 8:13 AM
    done I'll try again
  • z

    Zenon

    08/15/2021, 8:13 AM
    man what a dumb mistake I just saw everything was enabled, I thought it was ready
  • l

    lawrencecchen

    08/15/2021, 8:13 AM
    yeah they can make it a bit more obvious 🙂
  • u

    user

    08/15/2021, 8:18 AM
    No error, it shows null, and the data array is empty too
  • u

    user

    08/15/2021, 8:18 AM
    But the db does contain data
  • u

    user

    08/15/2021, 8:19 AM
    If I query anything without the filters it works
  • u

    user

    08/15/2021, 8:29 AM
    user_id is a text value and the variable I'm passing to eq is a string, if that makes a difference
  • u

    user

    08/15/2021, 8:29 AM
    I've been at it all morning, can't figure out what's wrong.
  • l

    liljamesjohn

    08/15/2021, 11:23 AM
    I am getting the error; "Error: supabaseUrl is required." When console logging it shows the actual url thought (Keys are inside '.env.local'
    Copy code
    import { createClient } from "@supabase/supabase-js"
    
    const supabaseUrl = process.env.supabaseUrl
    const supabaseAnonKey = process.env.supabaseapi
    
    console.log(supabaseUrl)
    
    const supabase = createClient(supabaseUrl, supabaseAnonKey)
    
    export { supabase }
  • f

    florian-lefebvre

    08/15/2021, 11:53 AM
    I think you need the
    dotenv
    package
  • o

    OctavianVoss

    08/15/2021, 2:03 PM
    Hi everyone! I'm having an issue with token refresh in NextJS. Once the token expires, I can't access protected routes because
    user
    is
    null
    . Has anyone else encountered this as well?
  • e

    e0

    08/15/2021, 2:27 PM
    It seems that I can't use
    { count: 'exact' }
    with
    rpc
    . Not sure if it's because I'm providing params to my stored procedure function. Has anyone else encountered this problem? I'm thinking about creating an issue on https://github.com/supabase/postgrest-js and just wanted to check here first. Maybe I just don't have the
    count
    at the right place. For example:
    Copy code
    let query = supabase
    query = query.rpc(
      'custom_filter',
      { filter_params },
      { count: 'exact' },
    )
    const{ count, data, error } = await query.range(0, 99)
    In the meantime, it seems that I can get by with the following workaround before sending the query. The
    { count: 'exact' }
    also works fine in
    select
    .
    Copy code
    query.headers = {
      ...query.headers,
      Prefer: 'count=exact',
    }
  • s

    Sduu_

    08/15/2021, 4:13 PM
    @e0 I highly doubt that count should work with rpc. But then when you said you have a functioning work around, I was confused too. Are you sure that it's working?
1...91011...81Latest