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

    user

    08/15/2021, 2:41 PM
    Was checking the documentation and didn't find how to do signup with custom fields. Can we just pass additional fields in
    auth.signUp
    ? I'm reading this: https://supabase.io/docs/reference/javascript/auth-signup
  • r

    romlytech

    08/15/2021, 2:43 PM
    What do you mean by custom fields? If I'm understanding properly, you are probably looking to create a separate users or profiles table.
  • u

    user

    08/15/2021, 2:43 PM
    I was thinking about saving first name, last name for the user while signup
  • r

    romlytech

    08/15/2021, 2:45 PM
    The
    auth.users
    table is not exposed to the public api. Take alook at this guide: https://supabase.io/docs/guides/auth/managing-user-data
  • r

    romlytech

    08/15/2021, 2:46 PM
    You could make a trigger so the profile gets created automatically, or, what I do in most cases... is just upsert a new row on the public users table with the auth.user.id as the key.
  • u

    user

    08/15/2021, 2:49 PM
    I see. Thanks @romlytech!
  • r

    romlytech

    08/15/2021, 2:52 PM
    No problem. Everybody has their own way of doing things so perhaps you will find what suits your needs best. In my case, I typically allow the signup which gets the user into the application but do not allow any actions within the application until they've completed their profile.
  • o

    OctavianVoss

    08/15/2021, 3:07 PM
    hi! how would I move existing users to profiles?
  • r

    romlytech

    08/15/2021, 3:09 PM
    You aren't necessarily "moving" them. The users still exist on
    auth.users
    - you are just making another
    public.profiles
    (or whatever you decide to call it) where the primary key is the user's ID from the
    auth.users
    table.
  • r

    romlytech

    08/15/2021, 3:10 PM
    In two of my applications, I just use
    upsert
    for the
    public.profiles
    table on my Edit Profile pages and don't worry if they exist or not. The users signup, login then are redirected to the edit profile page.
  • j

    jon.m

    08/15/2021, 3:52 PM
    I have a related question. I have an update profile page where I do an upsert, but because my profile id is generated automatically by supabase- my upsert won’t work. The upsert requires sending primary key on payload , but if it’s the first time a profile os created, I won’t have a primary key Do I need to generate my keys on the client?
    s
    • 2
    • 3
  • o

    OctavianVoss

    08/15/2021, 4:08 PM
    thanks, trying to wrap my head around it
  • o

    OctavianVoss

    08/15/2021, 4:08 PM
    Posted this in JS channel, maybe someone could help with this one. 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?
  • l

    Lynqoid

    08/15/2021, 4:18 PM
    Can anyone help me, how do I download a copy of my database?
  • j

    jjj.westra

    08/15/2021, 5:54 PM
    sure
  • j

    jjj.westra

    08/15/2021, 5:55 PM
    myself i am using a sql client for that
  • j

    jjj.westra

    08/15/2021, 5:55 PM
    there are many available online
  • j

    jjj.westra

    08/15/2021, 5:55 PM
    I often use dbeaver since it is opensource 🙂
  • j

    jjj.westra

    08/15/2021, 5:55 PM
    https://dbeaver.io/
  • j

    jjj.westra

    08/15/2021, 5:58 PM
    Once you have added the database; just right-click on your schema to export the data
  • f

    fenix

    08/15/2021, 7:16 PM
    Why there are two different guides for self-hosting? (https://supabase.io/docs/guides/self-hosting) and (https://supabase.io/docs/guides/local-development)
  • n

    Nebula

    08/15/2021, 7:53 PM
    google oauth is bugged on React Native
  • a

    Adamo

    08/15/2021, 8:52 PM
    Copy code
    javascript
    import { createClient } from '@supabase/supabase-js';
    
    const supabaseUrl = process.env.SUPABASE_URL;
    const supabaseAnonKey = process.env.SUPABASE_ANON_KEY;
    
    export const supabase = createClient(supabaseUrl, supabaseAnonKey);
    Copy code
    env
    SUPABASE_URL=<url-here>
    SUPABASE_ANON_KEY=<key-here>
    So I setup the client, but in my NextJS app I keep getting an error
    Copy code
    Unhandled Runtime Error
    Error: supabaseUrl is required.
    What's going on here? When I console.log the url/key they are both being read in properly from the .env file.
  • l

    louis.barclay

    08/15/2021, 9:04 PM
    I'm using https://github.com/vercel/nextjs-subscription-payments I was having no problems with my app. Then I added an
    email
    field to
    public.users
    (which is a table that ships with the starter project). Now, user sign up is failing. I'm getting
    {message: "Database error saving new user", status: 500}
    . This is documented in several GitHub issues for Supabase but the solutions there aren't helping me. I've tried renaming
    public.users
    to
    public.accounts
    . Also tried deleting the
    handle_new_user
    function that ships with that starter project, since I figured that might be responsible, but I can't. I get an error saying
    Deleting handle_new_user failed: cannot drop function handle_new_user() because other objects depend on it
    . Also tried updating
    handle_new_user
    to the following, where I've added the logic for the new
    email
    field, in case that's the issue:
    Copy code
    begin
      insert into public.accounts (id, full_name, avatar_url, email)
      values (new.id, new.raw_user_meta_data->>'full_name', new.raw_user_meta_data->>'avatar_url', new.raw_user_meta_data->>'email');
      return new;
    end;
    The
    email
    field on
    accounts
    is nullable by the way. Any ideas gratefully appreciated since my SaaS business is totally broken right now, with no one being able to sign up and pay!
  • l

    louis.barclay

    08/15/2021, 9:06 PM
    I should add that inviting new users via the Supabase dashboard is also broken, with the same error:
    Inviting user failed: Database error saving new user
  • l

    louis.barclay

    08/15/2021, 9:08 PM
    Phew, fixed this. I ran
    DROP FUNCTION IF EXISTS handle_new_user cascade;
    which was suggested in this GitHub issue: https://github.com/supabase/supabase/issues/563
  • d

    Di

    08/15/2021, 10:42 PM
    I'm using DBMate for migrations, which creates a schema_migrations in the public schema. How should I make sure that it isn't queryable? I tried turning on RLS but it seems like since the Postgrest server is using the postgres user, people would still be able to access it?
  • d

    Di

    08/15/2021, 10:43 PM
    I think the purpose is a little different! With self-hosting you'd be deploying the backend yourself, so you should for example configure all the production DB secrets, whereas with local dev you can just use the defaults
  • d

    Di

    08/15/2021, 10:55 PM
    Why is the database URL for the postgrest service not "postgres://authenticator:postgres@db:5432/postgres"?
  • s

    Scott P

    08/15/2021, 11:46 PM
    Because it's not hosted inside Postgres database - it's a REST API that runs outside the database
1...515253...316Latest