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

    HerbeMalveillante

    02/15/2022, 6:21 PM
    and here is my profiles table if it ever is useful in any way
  • h

    HerbeMalveillante

    02/15/2022, 6:22 PM
    here is the code I use to fetch the data :
    Copy code
    javascript
    async function queryDatabase(){
            const { data, error } = await supabase
                  .from('posts')
                  .select()
    
            console.log(data)
        }
  • h

    HerbeMalveillante

    02/15/2022, 6:22 PM
    And the only posts logged are the public ones.
  • h

    HerbeMalveillante

    02/15/2022, 6:23 PM
    I get the exact same result when trying on a session where the user is not logged in.
  • i

    its-pablo

    02/16/2022, 2:17 AM
    my app is at https://windows99dev.vercel.app/experiments/login, and for some reason it says that createClient is not an export. Do you know why this is?
  • g

    garyaustin

    02/16/2022, 2:50 AM
    I looked at your code, and had already answered on github to your question.... you don't import, you do var supabase = supabase.createClient(SUPABASE_URL, SUPABASE_KEY) with the cdn download.
  • n

    Null

    02/16/2022, 4:22 PM
    anyone else experiencing realtime updates running twice?
  • n

    Null

    02/16/2022, 4:23 PM
    Like its running twice when something is added to the table
  • u

    user

    02/16/2022, 5:03 PM
    Hi I am trying to modify the next.js stripe subscription example to work with single payments to create a more traditional ecommerce site. I was able to get each stripe checkout session into supabase, but am having trouble getting the individual items within each checkout session. From reading the api docs I need to make an API call in the webhook handle to retrieve the Checkout Session object, passing the expand parameter to include the line_items field. I am stuck here and would appreciate any help I can get. Thanks! Webhook:
    Copy code
    case 'checkout.session.completed':
                const checkoutSession = event.data
                  .object as Stripe.Checkout.Session;
                await upsertOrderRecord(event.data.object as Stripe.Checkout.Session, checkoutSession.customer as string,);
                break;
    useDatabase `const upsertOrderRecord = async (session: Stripe.Checkout.Session, customerId: string) => { const { data: customerData, error: noCustomerError } = await supabaseAdmin .from('customers') .select('id') .eq('stripe_customer_id', customerId) .single(); if (noCustomerError) throw noCustomerError; const { id: uuid } = customerData || {}; const sessionData: Session = { id: session.id, amount_total: session.amount_total ?? undefined, user_id: uuid ?? undefined }; const { error } = await supabaseAdmin.from('orders').insert([sessionData], { upsert: true }); if (error) throw error; console.log(
    Product inserted/updated: ${session.id}
    ); };`
  • r

    reubence

    02/17/2022, 5:31 AM
    Hey guys, struggling with something hope to find some help here. I want to update my table with a key-value pair object which I have got as input from the user. I'm matching it with the original values that are there in the Table. I keep getting 404 Error. Is this happening cause supabase doesn't support it yet? (RLS is disabled for now)
    Copy code
    const { data, error } = await supabase
          .from("company")
          .update([inputFields.values])
          .match([originalFields.values]);
      };
    This is what inputFields.values / originalFields.values look like
    Copy code
    {
      "name": "Piramal Glassed",
      "email": "piramal@glass.com",
      "contact": "98203"
    }
    g
    • 2
    • 57
  • m

    Maus

    02/17/2022, 12:48 PM
    Question: When doing a bulk insert https://supabase.com/docs/reference/javascript/insert#bulk-create is it guaranteed that the response array in
    data
    will always be in the same order as the original insert data? Eg:
    Copy code
    const { data, error } = await supabase.from("table").insert([{name: 'a'}, {name: 'b'}, {name: 'c'}])
    console.log(data)
    // data: {data: [{id: 1, name: 'a'}, {id: 2, name: 'b'}, {id: 3, name: 'c'}]}
    s
    • 2
    • 2
  • r

    reubence

    02/17/2022, 1:18 PM
    i'm not trying to do a bulk insert. I'm trying to insert only one row in the table. The row itself has around 10 columns, which are in the same order yes because I am reading them from supabase itself.
  • g

    garyaustin

    02/17/2022, 2:24 PM
    404 error on match update
  • u

    「 stripess 」

    02/17/2022, 7:54 PM
    hey all, looking for some help on auth stuff. I'm following a relatively standard flow for signups that uses google, FB, or magic link.
  • u

    「 stripess 」

    02/17/2022, 7:55 PM
    I have a DB trigger to create profiles on auth signup, identical to https://egghead.io/lessons/supabase-use-supabase-to-subscribe-to-database-events-with-postgres-triggers
    s
    • 2
    • 19
  • u

    「 stripess 」

    02/17/2022, 7:55 PM
    my issue -- when a user signs up, I take them to a new page where they can then configure some of these details
  • u

    「 stripess 」

    02/17/2022, 7:56 PM
    leading to a race condition -- sometimes the profile i'm fetching 401s as the DB trigger hasn't completed yet
  • u

    「 stripess 」

    02/17/2022, 7:58 PM
    Copy code
    ts
        const { error } = await supabase.auth.signIn(
          { provider: 'google', },
          { redirectTo: `${REDIRECT_URL_BASE}/next-steps`,}
        )
  • u

    「 stripess 」

    02/17/2022, 7:58 PM
    and then
    /next-steps
    fetches profile
  • u

    「 stripess 」

    02/17/2022, 7:58 PM
    i suppose i could implement polling on
    /next-steps
    but that's a heck of a hack
  • s

    silentworks

    02/17/2022, 8:20 PM
    Trigger not completed before signup is done
  • v

    Veld

    02/20/2022, 2:14 AM
    Hey, to get any of the subscribers from the current eventm would this query work? I am getting 0 responses even though there should be 1
    Copy code
    js
          const allSubscriptions = await this.supabase
            .from<DiscordChannelSubscription>("discordChannelEventSubscriptions")
            .select("*")
            .or(`worldIdFilter.is.null,worldIdFilter.eq.${event.new.locationId}`)
            .or(`teamIdFilter.is.null,teamIdFilter.eq.${event.new.organizerId}`)
  • r

    RyanHirsch

    02/20/2022, 12:30 PM
    I'm trying to use the realtime subscription in a node program and can't seem to get events for one of my tables. The switch is on for all of my tables. I see subscriptions for all of my tables in the realtime
    subscription
    table, but getting nothing when I do inserts to one of them.
    Copy code
    ts
      supabase
        .from("*")
        .on("*", (payload) => {
          console.log("Change received!", payload);
        })
        .subscribe();
  • r

    RyanHirsch

    02/20/2022, 12:33 PM
    RLS is enabled for all my tables, I'm using the
    service_role
    to connect
  • d

    darkgod

    02/20/2022, 7:29 PM
    error while using function
  • d

    darkgod

    02/20/2022, 7:29 PM
    can anyone help me from this issue?
  • s

    Steve

    02/21/2022, 4:40 PM
    bulk insert order
  • y

    Yonben

    02/21/2022, 4:59 PM
    Hey all, quick Q about joins and such. I have 3 tables:
    users
    ,
    groups
    and
    groups_users
    . The last one is a table containing `userId`/`groupId` links, to join between them. What would be the ideal queries to get "All users of group `i`" and "All groups of user `j`"?
    s
    • 2
    • 8
  • j

    João Vitor

    02/21/2022, 7:28 PM
    Hey guys, I have a table
    posts
    with a
    user_id
    foreign key to
    auth.users.id
    and I'm trying to query the user info like this :
    Copy code
    js
    supabase.from('posts').select('*, users(*)')
    but I'm getting this error "Could not find a relationship between 'posts' and 'users' in the schema cache"
    s
    • 2
    • 15
  • p

    phollome

    02/21/2022, 9:20 PM
    Hi everyone, I played around with remix and supabase. I had an issue with updating data when using RLS. The
    superbase.auth.session
    was always
    null
    so the anon key was used on requests and updates where not applied (response
    404
    ). For now, I use a workaround: set
    access_token
    with the result of
    strategy.checkSession
    (https://github.com/mint-vernetzt/remix-supabase-test/commit/ae4eb834fcd10ca9aa5d3863fa3846fd4126e05a). I don't know, if it's the best solution, but maybe it helps others.
1...484950...81Latest