https://supabase.com/ logo
Join Discord
Powered by
# off-topic
  • j

    jkl

    08/07/2021, 5:43 AM
    of how they differ
  • d

    Darkyellow

    08/07/2021, 5:55 AM
    Hi, is there a guide anywhere for installing supabase in a self host environment?
  • s

    Subh

    08/07/2021, 6:51 AM
    Hey team! Trying to migrate from Hasura to Supabase. So I need a bit of help in terms of best practices. For example, if I had to get a post's first 10 liked user including if the current loggedin user liked it. I have done it hasura like so
    Copy code
    query {
      post_by_pk(project_id: "some_uuid_for_post"){
        ifLiked: likes(where: {
          user_id: {
            _eq: "i_logged_in_with_this_uuid"
          }
        }) {
          id
        }
        likes(limit: 10) {
          user {
            name
            id
          }
        }
        total_like: likes_aggregate {
          aggregate {
            count
          }
        }
      }
    }
  • w

    Waldemar

    08/07/2021, 9:47 AM
    emailed you on beta@... regarding this. The dates look messed up. Not sure if just GUI problem, but would be good to sort out as I need to download the latest backup
  • w

    whytry

    08/07/2021, 12:45 PM
    @User This is out of pure curiosity and no direct question for Supabase, so I thought this is the most appropriate channel. For another project I am currently evaluating ways for API monetization. I know that you guys are using Kong as API gateway. I was wondering if you also had a look at tyk and what the main reasons were for going with Kong and if you are happy with Kong as API gateway. I don't have any experience with either and both seem to be pretty good API gateways.
  • s

    sherlock

    08/07/2021, 1:12 PM
    Hello! I'm seeing this issue on my new Postgres DB on a project using Prisma: https://www.prisma.io/docs/guides/performance-and-optimization/connection-management/configure-pg-bouncer#prisma-migrate-and-pgbouncer-workaround My migrations are run via GitHub Actions, and I've configured the Database URL to be the one from Settings->Database (port 5432), rather than the Connection Pooling section, which my app is using. However I'm still seeing this "prepared statement" error on most queries. So I would like to ask a couple questions: * Is port 5432 a "direct" database connection? * Is there any advice for the above issue I'm seeing? Thanks!
  • c

    carlomigueldy.eth

    08/07/2021, 1:57 PM
    Hey guys. Can someone guide me how to dump my DB from Supabase?
  • c

    carlomigueldy.eth

    08/07/2021, 1:58 PM
    I kinda want to perform this action
  • l

    Link

    08/07/2021, 3:06 PM
    I have a question
  • l

    Link

    08/07/2021, 3:06 PM
    what is supabase good for and what are the use cases for supabase?
    s
    k
    • 3
    • 4
  • l

    Link

    08/07/2021, 3:08 PM
    asking for a friend
  • h

    HarryET

    08/07/2021, 3:14 PM
    Can you user row level security on a single column? E.g. you have table with
    public, private & email
    and you want private & email to only be allowed if authenticated
  • k

    Kosh

    08/07/2021, 3:20 PM
    @User https://www.enterprisedb.com/postgres-tutorials/how-implement-column-and-row-level-security-postgresql
  • h

    HarryET

    08/07/2021, 3:22 PM
    Thanks! I get it now you need to make a view and then add perms on that view?
  • k

    Kosh

    08/07/2021, 3:25 PM
    I believe so.
  • h

    HarryET

    08/07/2021, 3:43 PM
    Ah that works but I can't do an ID check without hiding the ID :/
  • h

    HarryET

    08/07/2021, 3:43 PM
    Copy code
    sql
    CREATE VIEW hidden_account_info as select email, employee_id, name from public.accounts;
    CREATE POLICY "Hide protected account info from the public"
        on hidden_account_info
        for select
        using (
            id = auth.uid() OR -- ID Not found as not in the view
            is_account_admin(
                (SELECT * FROM public.accounts WHERE id = auth.uid())
            )
        );
  • h

    HarryET

    08/07/2021, 3:58 PM
    nvm got it with
    Copy code
    sql
    CREATE OR REPLACE FUNCTION f_hidden_account_info(user_id uuid)
    RETURNS boolean as $$
    declare
        account public.accounts := (SELECT * FROM public.accounts WHERE id = auth.uid());
    begin
        IF account.id = user_id OR is_account_admin(account) THEN
            RETURN TRUE;
        ELSE
            RETURN FALSE;
        END IF;
    end;
    $$ stable language plpgsql security definer;
    
    CREATE VIEW hidden_account_info as select email, employee_id, name from public.accounts;
    CREATE POLICY "Hide protected account info from the public"
        on hidden_account_info
        for select
        using (f_hidden_account_info(auth.uid()));
  • s

    sumchans

    08/07/2021, 4:20 PM
    Does anybody know whether the new Supabase phone authentication work on dart language?
  • i

    IvanCodes

    08/07/2021, 4:23 PM
    It's a community maintained lib so it's not under the control of the Supabase team
  • s

    sumchans

    08/07/2021, 4:24 PM
    Oh okay
  • i

    IvanCodes

    08/07/2021, 4:26 PM
    The only official one is in js https://supabase.io/docs/reference/javascript/supabase-client
  • s

    sumchans

    08/07/2021, 4:30 PM
    It does mention Dart with GoTrue
  • j

    jon.m

    08/07/2021, 5:58 PM
    In my _app.js file in Next:
    Copy code
    function MyApp({ Component, pageProps }) {
      const [user, setUser] = useState(null);
      useEffect(() => {
        const { data: authListener } = supabase.auth.onAuthStateChange(async () =>
          checkUser()
        );
        checkUser();
        return () => {
          authListener?.unsubscribe();
        };
      }, []);
      async function checkUser() {
        const user = supabase.auth.user();
        console.log(user);
        setUser(user);
      }
      return (
        <Provider store={store}>
          <Layout>
            <Component {...pageProps} />
          </Layout>
        </Provider>
      );
    }
  • j

    jon.m

    08/07/2021, 5:58 PM
    Hi everyone, I'm trying to work out the best way to handle user auth across my Next app. First question, given the code above, when I logout using the auth supabase UI, checkUser runs and logs out null for user. How/why is check user running when I log out? Is there a websocket subscription at work in the background that triggers a rerender of the application?
  • t

    Teesh3rt

    08/07/2021, 6:06 PM
    what language is this?
  • h

    HarryET

    08/07/2021, 6:08 PM
    SQL
  • t

    Teesh3rt

    08/07/2021, 6:11 PM
    oh ok sorry i just never used it
  • h

    HarryET

    08/07/2021, 7:04 PM
    dw
  • j

    jon.m

    08/07/2021, 10:14 PM
    Okay, I realize that in the code above, web sockets are irrelevant. It's a client side state that the subscription is for. Question: how is that state handled by the supabase client library? What framework or library does it use?
1...686970...392Latest