https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Is there an equivalent REST API for await supabase.auth.getUser()?
    b

    battlesheep123

    01/05/2023, 4:43 PM
    Is there an equivalent REST API for await supabase.auth.getUser()?
    g
    • 2
    • 9
  • Contributing to GoTrue
    p

    Pythonic

    01/05/2023, 5:20 PM
    Hi, I was considering making an issue on the gotrue github, but it might be a small issue so I'll ask here first. I was following along with the contributing guide here: https://github.com/supabase/gotrue/blob/master/CONTRIBUTING.md And I got to this step:
    Copy code
    To setup the database schema via Soda, run:
    make migrate_test
    And I'm running into this error:
    Copy code
    {"level":"warning","msg":"WARNING: SAML is an incomplete feature and should not be enabled for production use!","time":"2023-01-05T12:15:07-05:00"}
    {"level":"fatal","msg":"running db migrations: Migrator: problem creating schema migrations: couldn't start a new transaction: could not create new transaction: failed to connect to `host=localhost user=supabase_auth_admin database=postgres`: failed SASL auth (FATAL: password authentication failed for user \"supabase_auth_admin\" (SQLSTATE 28P01))","time":"2023-01-05T12:15:07-05:00"}
    exit status 1
    make: *** [Makefile:28: migrate_test] Error 1
    Which makes me think that I need to change the database URL to something other than the default, but I don't know what I'm supposed to use:
    Copy code
    c
    GOTRUE_DB_DRIVER="postgres"
    NAMESPACE="auth"
    DATABASE_URL="postgres://supabase_auth_admin:root@localhost:5432/postgres"
    API_EXTERNAL_URL="http://localhost:9999"
    GOTRUE_API_HOST="localhost"
    PORT="9999"
    Any ideas?
  • Redirect to reset.svelte
    s

    Smardrengr

    01/05/2023, 5:56 PM
    I have a
    forgot.svelte
    page where users can, if they forget their password, ask for a password reset email (MagicLink) in order to sign in and update their password. (I'm use Supabase Auth Helpers.) I've got the email part working—Supabase signs them in when they click the link. But I'm not sure where and how to, in this case, redirect the browser to the
    reset.svelte
    page... Like, in what file would I potentially add a
    throw redirect(303, '/reset');
    ? THANKS!
    s
    • 2
    • 2
  • psql doesn't resolve host name from supabase connection string
    a

    a guy

    01/05/2023, 6:25 PM
    I’m trying to connect prisma to the DB. I set
    DATABASE_URL=connection string
    .
    prisma migrate dev
    timed out. I tried
    psql <connection string>
    , while following the supabase prisma guide. I get
    psql: error: could not translate host name "pswd@db.bloop.supabase.co" to address: nodename nor servname provided, or not known
    I tried with a different service, not supabase, and the migration worked. I wanted to use supabase for as much as possible, not just auth, but am I understanding correctly from all the posts here that prisma & supabase is not presently the simplest combo around? Any clues?
    n
    • 2
    • 1
  • Can't duplicate table by coping all the data into the new table.
    s

    Skoe

    01/05/2023, 7:07 PM
    When I press Save, it duplicates the table just fine with the correct row headers, but zero data is being transferred. Does anyone know a fix to it?
    g
    • 2
    • 4
  • Is it ok to use supabase-js on clients like React Native?
    m

    miky2fois

    01/05/2023, 7:12 PM
    Is it ok to use supabase-js on clients like React Native or it's better to have an API as a bridge where supabase-js is used to query the DB?
    k
    g
    • 3
    • 21
  • Use SDK or API in Next.js Apps
    k

    kpradel

    01/05/2023, 7:16 PM
    This is a general question about best practices: What are the pro's and con's of using the Supabase SDK in api routes which then connect to Supabase vs using the SDK directly client side?
  • Is it possible to stack multiple lte and gte with different columns in a select?
    g

    gaIaxy

    01/05/2023, 7:51 PM
    Currently trying to get all events based on start and long_event_end. Haven't found a way to do this. Before I separate and make it into another function I wanted to ask if there is a way to make it work
    g
    • 2
    • 15
  • relation public.device, maintainance ( * ) does not exist
    j

    Jesuscc9

    01/05/2023, 8:40 PM
    So, I before this I had have no errors trying to make this relations (i am using prisma btw).
    g
    s
    u
    • 4
    • 10
  • Storage Delete
    j

    jakeAnon

    01/05/2023, 9:05 PM
    Hello , I am having trouble deleting from storage with bucket name files. I believe its a RLS policy issue. I have tried adding the policy below after snooping around online but am getting pg.policies error. the file currently resides at public/files/uid() Do I need to target it as public/files? If so what is correct syntax
    Copy code
    -- Make sure the policy applies to the files bucket only
    bucket_id = 'files' AND
    --  Make sure they can only access their own folder within that bucket
    (storage.foldername(name))[1] = public::text AND
    -- Check the file name of the file and only allow delete if it matches the name below
    storage.filename(name) = auth.uid()
    Thank you
    g
    • 2
    • 19
  • How do best store percentages for taxes and in general?
    c

    CanRau

    01/05/2023, 9:13 PM
    Hey y'all, I'm a little confused as how best to store percentages, I have 2 use-cases: 1. Storing global tax rate percentages, from this link https://pgsql-general.postgresql.narkive.com/WxnWlSls/best-data-type-to-use-for-sales-tax-percent (where they also mentioned Los Angeles is 9.75%, so 0.0975) I figured
    numeric(5,5)
    seemed reasonable, which from what I understand couldn't be
    >=1
    right? 2. "General" percent in the sense that I want to be able to for example have 3 rows with each storing 1/3 which should add up to 100%. 0.3333.. wouldn't really work right, so either one has to be more like 0.34 so it add up to 100 or I store it differently? 1/3 is just an example, could be 1/2, 1/5, 3/5 etc.
    • 1
    • 2
  • TablePlus to Supabase connection refused error.
    g

    gregh.xyz

    01/05/2023, 9:26 PM
    I am using the "import from URL" option in Tableplus, so all the details should be correct, but I receive this error when I try to connect.
    s
    • 2
    • 2
  • Client-Server API Mismatch
    p

    Pythonic

    01/05/2023, 9:39 PM
    Hi there, I was curious about why I'm seeing differences in responses from API calls depending on WHERE the API is being called from. I have a very simple API call that is run BOTH on the client AND server:
    Copy code
    ts
    import { client } from "$lib/util/supabase";
    
    export const load = (async ({ url }) => {
        const { data: user, error: err } = await client.from('athletes').select();
        console.log(client, user, err);
        if(err !== null) throw error(parseInt(err.code), err.message);
        return { user };
    }) satisfies LayoutServerLoad;
    The log on the server shows exactly what I expect:
    Copy code
    [
      {
        created_at: '2023-01-05T21:11:27.669346+00:00',
        avatar: '***',
        first_name: '***',
        last_name: '***',
        id: 18611857
      }
    ] null
    But on the client I get something completely different:
    Copy code
    [] null
    I printed the client on both sides to see that I got the same thing, but it seems that one of the clients doesn't have an Authorization header?
    Copy code
    ts
    createClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, {
                    global: {
                        headers: {
                            Authorization: `Bearer ${token}`
                        }
                    }
                })
    Copy code
    headers: {
          Authorization: '***',
          'X-Client-Info': '@supabase/auth-helpers-sveltekit@0.8.6'
        }
    vs
    Copy code
    headers: {
          'X-Client-Info': '@supabase/auth-helpers-sveltekit@0.8.6'
        }
    s
    • 2
    • 48
  • Having difficulty getting simple RLS policy set up loosely based on the docs
    c

    coker

    01/06/2023, 3:35 AM
    I have a
    clients
    table, and an
    on_auth_user_created
    trigger to copy some of the data over to a public
    user_profiles
    table. For simplicity, the
    user_profiles
    table has an
    id
    , a
    user_id
    , and a
    client_id
    . A user should only be able to access the client that their
    user_profile
    links them to. The following policy will not let me query any clients. Currently,
    clients
    is the only table that I have RLS enabled for. What am I missing?
    Copy code
    pgsql
    create policy "Users can access the Client they are assigned to"
      on clients
      for all using (
        auth.uid() in (
          select user_profiles.id from user_profiles
          where client_id = clients.id
        )
      );
    g
    • 2
    • 3
  • Connection via PgAdmin
    r

    robkuz

    01/06/2023, 5:16 AM
    I am having issues connecting to my DB via PgAdmin. I am getting the error message:
    INTERNAL_SERVER ERROR: 'ServerManager' object has no attribute 'user_info'
    What can I do about this?
    n
    g
    • 3
    • 6
  • edge function 502 res
    d

    DeepITM

    01/06/2023, 5:58 AM
    Was working on Deno with Twilio to send a sms message while the message went through but the res was 502 from Supabase edge function… not sure what went wrong…. I didn’t use the ‘serve’ method so is it a must to use like the sample here: https://github.com/supabase/supabase/blob/master/examples/edge-functions/supabase/functions/restful-tasks/index.ts?
    • 1
    • 1
  • Unable to delete a user
    h

    HugoDuprez

    01/06/2023, 9:17 AM
    Hi folks! I'm unable to delete the user 🤔 Have you an hint?
    n
    g
    • 3
    • 3
  • Modifying user sessions
    d

    dr. frank

    01/06/2023, 9:47 AM
    Hi, is there any way to modify user sessions, either through the auth/sessions table or through a function in the supabase library? I would like to create a feature where a user can manage their sessions and sign out of certain sessions they do not recognize (or all sessions if they please) but I am not sure if this is possible through supabase auth.
    n
    g
    • 3
    • 4
  • RLS auth object confusion
    l

    Ladlum

    01/06/2023, 10:47 AM
    When creating a policy from the template to delete, the condition is auth.uid() = user_id. When saving the policy and then editing it again, the "auth." part is stripped out, and it shows (uid() = user_id). First I thought maybe it is just converting old api to new api or something, but when I inspected the table in database directly, it show the rule (auth.uid() = user_id), with the "auth." part still there. Is this inconsistency intended, and why is it so?
    n
    s
    • 3
    • 2
  • How to populate user relation in realtime
    k

    kresimirgalic

    01/06/2023, 12:08 PM
    Hey guys, i want to populate user_id in my messages table, this is the realtime subscription i have:
    Copy code
    React.useEffect(() => {
        const messagesSubscription = supabase
          .channel('message-channel')
          .on(
            'postgres_changes',
            { event: 'INSERT', schema: 'public', table: 'groups_message' },
            (payload) => {
              setMessagesData((oldMessages) => [...oldMessages, payload.new]);
            }
          )
          .subscribe();
    
        return () => {
          messagesSubscription.unsubscribe();
        };
      }, []);
    s
    g
    c
    • 4
    • 5
  • Edge functions failing on vercel middleware
    r

    rbkayz

    01/06/2023, 1:56 PM
    Specifically, it shows a relay error in invoking the function. Any clue why this might be happening?
    j
    • 2
    • 2
  • Reaching free tier limit, consequences?
    u

    1chbinamin

    01/06/2023, 2:10 PM
    Hello everyone, Supabase looks interesting for my app but I'm wondering what would happen if my free tier has exceeded? Would they send me a mail to upgrade to next tier of €25 a month? Do they also have some kind of DDOS protection?
    g
    a
    • 3
    • 3
  • How to change google account without loosing my work ?
    r

    RAOUL

    01/06/2023, 3:09 PM
    Hello 🙂 i use my google account to authorize my supabase account and create databases account . Yesterday my google account has been desactivated . My supabase is ok . But , for more security i want to change my supabase account to another google account ; How can i do that ?
    g
    • 2
    • 6
  • Magic Link does not reset after Hot Reload (MacOS)
    a

    Alf

    01/06/2023, 3:35 PM
    Hi Community, I just did the Flutter tutorial (https://supabase.com/docs/guides/getting-started/tutorials/with-flutter) and I quite enjoyed working with Supabase. I encountered on issue: If I login with the magic link, then log out and then make a hot reload from the IDE, the deep link workflow seems to run again (the link seems to be cached somehow) and I am logged in again. It does not seem to be a production problem: If I log out, then quit the application and start it again, it does not happen. I also could not reproduce it on the web application, only on the MacOS variant (I did not yet try out the iOS / Android variants). I am not sure if I am doing something wrong or this is some unexpected behavior, maybe even a bug in Supabase or the underlying AppLinks package? Kind regards, Alfred
  • audit_log_entries taking up too much space
    w

    warflash

    01/06/2023, 4:06 PM
    Hey I'm wondering whether entries from
    audit_log_entries
    can safely be deleted to regain disk space. At the moment its taking up over 60% of our disk which is not really favorable imo. Thank you!
    g
    • 2
    • 3
  • When logging in with the Supabase-swift library, a Swift.DecodingError.dataCorrupted occurs
    l

    larryM

    01/06/2023, 4:12 PM
    So ive setup login and session refresh within our iOS app, but whenever I try to log in with
    auth.signIn
    or
    auth.refreshSession
    , this error is thrown :
    Swift.DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [StringCodingKey(stringValue: "user", intValue: nil), StringCodingKey(stringValue: "identities", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), StringCodingKey(stringValue: "created_at", intValue: nil)], debugDescription: "Invalid date format: 2022-11-25T00:00:00Z", underlyingError: nil))
    c
    • 2
    • 5
  • Realtime Listen and Querying Foreign Table
    a

    anggoran

    01/06/2023, 4:26 PM
    I would like to also query a foreign table, while listening *(only) * to the primary table. We know the listen doesn't provide a parameter for foreign query.
    Copy code
    dart
    await supabase.from('documents')
      .stream(primaryKey: ['id'])
      .listen((List<Map<String, dynamic>> data) {
      // Do something awesome with the data
    });
    Respect to that, so should I do like this?
    Copy code
    dart
    await supabase.from('documents')
      .stream(primaryKey: ['id'])
      .listen((List<Map<String, dynamic>> data) {
       // final salesIDList = get all sales ids;
       await supabase
        .from('sales')
        .select()
        .in_('id', salesIDList);
    });
    g
    a
    • 3
    • 14
  • Help optimizing a slow query
    r

    Relisora

    01/06/2023, 4:39 PM
    Hi! I have a query that is super slow, especially compared to all the other ones I have around. If someone could help me optimize it, it would be lovely Here it is:
    Copy code
    sql
    select battle.season
    from battle
    inner join team on battle.id = team.battle_id
    where wizard_id = 2175612 
    AND battle.public IS TRUE
    group by battle.season
    It takes sometimes more than 2s to respond!
    g
    • 2
    • 7
  • Auth.UpdateUser not updating JWT token on client
    m

    Michael Maust

    01/06/2023, 5:07 PM
    I am trying to add some additional meta data to a given user but whenever I call the supabaseClient.auth.updateUser function (which is successfully updating the user), the client's JWT doesn't get updated. I've tried calling refreshSession() after the update call, but the session still doesn't update on the client. Any ideas of what I am doing wrong?
  • Auth redirectTo not working
    l

    luke90275

    01/06/2023, 6:03 PM
    Hi, I am trying to allow users to login to google and get redirected to the dashboard in my next js project. I try the following, yet it redirects the user to the index page with a bunch of query parameters (localhost:3000/#access_token=....):
    Copy code
    js
    await supabase.auth.signIn(
          {
            provider: 'google',
          },
          { redirectTo: '/dashboard' }
        );
    Any idea whats happening here?
    g
    • 2
    • 3
1...899091...230Latest