https://supabase.com/ logo
Join Discord
Powered by
# help
  • s

    snassr

    03/07/2022, 8:03 PM
    I put together a real-time client in go for supabase! How can I get it added to the supabase-community page?
    s
    • 2
    • 8
  • j

    joesaunderson

    03/07/2022, 8:20 PM
    Hey, I am using Supabase for a project I am building in NextJS, along with
    @supabase/supabase-auth-helpers
    I have a
    profiles
    table in the
    public
    schema that is automatically created (via a trigger/function) when a user signs up (via email or a provider), I have a column on this table called
    role
    which can be
    user
    or
    admin
    for now, depending on the signup flow. I am struggling to set this role field when using the
    Auth
    component in the helpers / when using third party providers. With the email/password signup JS library it's possible to do:
    supabase.auth.signUp({...}, {data: {role: 'admin'}})
    which I can then access in my trigger/function to set the role on the
    profiles
    table. However, I am struggling to do similar (doesn't seem to exist) when signing in (or up) with a provider / when using the
    Auth
    component. Forgive me if I am missing something obvious here, but I would be grateful to see how others are doing similar. Thanks in advance.
    s
    • 2
    • 3
  • s

    silentworks

    03/07/2022, 11:52 PM
    Reset a schema
  • s

    silentworks

    03/07/2022, 11:57 PM
    Supabase Auth Helpers
  • s

    Scott P

    03/08/2022, 1:02 AM
    Please don't cross-post. Most people will see the thread, and will help if they're able to
  • o

    owonwo

    03/08/2022, 1:03 AM
    Thanks, @User . I won't cross-post anymore.
  • o

    owonwo

    03/08/2022, 1:03 AM
    Can you help, tho?
  • l

    LeoSonnekus

    03/08/2022, 2:04 AM
    Hey can I have one Supabase account connected to multiple Github accounts so My agency can have a master account that I can use to build projects on while still being logged in as myself?
  • s

    stnmonroe

    03/08/2022, 2:30 AM
    Given two tables
    notes
    and
    tags
    , and a join table
    note_tags
    , if I wanted to create a
    tag
    and a relationship to a
    note
    in a single transaction, what's the best approach, if possible?
    g
    • 2
    • 2
  • d

    DavidBae

    03/08/2022, 2:35 AM
    Thanks ^^
  • m

    mcamendoza1

    03/08/2022, 6:16 AM
    Any knows github repo for RLS example 🙂 can i clone it to test it 🙂
    s
    • 2
    • 3
  • v

    v.naeimabadi

    03/08/2022, 7:16 AM
    hi , i am using subscribe in react-native.
    Copy code
    const mySubscription = supabase
      .from('*')
      .on('*', payload => {
        console.log('Change received!', payload)
      }).subscribe((status, e) => console.log(status, e))
    for android 7.0 i got *SUBSCRIBED * but in and android 10 i am getting two status: status= RETRYING_AFTER_TIMEOUT ,error= undefined and then *status= SUBSCRIPTION_ERROR ,error= undefined * any idea what's going on? @User
  • a

    ak4zh

    03/08/2022, 7:38 AM
    Copy code
    sql
    
    CREATE TABLE IF NOT EXISTS public.orgs
    (
        id uuid NOT NULL DEFAULT uuid_generate_v4(),
        created_at timestamp with time zone DEFAULT now(),
        name text COLLATE pg_catalog."default" NOT NULL,
        owner_id uuid NOT NULL DEFAULT auth.uid(),
        description text COLLATE pg_catalog."default",
        CONSTRAINT orgs_pkey PRIMARY KEY (id),
        CONSTRAINT orgs_owner_id_fkey FOREIGN KEY (owner_id)
            REFERENCES auth.users (id) MATCH SIMPLE
            ON UPDATE NO ACTION
            ON DELETE NO ACTION
    )
    
    CREATE TABLE IF NOT EXISTS public.org_members
    (
        id bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1 ),
        created_at timestamp with time zone NOT NULL DEFAULT now(),
        org_id uuid NOT NULL,
        user_id uuid NOT NULL,
        "select" boolean NOT NULL DEFAULT true,
        insert boolean NOT NULL DEFAULT true,
        update boolean NOT NULL DEFAULT true,
        delete boolean NOT NULL DEFAULT false,
        CONSTRAINT org_members_pkey PRIMARY KEY (id),
        CONSTRAINT org_members_org_id_fkey FOREIGN KEY (org_id)
            REFERENCES public.orgs (id) MATCH SIMPLE
            ON UPDATE NO ACTION
            ON DELETE NO ACTION,
        CONSTRAINT org_members_user_id_fkey FOREIGN KEY (user_id)
            REFERENCES auth.users (id) MATCH SIMPLE
            ON UPDATE NO ACTION
            ON DELETE NO ACTION
    )
    RLS on
    public.orgs
    - SELECT by owner and org members achieved with:
    Copy code
    sql
    CREATE POLICY "Enable access to org owner and org members"
        ON public.orgs
        AS PERMISSIVE
        FOR SELECT
        TO public
        USING (
      (auth.uid() = owner_id) 
    OR 
    (
      id IN ( SELECT org_members.org_id FROM public.org_members WHERE user_id = auth.uid() AND org_members."select" = true)
    )
    );
    - INSERT, UPDATE and DELETE by owner only achieved with
    auth.uid() = owner_id
    RLS on
    public.org_members
    - SELECT, INSERT, UPDATE and DELETE by org owner only When I creaate policy here it results in recurssion. What would be the appropriate solution?
  • a

    ak4zh

    03/08/2022, 11:03 AM
    Supabase website / dashboard not opening. Anyone else facing the issue? API calls working fine. EDIT: back now
  • o

    Olyno

    03/08/2022, 11:07 AM
    Hi try to ask in #869405720934744086, it is more appropriate for your need
  • s

    silentworks

    03/08/2022, 12:37 PM
    RLS examples
  • a

    Apfelsaft

    03/08/2022, 1:46 PM
    When is data == null in a query response?
    o
    • 2
    • 2
  • a

    anggoran

    03/08/2022, 3:08 PM
    Is it weird to double an auth flow but with same provider (google sign in with supabase and firebase)? I want to set supabase row level security and firebase security rules to utilize the SQL and NoSQL database differences
  • r

    ryfill

    03/08/2022, 3:33 PM
    Hi again, I just wanted to reshare this question because I'm still facing the same issue and cannot make any headway on resolving it. https://discord.com/channels/839993398554656828/843999948717555735/950409975803547668
  • g

    garyaustin

    03/08/2022, 4:36 PM
    Maybe someone here will come along, but I think your best bet is in that githib issue you posted to or to a sublink kiwicopple just added a few hours ago to the linked change which points to this https://github.com/supabase/supabase/pull/5817
  • b

    bake

    03/08/2022, 5:09 PM
    I have enabled RLS on a db table and i have not created any policies, yet i am still able to access the rows in the table. Essentially i've enabled RLS and it seems to not be locking down my table. Anyone know what could be going wrong?
    g
    • 2
    • 14
  • g

    garyaustin

    03/08/2022, 5:23 PM
    RLS being bypassed?
  • r

    ryfill

    03/08/2022, 8:42 PM
    Unfortunately I'm getting the same error in the same place after following the advice from #5817 as well. Surely, someone, somewhere has a working
    docker-compose
    and dummy
    .env
    file??
  • b

    brgrz

    03/08/2022, 10:31 PM
    how does one make a request to supabase REST API? I'm getting "No API Key was found in request". Using Postman with auth set to API key which I filled with the anon key
    g
    • 2
    • 5
  • g

    garyaustin

    03/08/2022, 10:46 PM
    rest api key
  • i

    irrationaljared

    03/08/2022, 11:02 PM
    I'm trying to do migrations through Prisma and it is having trouble with the shadow database. I need to create the auth.uid() function in the shadow database. Is there a way to check if that exists already and skip it? I can't find any way to do that in the postgres documentation. Here is the error I am getting:
    Copy code
    Migration `20220308221326_init` failed to apply cleanly to the shadow database. 
    Error:
    db error: ERROR: function auth.uid() does not exist
    Here is the relevant part of the initial migration:
    Copy code
    CREATE SCHEMA IF NOT EXISTS "auth";
    [How can I check for auth.uid() here?]
    
    CREATE SCHEMA IF NOT EXISTS "extensions";
    CREATE EXTENSION IF NOT EXISTS "uuid-ossp" SCHEMA extensions;
    CREATE EXTENSION IF NOT EXISTS "moddatetime" SCHEMA extensions;
    Any help would be greatly appreciated
  • e

    elliott

    03/09/2022, 2:09 AM
    How do I query two levels deep? For example here is a select:
    Copy code
    .from('reviews')
    .select('*, profile:user_id(*)')
    which works fine. However, I want to also get a relation from the profile table, which has followers. Something like this:
    Copy code
    .from('reviews')
    .select('*, profile:user_id(*, follows:follower_id(*))')
    Where follower_id is the ID that a "follow" object has which relates to the id of a "follow" to the "profile" table. I want to be able to use this "follows" object in the filtering of the query later. Does this question make sense? Sorry my SQL skills are weak, still learning. I've read the docs through for what it's worth and couldn't figure this one out.. Thank you!
    g
    • 2
    • 3
  • g

    garyaustin

    03/09/2022, 2:28 AM
    multi depth foreign table select
  • p

    Paul AKA TDI

    03/09/2022, 4:49 AM
    I do not understand how using supabase with a client based framework like svelte or react is secure? Surely you can just pull the the api keys out of memory with some basic debugging software?
    s
    • 2
    • 3
  • p

    Paul AKA TDI

    03/09/2022, 1:31 PM
    I am trying to create a record in superbase gui with a json type and the gui won't accept my JSON. I looked into postgreSQL and think it should work - any advice?
1...240241242...316Latest