https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Supabase Functions & Webhooks
    m

    matt-j-stevenson

    01/14/2023, 5:33 PM
    Before I migrated from NextAuth to Supabase Auth, where I had User/Account models defined in my Prisma schema, I was able to create a Supabase Webhook that triggered an automation flow on Make.com on a new User INSERT. Now with Supabase Auth, for Webhooks there is no User table to be watched for any mutations, so I can't exactly do the same thing. I'm not too proficient in SQL, but I'd love to implement this using Supabase and I know there's probably a way using SQL queries in Functions. I also see these are still not suitable for Production environments, are these soon to be better established features of Supabase? All help appreciated, Thanks
    v
    n
    • 3
    • 6
  • Multiple triggers created on one schema
    a

    anggoran

    01/14/2023, 5:43 PM
    I'm not sure whether we should have different trigger and function name on each schema. But, it works on the function, while the trigger returned to the same schema
    • 1
    • 1
  • Hello, Im new to supabase-js
    c

    CzarSalad

    01/14/2023, 5:44 PM
    I have gotten stuck, Im learning supabase-js but got stuck with sorting through data so I asked chat GPT and it eventually circled endlessly around this and it never worked. Before the code I should explain what Im trying to do, I have 3 columns, Im trying to get the 3rd column based on the first 2 matching my variables. So I can then use its data later in the API endpoint.
    Copy code
    //query the data
    const result = await supabase
    .from('reactionroles')
    .select('*')
    .where('emoji', theEmoji)
    .and('message_id', theMessage)
    .orderBy('id', 'asc')
    .offset(2)
    .first()
    Here is the error I got:
    Copy code
    {
      "error": {
        "message": "supabase.from(...).select(...).where is not a function",
        "stack": "TypeError: supabase.from(...).select(...).where is not a function\n    at (/functions/events/discord/message/reaction/reaction-role-add.js:19:2)"
      }
    }
    So from what I understand .where and .and literally don't exist in the API. But I have no clue what to replace them with. Can anyone help?
    a
    • 2
    • 24
  • Only allow update if email ends with...
    r

    rchrdnsh

    01/14/2023, 6:16 PM
    Made a table with policies, like so:
    Copy code
    postgresql
    -- 1. Create table
    create table string_posts (
      id int8 unique not null primary key,
      created_at timestamp with time zone,
      updated_at timestamp with time zone,
      slug text unique,
      title text,
      description text,
      content text
    );
    
    -- 2. Enable RLS
    alter table string_posts
      enable row level security;
    
    -- 3. Create policies for table
    create policy "Public profiles are viewable by everyone." on team
      for select using (true);
    
    create policy "Only team members can edit posts."
      on string-posts
      for update using (
        right(auth.jwt() ->> 'email', 13) = '@arrowgtp.com'
      );
    n
    • 2
    • 5
  • Should my user ID have both Is Unique and Is Identity enabled? What is the difference?
    e

    Elliott Storey

    01/14/2023, 6:21 PM
    Thank you!
    g
    • 2
    • 1
  • Server Side Rendered Auth
    m

    motorhead

    01/14/2023, 6:26 PM
    Can someone help me understand how to server-side submit a login/auth form and keep/pass the cookie to my client? Is there an example or a guide I can follow? (server can be node or an SSR framework like svelte-kit)
    s
    • 2
    • 1
  • Does Supabase support advanced OAuth workflows?
    c

    corey

    01/14/2023, 6:27 PM
    Hello All, I understand that for generic auth supabase uses the basic GitHub OAuth workflow to authenticate a user. Our app makes heavy use of GitHub's API on behalf of users, and for that we will need the tokens returned by GitHub. Does Supabase support this and if so how would I go about integrating this? Thanks a lot
    • 1
    • 1
  • How to download images in bucket depending on table's data?
    p

    Pauline_Cx

    01/14/2023, 6:27 PM
    Hello ! I followed the quickstart supabase where users can get an avatar image. It works well. What I would like in my page is to display images of all my users. So I created a function to get the users. But I don't know how I can get the public url to render :/. For those who don't know the architecture: In a table "profiles" there is a "avatar_url", referencing an object in a bucket "avatars". But "avatar_url" is not a link I can send to href. I sent my code with my idea, it doesn't work of course but I don't know what I should do. I would love some help 🙂
    a
    g
    • 3
    • 3
  • Invoking Edge functions through supabaseClient in Local Development
    n

    Nin

    01/14/2023, 7:25 PM
    So here's something I'm currently running into. I'm using the supabaseClient to invoke my functions and have seen that, of course, when doing so, it will use my local Supabase API. This means that if I don't have the function running, it will probably not work at all. How would I do this when I have multiple Edge Functions, do I start them all, is that even possible?
    s
    g
    • 3
    • 4
  • service_role to bypass functions
    f

    fridon

    01/14/2023, 7:48 PM
    given the following function
    Copy code
    sql
    CREATE OR REPLACE FUNCTION is_member_of(_user_id uuid, _organization_id uuid) RETURNS bool AS $$
      SELECT EXISTS (
        SELECT 1
        FROM user_metadata um
        WHERE um.org_id = _organization_id
        AND um.id = _user_id
      );
    $$ stable language sql security definer;
    I want to allow service_role key to bypass this function and since this function bypasses RLS anyway, I get no data when using the service role. Is it possible to do so, maybe with CASE or IF statement within the function?
    s
    • 2
    • 6
  • Upsert Upload Violates Row Level Security Policy
    l

    luke90275

    01/14/2023, 7:48 PM
    I am trying to upload an image to storage using a key, with the exception that if the key exists, the image will be updated instead of inserted. For this reason I am using the upsert option (but let me know if this is the wrong case to use that option). So the code essentially looks like:
    Copy code
    js
    await supabase.storage.from('storage').upload(key, value, { upsert: true });
    However, I am running into the following error:
    Copy code
    {statusCode: '403', error: '', message: 'new row violates row-level security policy (USING expression) for table "objects"'}
    As shown in the image, I believe my policies should allow one to upsert (either update or insert) as they are as lenient as possible [right?]. Any ideas what could be happening here?
    s
    a
    • 3
    • 3
  • opinions and expierience with moving from prisma to supabase and react query?
    j

    J0rdan

    01/14/2023, 8:53 PM
    moving from prisma to supabase and react query? What are the expieriences would it be better? Missing out features. I want to sleepedup and improve my dx. Would this switch be then wise or should i better stick with something like just prisma
    n
    • 2
    • 10
  • Unsubscribing from channel vs disconnecting from socket...
    m

    malachi

    01/14/2023, 10:11 PM
    Hi all, I am currently implementing realtime and I was wondering if someone could explain to me the difference in times where I may want to unsubscribe from my current realtime channel or when I would want to disconnect from the realtime socket completely. Are there any benefits to keeping the socket open even if the user is on a screen that does not require realtime?
    g
    • 2
    • 1
  • How to fix supabase link "Invalid db.major_version"
    b

    Bruce

    01/14/2023, 11:28 PM
    I've been following along this guide: https://supabase.com/docs/guides/resources/supabase-cli/managing-environments#sync-production-project-to-staging I've deployed the github actions, but am getting an error when the production action runs:
    Error: Failed reading config: Invalid db.major_version: 15.
    Does someone know why this happens?
    s
    • 2
    • 7
  • Migrate from strapi to supabase
    p

    pablo

    01/15/2023, 5:28 AM
    Hi, I want to migrate from using strapi to supabase. Has anyone tried this before? or is there an easy way?
  • More control over the data stored from identity
    a

    Alaanor

    01/15/2023, 8:33 AM
    Is it possible to enforce stricter guideline to gotrue ? I don't really want to have the metadata from the social auth to be stored on my postgres, except the email that is actually necessary. Do we have any control over gotrue at all in a supabase managed instance (ie non self hosted) ?
    g
    • 2
    • 2
  • error in " User Management Starter "
    s

    silentworks

    01/15/2023, 10:20 PM
    Your project seem to not have a
    auth.users
    table, go to the table view and select the
    auth
    schema and look if there is a
    users
    table in there. If there isn't then your project wasn't setup correctly or you have run some sort of migration tool on the project that has wiped that schema/table.
    t
    g
    • 3
    • 4
  • Delete user with password confirmation, deleteUser()
    k

    KERSTIN

    01/15/2023, 10:51 AM
    Hello, I want to delete a user where the user has to confirm his password to delete the account. How can I check if his password match before deleting? I was thinking maybe to look for an auth event but not sure if this would work with ex SIGNED_IN event since the user is already signed in?
    g
    • 2
    • 4
  • Supabase Auth Cookies
    m

    Mihai Andrei

    01/15/2023, 11:46 AM
    Hello! I started a new project with supabase and nextjs and i set up the auth with the next helpers. I saw that the session is stored in a normal cookie. Is there some discusion about this? I would love to read a bit on how they decided the use plain cookies. I remember in the begining it was stored in local storage
    n
    • 2
    • 2
  • Error on AUTH redirect
    c

    corey

    01/15/2023, 11:58 AM
    Upon successfully logging in with an OAuth Provider (GitHub in this case), the provider attempts to redirect me to the application, and fails. The following error is shown in the browser console: Prevented navigation to “https://.supabase.co/auth/v1/callback?code=” due to an unknown protocol. I have been messing around with custom domains etc but at the moment I am using NO custom domain at all, and my site url is set to localhost:3000. Does anyone have any idea what might be causing the error? It seems Supabase is not correctly handling the auth redirect. I'm sure I've misconfigured something.
    k
    • 2
    • 3
  • RLS could not find array type for data type uuid[]
    o

    Olyno

    01/15/2023, 12:15 PM
    Hi I'm experiencing an issue with RLS. I'm trying to check if a user is in an organization, but i'm getting this error:
    Copy code
    could not find array type for data type uuid[]
    Here is my function:
    Copy code
    sql
    create or replace function is_in_organization(id_organization uuid)
    returns boolean
    language sql
    security definer
    set search_path = public
    stable
    as
    $$
        select exists (
            select 1
            from organizations
            where organizations.id = $1
            and (is_owner_of($1) or auth.uid() = any (organizations.members))
        )
    $$;
    I'm using it as RLS check like: ``is_in_organization(id)`` My ``organizations`` table looks like that:
    g
    • 2
    • 92
  • Update Success but not updated in Supabase
    k

    Kamael愛

    01/15/2023, 12:55 PM
    Hi, I have an update statement like the one below.:
    Copy code
    const {data, error, status} = await supabase.from("kuma_resources")
        .update({
            acid: parseInt(acid),
            metal: parseInt(metal),
            fossil: parseInt(fossil),
            magic_dust: parseInt(magic_dust),
        })
        .eq("profile_id", stealer.id)
        .select()
        console.log(data, error, status);
    When I run this code, it returns the following response:
    Copy code
    json
    {
    data: [],
    error: null,
    status: 200
    }
    why is it returning
    200
    and doesn't return the affected data even if I have a
    .select()
    ? I have checked the
    stealer.id
    in the
    kuma_resources
    table and it exists there.
    a
    • 2
    • 13
  • Inserting a date into supabase
    a

    Alexander

    01/15/2023, 1:20 PM
    How does the date look like before you sign in the user? Maybe it's in the wrong format?
    z
    • 2
    • 31
  • Session stay empty after sign in
    w

    Wuju

    01/15/2023, 6:08 PM
    Hello, I am using Next.JS with
    supabase/auth-helpers-react
    , and Google Oauth provider. After signing in, my session and my user stay null. For exemple on this screen, the text never appears even after logging in and returning to the same page
    l
    • 2
    • 6
  • Invitation email - Set password
    c

    Cake

    01/15/2023, 7:03 PM
    Hey! I'm looking around the internet, but i can't find a good answer to this question. When I invite a user through email, they receive a email, with a link
    <a href="{{ .ConfirmationURL }}/auth/set-password">
    the
    /set-password
    bit i found online to be able to redirect to a page where I can tell the user to set their password. My concern here is: How can i check that the user haven't allready set the password after the initial signup? This is to prevent people from accessing the url
    /auth/set-password
    directly. Any thoughts on how I can solve this?
  • RLS Policy not firing error
    d

    DDupasquier

    01/15/2023, 9:02 PM
    I've got a functional RLS policy blocking users from making changes to things that don't belong to them, but when I attempt to make those changes I don't get any kind of error from the API. Is there a way to instruct RLS to send an error message?
    g
    • 2
    • 23
  • TypeError: Cannot read properties of undefined (reading 'createClient')
    h

    Hugos

    01/15/2023, 9:55 PM
    Keep getting this error, I have no clue what im doing wrong i've followed the supabase tutorial very closely and have made many projects with supabase.
    • 1
    • 1
  • How to use Google Datastream to send data to BigQuery?
    i

    Ikhsan Assaat

    01/15/2023, 10:07 PM
    Hi, I recently migrated from Firebase to Supabase. Using Firebase, I was able to stream data to BigQuery using their extensions. What is the easiest way to stream data from Supabase to BigQuery? I've tried using Google Datastream support for self-hosted postgres with no success yet. I've followed their steps but I think some admin access wasn't allowed anymore by default. I've enquired Google to but no reply yet. Has anyone successfully streamed supabase data with Datastream? Thanks 🙇‍♂️
  • timezone difference on client and db
    i

    iStun4Fun

    01/15/2023, 11:24 PM
    Im having a problem where client is showing me a db -1 day, and i cant debug this if its a supabase problem or a client problem. Supabase shows 1/15 but client shows 1/14. I had to use period with day 2 to group analytics of current month, if i used day 1, it renderes last day of previous month. RPC And Supabase data is ok, but client is interpreting a day less.
  • Supabase memory usage is always extremely high (98%+)
    d

    dav

    01/16/2023, 12:02 AM
    Hi, my supabase database (Pro + Small Add-on: 2 GB RAM vs. 1) has its memory usage always around 98%. I previously didn't have this issue before I purchased the add-on. Is there any way to debug this? I checked for idle connections (
    SELECT count(1) FROM pg_stat_activity where state='idle'
    ) and there were 13, 9 of which have the usename
    authenticator
    g
    i
    • 3
    • 7
1...9899100...230Latest