https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How can I use my environment variables in the http extension?
    f

    Fainaru

    01/21/2023, 12:32 AM
    I need to use the http extension but I have no way to hide my API keys
    g
    • 2
    • 7
  • new row violates row-level security policy for table "cartItems"
    a

    Amara

    01/21/2023, 1:51 AM
    Hey please i keep getting this error trying to save to the database "new row violates row-level security policy for table "cartItem", this is my code, what do you suggest i do
    g
    f
    +2
    • 5
    • 25
  • Update Email
    c

    camiaei

    01/21/2023, 2:04 AM
    Hi! My supabase account has my github email linked to it, but I will not use that email anymore. I changed my github email but I can't find a way to change my email in supabase. Thanks!
    g
    • 2
    • 1
  • RAM use at 95%. Is there anyway to analyze what is using the most so I can optimize?
    j

    jopfre

    01/21/2023, 3:19 AM
    Not sure how to investigate. I am just on the free tier atm so perhaps it is this but I feel like most of tables only have a couple of rows each in them as I am still in development atm and just testing. Any pointers?
  • supabase py - rpc - Returned type record does not match expected type text in column 1.
    v

    Vallery

    01/21/2023, 6:38 AM
    Copy code
    drop function if exists get_member_log;
    create function get_member_log(membertag text)
      returns table (
        playername text, 
        team text[], 
        opponent text[], 
        t int,
        map text, 
        ticket int, 
        trophychange int
        )
    language plpgsql
    as $$
    begin
       return query
       select (
          club_members.playername, 
          club_league.team, 
          club_league.opponent, 
          club_league.time,
          club_league.map, 
          club_league.ticket, 
          club_league.trophychange
        )
        from club_league
        inner join club_members on club_league.playertag = club_members.playertag
        where club_league.playertag = membertag;
    end;
    $$
    I have an rpc like the above but when I try to call it using supabase py wrapper it says 'Returned type record does not match expected type text in column 1.' Why does it return a record type? and how can I fix this?
    • 1
    • 1
  • How do you import SQL script to make a table?
    s

    silentworks

    01/21/2023, 11:15 AM
    Please read the documentation as this is documented.
    a
    g
    • 3
    • 3
  • Self-hosted realtime Python URL
    k

    Kjell

    01/21/2023, 8:29 AM
    How do I format the URL for self-hosted realtime? I tried something like 'ws://realtime-dev.192.168.1.157:4000/socket'; but the client cant use this address
    • 1
    • 1
  • Sharing functions and types between Supabase functions and frontend?
    e

    Eidur

    01/21/2023, 9:40 AM
    I'm a newbie working on a Sveltekit + supabase project. I make heavy use of edge functions and I found myself rewriting a lot of the same utility functions for both. I'll appreciate any guides/examples of how to set up a mono repo like this: Packages: - webapp (pnpm, sveltekit) - supabase (/functions - deno) - utility (can be imported both by sveltekit and deno)
    f
    • 2
    • 3
  • How do I see my active constraints?
    l

    Lukas V

    01/21/2023, 9:41 AM
    Hello, I just recently created some constraints for some of my columns, However I couldn't find anything displayed in the dashboard that shows it. How can I find all active constraints on my columns?
    n
    • 2
    • 1
  • Delete auth.user when profile is deleted
    e

    elliott

    01/21/2023, 9:53 AM
    I've set my database up carefully with cascading tables so that when a profile is deleted all traces of their activity are gone - however I am left with an empty auth.user column, since I do not seem to be able to set up a cascading relationship there. Is there any way for me to delete the auth.user column when the profile is deleted?
    s
    • 2
    • 2
  • Get user from UID
    j

    jacin

    01/21/2023, 11:35 AM
    Hello, I have the user UID and I want to fetch the user to get the email. Is that possible? Thank you.
    n
    • 2
    • 3
  • Option `unique` is missing from the web GUI
    t

    thasmo

    01/21/2023, 1:00 PM
    The GUI shows that I've set 1 option for a table column, which is the
    unique
    option, but the option is missing from the dropdown. Is this a known/recent issue?
    g
    s
    • 3
    • 2
  • Google Auth no longer works
    d

    DaLink

    01/21/2023, 1:03 PM
    I am using Angular. The login was already working and I wrote CSS and now Google Auth doesn't work from one minute to the other. I get error messages from the Supbase API
    error=server_error&error_description=Unable%20to%20exchange%20external%20code:.....
    I have already checked the Google Creds, they have not changed... Can it be that there is a problem in the backend, because I am briefly logged in and redirected, then the session is immediately destroyed and I am redirected back to the login page.
    o
    • 2
    • 3
  • Blocking all request from domains excepts whitelisted
    d

    Dbugger

    01/21/2023, 1:25 PM
    Is there a way to make sure that supabase rejects every request to manage the Auth/DB, unless it comes from a browser and from a specific domain? Some sort of whitelist?
    g
    n
    +3
    • 6
    • 416
  • identity/autoincrement sequence is not being found after import
    c

    craftables

    01/21/2023, 5:54 PM
    I am importing a former postgres csv data set csv into supabase. It has a simple autoincrement key I have tried multiple options but ultimately I consistently get this problem:
    Failed to run sql query: relation "community2_id_seq" does not exist
    I set id as the primarykey and identity. I am sure it is properly sequenced but it won't let me import it directly. So i just remove the identity key setting on creation, and then I just set it to identity after the table is created from the gui.. However, once I do that, the autoincrement key is set at 1, I want to reset it to the length of the import, but when I go to do that in the SQL editork, the SQL is failing to allow me to alter the sequence and says the relationship does not exist * select pg_get_serial_sequence('Community', 'id') * I try runnning this command in sql editor but then i get
    Failed to run sql query: relation "community" does not exist
    Could anyone please help!
    g
    • 2
    • 1
  • trying to link local db to remote one, getting major version error
    a

    athomas

    01/21/2023, 6:01 PM
    I'm trying to link my local database to my remote one, and I'm getting this error Remote database Postgres version 15 is incompatible with db.major_version 14. If you are setting up a fresh Supabase CLI project, try changing db.major_version in supabase/config.toml to 15. when I change the major version in the config, I get the error: Error: Failed reading config: Invalid db.major_version: 15. any thoughts?
    g
    l
    s
    • 4
    • 5
  • Twitter Auth Provider Tokens are Null?
    s

    Shelby

    01/21/2023, 6:16 PM
    I want to use the twitter api and supabase sign in says provider token is null?
    b
    s
    • 3
    • 5
  • Copy from one table to other
    s

    shantanubharadwaj

    01/21/2023, 6:43 PM
    how to copy the one record from one table to another table using Supabase service. As I want to copy the data from one to another.
    g
    • 2
    • 9
  • ERROR: unable to find email with Twitter provider
    g

    Gregory

    01/21/2023, 8:13 PM
    I no longer want to ask Twitter users for their email address, so I turned it off in the App settings. But now Supabase tells me "500: Error getting user email from external provider", unable to find email with Twitter provider. Why is it still trying to get their email address? Is an email address necessary if Twitter Auth is the only type of Auth I want for my web app?
    g
    t
    • 3
    • 5
  • createServerSupabaseClient() throwing TypeError
    a

    aw_jelly

    01/21/2023, 8:13 PM
    When I use createServerSupabaseClient in
    auth-helpers-nextjs
    I get the following error
    [TypeError: context.res.getHeader is not a function]
    It's coming from the setCookie method and causes my app to throw an unhandled error. I'm currently using Next 13 and auth-helpers-nextjs 0.5.2
    l
    n
    s
    • 4
    • 15
  • query greater than equal on a foreign table
    c

    Cardoso

    01/21/2023, 9:43 PM
    I have a 2 tables related with each other. Table A has 2 columns ( start_date , end_date ) that i want to filter when querying table B. so when i do
    Copy code
    supabase.from<B>(Table B).select("*, b(*) ") i get all the information.
    but when i get do
    Copy code
    const date = new Date().toISOString();
    supabase.from<B>(Table B).select("*, b(*) ").gte("A.start_date", date);
    i only get table B information even though i have the b_id present on the table. I also tried filter but i did not manage to get any results. I will go on the view approach. question is if i'm doing anything wrong or it is a limitation.
    g
    • 2
    • 24
  • Email template guidence
    j

    jar

    01/21/2023, 11:09 PM
    This may be a more generic question than supabase specific but I'd like to make my sign in emails prettier. Any pointers on good email template makers / guides. I'll do my own digging in meantime
    l
    • 2
    • 4
  • Supabase CLI db commands extremely slow
    c

    Cody

    01/21/2023, 11:26 PM
    When running commands like
    supabase db push
    or
    supabase db dump
    , it takes around 4 to 5 minutes to ask for my database password. Once I enter it, the command finishes executing quickly. Essentially, anything that connects to my hosted Supabase instance via CLI is extremely slow. I tried restarting my hosted instance, but that did not fix the issue.
    s
    • 2
    • 39
  • net.http_collect_response hangs in supabase console
    c

    cayblood

    01/22/2023, 1:02 AM
    The following code hangs in the supabase console:
    Copy code
    select * from net.http_collect_response(
      (SELECT net.http_get('http://httpbin.org/headers', '{}'::jsonb, '{"Content-Type": "application/json"}'::jsonb)),
      async := false
    );
    I'm struggling to figure out how to test the
    pg_net
    if I can't even run this.
  • How to get the latest AMI from `supabase/postgres` repo running on hosted projects?
    m

    mqp

    01/22/2023, 1:15 AM
    Pretty self-explanatory. I'm interested in the
    pg_vector
    and
    pg_repack
    extensions which were just merged into the build in https://github.com/supabase/postgres. Right now it looks like the AMI build is broken due to some internal problems, but once it's fixed, how will I actually get my existing instance running that AMI?
  • remix createServerClient connection pool and session management?
    t

    th_m

    01/22/2023, 1:39 AM
    Ok I just updated from V1 to V2 of the SDK . The auth.API.setToken function is now gone and the best thing I found to replace it was the createServerClient helper for remix. Before the update I had a single instance of supabase and would retrieve a token from my session cookie set the token into the supabase client. I'm essentially doing the same thing but now I am also instantiating a new serverClient on each request. It feels like it smells bad. Is there a better way? Is this dialing a psql connection on each request? Is there an alternative to the setToken that I missed?
    g
    • 2
    • 4
  • Trying to convert sql to js
    b

    bob_the_robot

    01/22/2023, 2:30 AM
    Hey crew! I have this bit of SQL that works fine in the SQL Editor, but I am not sure how to write it properly with the JS tool.
    Copy code
    sql
    select id,username from profiles where id = (select profile_two from friends where profile_one = 'user-uuid-string')
    Tried this, but does not work.
    Copy code
    js
    await supabaseClient
      .from("profiles")
      .select("username, id")
      .eq("friends.profile_one", "user-uuid-string");
    > Cannot apply filter because 'friends' is not an embedded resource in this request Have tried this with no success
    Copy code
    js
    await supabaseClient
      .from("profiles")
      .select(`username, id, friends(profile_two)`)
      .eq("friends.profile_one", user.id);
    > Could not embed because more than one relationship was found for 'profiles' and 'friends' the
    friends
    table is just
    uuid (pk), profile_one (fk), profile_two (fk)
    the
    profiles
    table is
    uuid (pk), username
    Trying to capture where the current user is in
    profile_one
    column and return profile username and the
    id
    and
    profile_two
    would be the same, so that part doesn't matter. Just trying to gather the other profile's username. Thanks for any help
    • 1
    • 1
  • Issue with nextjs 'getting started' boilerplate
    s

    simrell

    01/22/2023, 2:44 AM
    Hi, I'm trying to get the nextjs boilerplate working with Supabase following the guide here https://supabase.com/docs/guides/getting-started/quickstarts/nextjs however I'm getting the following error (screenshot of error & code below) .. seems like something pretty basic
    n
    • 2
    • 4
  • Auto-Incrementing IDs in composite primary key
    c

    ccssmnn

    01/22/2023, 8:28 AM
    In my app there are organizations that can create tasks. Instead of having a serial task ID, I would like to have an incrementing task ID for each organization ID. Just like in GitHub, where repo + issue number leads to the issue. So I define tasks like:
    Copy code
    sql
    create table "Tasks" (
      "organizationId" int references "Organizations"(id),
      id int check (id > 0),
      description text not null,
      
      primary key ("organizationId", id)
    );
    But Users should not "know" the ID before creating it, so I add a trigger:
    Copy code
    sql
    create function increment_task_id() returns trigger language
    plpgsql security definer as $$
    declare
      next_id integer := 1;
    begin
      select coalesce(max("id") + 1, 1)
        from "Tasks"
      where "organizationId" = new."organizationId"
      into next_id;
      new.id = next_id;
    return new;
    end;$$;
    
    create trigger task_insert
    before insert on "Tasks"
    for each row execute function increment_task_id();
    This works fine until I run multiple insertions in parallel. The triggers seem to be executed in parallel, leading to several tasks having the same ID. Inserts might fail when two or more people happen to create a task at the same time. How can I avoid this? Is there a better way?
    l
    s
    • 3
    • 16
  • RLS extra columns vs join queries in policies?
    u

    unknown1337

    01/22/2023, 8:37 AM
    Hello, implementing RLS to ensure users (org members) can only affect table rows that belong to their company (their inventory, planning,..) can be done in at least 2 ways: 1. every table that needs RLS gets an extra column companyId and a policy attached that checks if the user jwt claim companyId matches the correcponding row's companyId 2. using extra join queries to retreive the corresponding companyId for every row + policy that checks other 3. other What would you recommend/ pros and cons assuming that the company id of a table row never changes (so normalization is less of a concern, performance gain of 1 wins?)
    l
    g
    • 3
    • 2
1...104105106...230Latest