https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • [Solved] How does auth.uid() identify the user who is logging in?
    k

    komagata

    11/21/2022, 6:59 AM
    The sessions table has information about all the people who are logged in at that time, but how is it identified on the DB side?
    n
    g
    • 3
    • 3
  • [Solved] Empty response on various API endpoints
    m

    MDobs

    11/21/2022, 7:37 AM
    Getting null responses when performing normal CRUD operations Captured video as well of the issue, this is on a new project, new account, new table
    desktop-2022-11-21-09-33-23-01
    • 1
    • 2
  • supabase auth issue
    t

    therakeshpurohit

    11/21/2022, 8:45 AM
    I am using Invite -> sign up -> login flow for authentication of my app. Firstly I am using the invite user API to invite users. On receiving an accept invitation mail I am using the sign-up form to create the password for the user and I am using Sign up API of superbase to do the same. Both the APIs give the success message. Password is also stored in the auth.users table in encrypted form. But when I try to log in to the user using the same credentials it gives me an error of "Invalid login credentials".
    s
    • 2
    • 4
  • How to show logout button after the authentication is done with login button?
    z

    ZebraCoder

    11/21/2022, 10:08 AM
    Hey in Navbar I have made the login button and after authentication I want to show logout button and vice versa? A small guide will very helpful.
    n
    j
    • 3
    • 7
  • How can I change the Auth text on the sign-in button?
    s

    skagiya

    11/21/2022, 10:34 AM
    I'm using Auth from @supabase/auth-ui-react and would like to change the text from 'Sign in with Discord' to like 'Login'. Thank you always.
    Copy code
    import { useSupabaseClient } from '@supabase/auth-helpers-react'
    import { Auth } from '@supabase/auth-ui-react'
    
    export const LoginButton = () => {
      const supabase = useSupabaseClient()
    
      return (
        <>
          <Auth
            supabaseClient={supabase}
            providers={['discord']}
            onlyThirdPartyProviders={true}
          />
        </>
      )
    }
    s
    • 2
    • 3
  • supabase db remote commands are no longer needed?
    k

    kouwasi

    11/21/2022, 2:54 PM
    They are not working in my environment and they are looks like the same feature as
    db diff
    . What is the difference? It's for compatibility with the previous version?
  • Importing createClient into edge function throws TS error and cannot start
    p

    pid1

    11/21/2022, 4:33 PM
    I posted images of the code and errors. I removed all the code in my actual function to show it's the import statement failing. Function code:
    Copy code
    // Follow this setup guide to integrate the Deno language server with your editor:
    // https://deno.land/manual/getting_started/setup_your_environment
    // This enables autocomplete, go to definition, etc.
    
    import { serve } from 'https://deno.land/std@0.131.0/http/server.ts';
    import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.0.0';
    Error:
    Copy code
    Download https://deno.land/std@0.165.0/node/internal_binding/_winerror.ts
    Check file:///home/deno/functions/test/index.ts
    error: TS2314 [ERROR]: Generic type 'PostgrestQueryBuilder<Schema, Relation>' requires 2 type argument(s).
        at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:57:126
    
    TS2314 [ERROR]: Generic type 'PostgrestQueryBuilder<Schema, Relation>' requires 2 type argument(s).
        from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<View>;
                                                                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~
        at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:58:120
    
    TS2314 [ERROR]: Generic type 'PostgrestQueryBuilder<Schema, Relation>' requires 2 type argument(s).
        from(relation: string): PostgrestQueryBuilder<any>;
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~
        at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:59:29
    
    TS2314 [ERROR]: Generic type 'PostgrestFilterBuilder<Schema, Row, Result>' requires 3 type argument(s).
        at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:72:9
    
    Found 4 errors.
    2022/11/21 11:28:48 Sent Header: Host [docker]
    2022/11/21 11:28:48 Sent Header: User-Agent [Go-http-client/1.1]
    2022/11/21 11:28:48 Send Done
    2022/11/21 11:28:48 Recv First Byte
    Error: error executing command
    Execution:
    supabase functions serve test --debug
    Thank you for any help you can offer!
    g
    • 2
    • 2
  • How to add google auth on ionic app with supabase
    q

    quentin_guerrier

    11/21/2022, 4:35 PM
    Hello, i have an issue on the auth of my ionic app. First i use NUXT 3 and supabase-2. I create a login with email on the app and it's works. But when i try to use google provider supabase open safari on iphone and when is login don't go back to my ios application. If you have a solution or exemple it's will be perfect. Quentin
    g
    • 2
    • 11
  • Query help
    s

    Smardrengr

    11/21/2022, 6:33 PM
    I'm trying to adjust the following query—which works—in order to know if a player belongs to, or has joined, each game in the result set.
    Copy code
    select 
     games.name AS game,
     profiles.name AS organizer
     from games 
    
    left join profiles on games.organizer_id = profiles.id
    
    where games.organizer_id = 'f316de4e-e478-4ce3-842c-00e98f475870'
    or games.organizer_id in (select friends.friend_id from friends where friends.user_id = 'f316de4e-e478-4ce3-842c-00e98f475870' and friends.accepted = true)
    or games.id in (select players.game_id from players where players.user_id = 'f316de4e-e478-4ce3-842c-00e98f475870')
    order by games.datetime asc
    ;
    Not sure how to proceed. Like, I think I need to do a
    count(players.id)
    and add a
    where
    clause that matches the user id...
    z
    g
    • 3
    • 4
  • storage policy functions reference
    s

    Stephcraft

    11/21/2022, 7:54 PM
    Is there a more detailed storage policy functions reference than: https://supabase.com/docs/guides/storage Is there a way to see the definitions of the storage helper functions from the
    database > Functions
    tab with a different schema? 1. The two helper functions that I need:
    storage.filename(...)
    that returns only the filename without the extension:
    avatar
    instead of
    avatar.png
    2.
    storage.folderpath(...)
    that returns the string path of the folders
    folder/again/here/
    instead of an array of folders
    [ 'folder', 'again', 'here' ]
    Thank you
    g
    • 2
    • 3
  • TS types incorrect for join tables
    l

    LordZardeck

    11/21/2022, 8:30 PM
    I have the following query:
    Copy code
    ts
    const { data, error } = await supabaseClient
        .from('costs')
        .select('id, title, unit:unit_type_id(name), created_at, updated_at, price_per_unit')
        .eq('category_id', categoryId)
    Which results in the following type:
    Copy code
    ts
    const data:
        | ({ id: string } & { title: string } & {
                unit: { name: unknown } | { name: unknown }[] | null
          } & { created_at: string } & { updated_at: string } & { price_per_unit: unknown })[]
        | null
    As you can see, the
    unit
    join has incorrect property type of
    unknown
    , according to Supabase generated types, it should be
    string | null
    How can this be fixed? On another, note,
    unit
    shouldn't be able to be an array. Supabase apparently doesn't recognize the join table at all, and that might be the root of the issue
    s
    • 2
    • 1
  • Basic Auth + Policies Help
    k

    Ken

    11/21/2022, 8:59 PM
    Hey Everyone, I am relatively new to web dev, so forgive me if I am doing something boneheaded here. To get acquainted with Supabase I am simply trying to achieve logging in with a script and inserting a row to the database with RLS on. I am using nodeJS v18.9.0 with TypeScript 4.8.4 on a Mac on the desktop. I made a table called 'testTable' that just has simple 'test' varchar column. I created a policy allowing "authenticated" users to Insert on the same table. Here's what my TypeScript type looks like: https://pastebin.com/Eu63D34B The error I keep getting is code 42501, 'new row violates row-level security policy for table "testTable"'. Why am I posting here? I am unsure as to whether I am logging in correctly, and it could be as simple as that. In the example code I pasted, am I logging in correctly? Do I need to store the users tokens or something that somewhere and pass them to the insert command somehow? Or is the supabase API taking care of all of that for me? If I am logging in correctly then I guess I need advice on setting up the RLS policies. Thanks for your time. Ken
    g
    s
    • 3
    • 28
  • Run plpgsql function after 7 days from trigger.
    f

    floyare

    11/21/2022, 9:24 PM
    So I had an idea for handling banned users. When I update
    is_banned
    row from user's profile from profiles table It would hide his posts that are connected by his uuid with images table. Now I want to make something like deletion his profile and posts from database after 7 days. Is it even possible? I know maybe database triggers with functions may do a trick but I'm not sure. Any ideas?
    g
    • 2
    • 1
  • login window appears on latest supabase studio container (0.22.11)
    z

    Zarkex

    11/21/2022, 9:56 PM
    This started appearing with the new 0.22.11 image, I can't register or login. What to do?
    g
    s
    • 3
    • 2
  • CLI fresh project linking fails to connect (actively refused by target machine)
    m

    mattrasto

    11/21/2022, 10:03 PM
    I'm receiving an error when running:
    Copy code
    supabase link --project-ref hnewgu...vnszyprt --password <DB-PASS>
    
    Error: failed to connect to `host=db.hnewgu...vnszyprt.supabase.co user=postgres database=postgres`: dial error (dial tcp 127.0.0.1:6543: connectex: No connection could be made because the target machine actively refused it.)
    Try rerunning the command with --debug to troubleshoot the error.
    Steps from start to finish: 1. Created a new project in Supabase web UI 2. Installed the CLI fresh (Windows, so using scoop) 3. Logged in using access token 4.
    supabase init
    5.
    supabase start
    6.
    supabase link
    (see above) Project ref is the same from Supabase project's URL and DB settings, and also tried with the associated output from
    supabase projects list
    . I'm certain I'm using the correct password, as I've used it to connect via DBeaver. I tried resetting the password as well; no beans. Am I missing something, or is this a bug?
    g
    • 2
    • 4
  • realtime websocket failed to connect
    a

    amitmirgal

    11/21/2022, 11:12 PM
    here is the code snippet, side note RLS is enabled
    Copy code
    import { RealtimeClient } from '@supabase/realtime-js'
    const socket = new RealtimeClient(
      'wss://<project-ref-id>.supabase.co/realtime/v1'
    )
    socket.connect()
        const channel = socket.channel('public:user')
        channel.on(
          'postgres_changes',
          { event: '*', schema: 'public', table: 'user' },
          (e) => console.log('payload ', e)
        )
        channel.subscribe()
    g
    • 2
    • 24
  • how close are webhooks?
    s

    srb

    11/22/2022, 2:57 AM
    Hi, very excited to finally be using supabase for a new project. It seems really great for a serverless typescript stack. My question is how close are webhooks to beta/general release? I really like the idea of firing a webhook to a supabase edge function after a record is created to process the record. I am wondering if I should use the webhooks, or build something similar with triggers and pg_net/pg_http. Is that what the webhooks is using behind the scenes? I'm just tinkering on a side project, so not anticipating massive scale out of the gate, so wondering if i could get away with riding out using webhooks, or best not to risk it if they're super unreliable rn. wondering if it's like... not reliable at all, reliable but might have weird edge cases, reliable but won't scale well, will scale well just dx isn't polished, everything is fine just lack of docs, etc.
    g
    • 2
    • 2
  • Trigger to update user metadata when some userdata fields update
    k

    KrisGunnars

    11/22/2022, 6:12 AM
    Right now, I have Supabase setup with a trigger to create an entry in the "userdata" table whenever a new user signs up. However, I want to also sync some properties from the userdata and into the auth metadata. For example, whether the user has a paid subscription or not. How would I go about creating a trigger that updates the user's auth metadata when a field in the user's userdata table updates? As in: If (userdata.plan) changes --> update user metadata.plan
    n
    g
    j
    • 4
    • 3
  • Deno version in edge function
    m

    Martin INDIE MAKERS

    11/22/2022, 7:51 AM
    i still have again the issue of not understanding the deno version we have... in the last release of deno 1.28 we can now import npm modules https://deno.com/blog/v1.28 but i'm unable to know what version we have the only way was to try to deploy and have the deception that we are not in 1.28 ... the reason of hiding the deno version from ourself is very very anoying
    i
    m
    u
    • 4
    • 5
  • using auth, how can i make it so that the user needs to login to access certain pages?
    b

    bennypc

    11/22/2022, 8:57 AM
    using react router btw
    z
    • 2
    • 6
  • PLPGSQL Function - add new auth user id to existing users or profiles table?
    c

    cbunge3

    11/22/2022, 1:16 PM
    add new auth.users ID to go into an already existing row based on the email that is associated with the auth.users and the public.user email how would that look? in my head im thinking an if statement auth.users (email) == public.user (email) but im not sure if thats how that looks. This syntax throws me off since i have never used it before.
    g
    j
    • 3
    • 4
  • Mimecast modifies password reset links making them invalid
    j

    jopfre

    11/22/2022, 3:51 PM
    I am having the same issue as these two posts https://github.com/supabase/supabase/discussions/3961 https://github.com/supabase/gotrue/issues/542 Mimecast intercepts the links and redirects them through their own domain first which leads to
    error=unauthorized_client&error_code=401&error_description=email+link+is+invalid+or+has+expired
    in the url Anyone have a fix for this? I am wondering if its because I haven't set up the custom domain yet and emails are coming from mail.app.supabase.io? I am currently working on using OTP verification as a fallback but it would be good to get this working without, for better UX.
    j
    g
    • 3
    • 5
  • Uncaught SyntaxError ambiguous indirect export createClient
    t

    The Little Cousin

    11/22/2022, 4:42 PM
    I'm trying to just get information from the database via API from the client side. I have two files.
    index.html
    Copy code
    <!DOCTYPE html>
    <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>Workshops</title>
            <script type="module" src="./main.js"></script>
    
        </head>
        <body>
    
        </body>
    </html>
    and
    main.js
    Copy code
    import { createClient } from "https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2";
    
    const SUPABASE_URL = "";
    const SUPABASE_KEY = "";
    
    // Create a single supabase client for interacting with your database
    const  supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
    
    // Code here waits to run until the DOM is loaded.
    const getWorkshops = async () => {
        try {
            let { data: workshops } = await supabase
            .from('workshops')
            .select('*');
        
            return workshops
        } catch (error) {
            console.log(`500 Internal Server Error. err: ${error}`);
        }
    }
    
    console.log(getWorkshops);
    All files in the root directory. Getting the following error in the console;
    Uncaught SyntaxError: ambiguous indirect export: createClient
    Can anybody please help me? 🙏
    y
    g
    • 3
    • 3
  • RLS policies aren't working on local dev env
    u

    uneatenauthor

    11/22/2022, 4:58 PM
    I use the local docker stack version of supabase for development before pushing to hosted production. I noticed that an RLS policy I had working locally was failing in prod and am now realizing that at some point, RLS seems to have stopped working entirely on my local env. I have made sure the policies are enabled. What else can I check?
    g
    • 2
    • 145
  • how to save a list
    s

    Siddharth

    11/22/2022, 6:46 PM
    Hello community, I want to save lists of text in a single cell. Is it possible?
    g
    • 2
    • 2
  • When updating a many to many relationship on a junction table, is it better to recycle rows?
    a

    aarku

    11/22/2022, 8:04 PM
    Say I have, for instance, a table of User and a table of Channel, and a UserChannel junction table that has columns for User.id and Channel.id. If I then have a list of Channel to delete from a User, and a list of new Channel to add to a User, is it a good idea to recycle the rows as possible? So if I'm deleting three Channel and inserting two Channel for a User, I can make that into one delete and two updated rows. I wrote the code to do that but now I've realized I'm making an assumption that I don't know the answer to. Thanks 🙂 -Jon
  • Does pubsub-style messaging go through the database?
    a

    Al Mo

    11/22/2022, 9:33 PM
    Hi all! I have a question re. realtime, broadcast and presence in particular (no CDC). Based on the classic setup, one publisher broadcasts messages in a particular channel, then subscribers get them, does this go through the database? i.e is this a functionality built on top of Postgres? Or is it a different thing custom impl. of w/e?
    g
    • 2
    • 2
  • Convert Client Query To Raw SQL (Flutter)
    c

    caseycrogers

    11/22/2022, 10:33 PM
    Is there a way to get the raw-sql equivalent of my query? I'm trying to debug a client query that's not returning any results, it'd be really helpful to get it's SQL equivalent so I can play with it and test it to figure out what's wrong.
    s
    g
    • 3
    • 5
  • OAuth Callback on self-hosted supabase
    b

    bartolomeurodrigues

    11/22/2022, 10:48 PM
    Hello everybody. Noob question. I am trying to setup a login with LinkedIn as provider in a self hosted instance of Supabase, and I've set the redirect_uri in the LinkedIn App Panel and the GOTRUE_EXTERNAL_LINKEDIN_REDIRECT_URI environment variable to both http://localhost:3000/auth/v1/callback and http://localhost:3000/callback and I still get a 404 when LinkedIn calls the redirect uri. Anyway I can setup the OAuth locally? PS : I've been basinf myself on this part of the gotrue docs https://github.com/supabase/gotrue#external-authentication-providers
    • 1
    • 1
  • Bandwidth Usage
    v

    Vengeance

    11/22/2022, 11:17 PM
    Is there a place to view the amount of bandwidth used for the month? If so I can't seem to find it
    g
    • 2
    • 1
1...697071...230Latest