https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Appending to a supabase array via python
    u

    ui

    02/04/2023, 10:00 PM
    Hello i'm wondering how i could possibly append to a supabase db array using python?
    g
    • 2
    • 1
  • env variables in config.toml
    j

    jdgamble555

    02/04/2023, 10:21 PM
    What is the preferred way to hide your login information in config.toml? Should I gitignore this file altogether? There seems like there should be a way to add .env variables in it? What is the "supabase" way of doing this? I specifically need to put in my login with
    auth.provider.google.enable
    J
    s
    • 2
    • 6
  • save/lock sort rule in dashboard?!
    d

    Domcario

    02/04/2023, 10:32 PM
    how can i save the row sort so i don't have to keep doing it for each of my tables?
    o
    • 2
    • 1
  • RLS question
    d

    DisamDev

    02/04/2023, 10:57 PM
    I have this policies in my table with RLS. I'm new with SQL/RLS. The table is secure with this policies? Can no one enter with the API Key without be authenticated?
    g
    • 2
    • 1
  • Using Postgres extensions in client calls
    e

    elliott

    02/05/2023, 12:15 AM
    Is it possible to use Postgres extensions, PostGIS for example, inside of a client call? Or can extensions only be used on the website?
    g
    • 2
    • 1
  • This is kinda disappointing
    n

    nateland

    02/05/2023, 12:21 AM
    I'm new to Supabase, but so far the experience has been quite shy of horrible. I keep getting messages like this - things fail without reason. How can I get better at this?
    g
    • 2
    • 67
  • Supabase CLI pull storage bucket and policies from remote DB
    i

    Isological

    02/05/2023, 4:22 AM
    Is there anyway to pull storage buckets and its policies from remote DB to the local schema when creating migrations? The migration script does not have any lines for storage
    s
    l
    • 3
    • 2
  • Relationships between data tables
    h

    hirsh

    02/05/2023, 5:54 AM
    If I have one table that has key, and another that is a key-> value mapping, is it possible to join them so that the first table adds in a newe column with the values? (IK it is possible using the sql section, but curious if there is anyway to save those results in the actual database itself, so that value data is accessible when fetching data from the table).
    t
    i
    • 3
    • 6
  • Database taking very long time to restart
    g

    Glop

    02/05/2023, 6:43 AM
    I restarted my db, usually takes like 30 seconds. Its been 10 minutes now and still restarting
    o
    • 2
    • 1
  • Using Supabase Browser Client inside of RTK Query Endpoint
    g

    gleb

    02/05/2023, 9:12 AM
    Hey there, Trying to build an app with Next.js, RTK Query, and Supabase. I followed NextJS docs and wrapped my app with `SessionContextProvider`:
    Copy code
    tsx
    const [supabase] = useState(() => createBrowserSupabaseClient<Database>())
    
      return (
        <SessionContextProvider supabaseClient={supabase} initialSession={pageProps.initialSession}>
          <Provider store={store}>
            <Layout>
              <Component {...pageProps} />
            </Layout>
          </Provider>
        </SessionContextProvider>
      )
    But now I wonder how to access
    supabaseClient
    from the RTK Query endpoint. The problem is that RTKQ caches all queries in redux store, so they have to be serializable, therefore I can't pass client as query argument. I cannot use
    useSupabaseClient
    directly in the RK Query code either either because it's a react hook. I want my queries to look something like this:
    Copy code
    ts
    export const myApi = api.injectEndpoints({
      endpoints: (build) => ({
        getData: build.query<Result[], void>({
          queryFn: async (arg, queryApi, extraOptions, baseQuery) => {
            const supabase = ?????
            const {error, data} = await supabase
              .from("my_table")
              .select("*");
    
            if (error) {
              return {error};
            }
            return {data};
          }
        }),
      })
    });
    s
    d
    d
    • 4
    • 19
  • What should I write on definition of database function ?
    y

    YokoWasis

    02/05/2023, 9:24 AM
    it result null
    g
    • 2
    • 3
  • RLS policy question
    d

    DisamDev

    02/05/2023, 9:56 AM
    I have a policy named "The users can see their own keys." (in the photo) so I put delete for the policy, I want that a user only can delete in this case their own keys (in the table keys) and I have a column in the table named
    userId (type: uuid)
    so I put
    auth.uid() = userId
    but Supabase says to me that
    userId
    doesn't exists.
    g
    • 2
    • 2
  • No data returned, how come?
    g

    GKL

    02/05/2023, 12:41 PM
    Hi there, I'm trying to return data using Supabase and it works fine for my "clients" table but for my "beats" folder, nothing gets returned, and im not sure why. here is the code for my "clients" table getting returned
    Copy code
    js
      const fetchClients = async () => {
        try {
          setLoading(true)
          let { data: clients, error } = await supabase
            .from('clients')
            .select()
    
          if (clients) {
            setClients(clients)
          }
        } catch (error) {
          console.log(error)
        } finally {
          setLoading(false)
        }
      }
    and this is the code for my beats:
    Copy code
    js
      const fetchBeats = async () => {
        try {
          setLoading(true)
          let { data: beats, error } = await supabase
            .from('beats')
            .select()
    
          if (beats) {
            setBeats(beats)
          }
        } catch (error) {
          console.log(error)
        } finally {
          setLoading(false)
        }
      }
    this is my beats table to show theres data in it (see the photo). whenever i do
    console.log(beats)
    it just shows an empty array
    o
    g
    • 3
    • 10
  • blocked by CORS policy when i try to edit my table column name
    p

    Poypoypoy

    02/05/2023, 1:49 PM
    as been blocked by CORS policy: Method PATCH is not allowed by Access-Control-Allow-Methods in preflight response.
    g
    • 2
    • 1
  • Supabase Project makes website download document on refresh
    n

    nelakay

    02/05/2023, 3:33 PM
    Hopefully I am in the right channel. I am working on a project with Next.js 13 and Supabase. It's an mvp, so for now, I invite members to join in the Supabase backend, and once they accept the invitation I upload their data in the profiles table, which is tied to the users table through Supabase's User Management Starter. The issue is, that now when people land on the page where all the users are displayed, a document is downloaded (I mean an actual document, with "where do you want to save this" type download). It is not an incredibly consistent bug, but I shows up often enough to consider it odd behavior. First I through something was wrong with my fetching code, but after recreating a different project with the same process in Supabase (inviting users, installing the User Management Starter SQL snippet, and filling in the data manually in the profiles table), the new project does not behave like this. - The live website where this error can be observed is here: https://conversly.co/hosts (If the document doesn't download right away, it most likely will on refresh) - The replica with a different database project where the error does not happen is here: https://testfetchdata-uier-dbgzsc1zc-nelakay.vercel.app/hosts (I tried the original database in the replica, and it started downloading documents again) Any ideas a to what could be happening?
  • how to insert data into a row's textArray column using javascript
    h

    hirsh

    02/05/2023, 4:43 PM
    I am trying to write a javascript script that, when a button is clicked onsite, adds an input field's value to a textArray. Trying to find documentation on how to do this!
    g
    a
    • 3
    • 33
  • after update data and return 204, but NOUPDATE table on supabase
    u

    최지연

    02/05/2023, 4:48 PM
    hi, i'm in testing.. i just update simple text.. and got 204 but I can't find anydata.. The same resultof dynamic values!! PLZ help me 😭 here's my code
    g
    • 2
    • 3
  • Does realtime work in local dev?
    c

    corasan

    02/05/2023, 4:49 PM
    I remember realtime working before v2 of Supabase, but doesn't seem to be working anymore.
    j
    s
    +2
    • 5
    • 27
  • Incrementing a column total_times by one.
    p

    pele'sghost

    02/05/2023, 6:06 PM
    This is my postgres function:
    Copy code
    declare 
      new_times int;
    begin
    select total_times
    into new_times
    from public.place_eaten
    where place_id = place_id;
    new_times = new_times + 1;
    update public.place_eaten
    set total_times = new_times
    where place_id = place_id;
    return new_times;
    end
    This is where I am calling it in the client:
    Copy code
    const addOne = async () => {
        let { data, error } = await supabase.rpc('timesEaten', {place_id: choice.place_id})
        setEatenPlusOne(data)
        if (error) console.error(error)
        else console.log(data)
      }
    After watching the increment video's on youtube, I am suspecting it might be the second where statement because it is adding one to the entire column for all the rows. Can anyone guide me in the right direction?
    g
    • 2
    • 8
  • How to invalidate logins?
    j

    jules

    02/05/2023, 6:21 PM
    For my project, im using the sveltekit auth helpers. When a user logs in to their account, they will remain logged in when they visit the page again. This behaviour is intended, however id like the ability to remove all or specific login states, in case a bad actor accessed someone's account.
    s
    • 2
    • 1
  • Auth, phone sign up - No way to check if user was already authenticated?
    k

    kevlust

    02/05/2023, 6:28 PM
    Hi! I'm using Supabase's phone auth in my project. Currently, I'm testing an edge case where a user (who was already authenticated) tries to sign up with their same phone again. I can't figure out how to check whether the user has been confirmed already. The docs seem to make it work for email, but don't really specify anything for phone auth. In both cases (new and already-confirmed user), I get the same response. Can someone please help me? Thanks! Documentation I referenced above: https://supabase.com/docs/reference/javascript/auth-signup
    o
    y
    h
    • 4
    • 29
  • Google Auth Redirects to Localhost3000 on Production
    s

    Shelby

    02/05/2023, 6:56 PM
    My nextjs v13 which uses supabase v2 project has setup google login for my users but when I deployed it using vercel to production it stil redirects to localhost after logging in? I checked if theres any wrong redirects but there isn't.
    u
    g
    +3
    • 6
    • 13
  • Search through Table and match the closest one to the value (value is a string)
    u

    .Volxen

    02/05/2023, 8:50 PM
    I need a way to search through a table lets say users table with each one of them having a username, I want to search through the usernames and make it give the usernames with the closest match to the value given.
    g
    • 2
    • 3
  • AUTH supabase.auth.admin.generateLink 502 error
    u

    0xSnakeDg.eth

    02/05/2023, 9:34 PM
    During Auth process, I request the "supabase.auth.admin.generateLink" with type of 'magicLnk', but it response 502 ERROR. It only happen on Staging env, it is all good on PROD. from Supabase log it doesnt include too much information. Has someone encounter this trouble? Thanks
  • Golang: Permission Denied for schema 'xxxx'
    a

    adoublef

    02/06/2023, 12:11 AM
    I'm currently working on integrating supabase into a project and seem to have hit an issue which I can't find any other instance for. I'm using the
    pgx
    library to connect and while I am able to connect and
    insert/select
    from a table on the
    public
    schema when I try to make my own schema and perform the same actions I get a permission denied error. Currently unsure if it's an issue with Supabase or the client library so trying my luck with both.
    g
    s
    • 3
    • 7
  • Is there a benefit to Prisma if I am already using Supa API for auth?
    c

    Cory

    02/06/2023, 12:24 AM
    I am currently just using the auth API and data API to access and change data, but I would much prefer to design and manage my schema via Prisma syntax. Is it possible to just use Prisma for syntax? How does Prisma interact with RLS?
    t
    y
    • 3
    • 9
  • Batch loading and Server Side Functions
    m

    malachi

    02/06/2023, 12:26 AM
    Say I have a database where each row is a "post" and each post has some "relevancy score" attached to it. Each relevancy score is a function of certain post attributes (number of likes, comments, etc.). How would I be able to a) Create a system that allows me to batch load these posts to the application feed in order from greatest to least relevancy scores. and b) Is it possible to update this relevancy score server side? E.g., if a certain column changes (+1 new like, +2 new comments), recalculate the relevancy score column.
    g
    • 2
    • 3
  • How do I get count of rows in supabase python?
    m

    mohnish

    02/06/2023, 1:19 AM
    Hello, I see that in the Javascript library, there is a way to get count of the number of rows in a table, but I was wondering if there's a way to do the same in Python? Here is the link to the stackoverflow question detailing the method for Javascript library: https://stackoverflow.com/questions/65612167/how-to-get-count-in-supabase
    • 1
    • 2
  • How can I create a Magic Link form that looks like the Auth UI image in the description?
    z

    zhay

    02/06/2023, 1:47 AM
    https://supabase.com/auth
    • 1
    • 1
  • RLS auth helper function
    j

    jinsley8

    02/06/2023, 8:50 AM
    Any RLS pros here? I have a custom auth schema setup with next-auth and a custom helper function to use in RLS policies. This matches the user id from JWT (sub = user.id) to the uid of other tables to check if user is the creator of the row.
    Copy code
    sql
    --- uid() function to be used in RLS policies
    CREATE FUNCTION next_auth.uid() RETURNS uuid
        LANGUAGE sql STABLE
        AS $$
      select
        coalesce(
            nullif(current_setting('request.jwt.claim.sub', true), ''),
            (nullif(current_setting('request.jwt.claims', true), '')::jsonb ->> 'sub')
        )::uuid
    $$;
    Shown here: https://next-auth.js.org/adapters/supabase#create-the-next_auth-schema-in-supabase My JWT payload looks like this:
    Copy code
    js
    const payload = {
        sub: user.id,
        user: payloadUser,
        aud: 'authenticated',
        role: 'authenticated'
    };
    I need a new helper function that instead of using "sub", it uses
    user
    which is an object to access
    user.address
    (text id string). I tried this but doesn't seem to work. on
    Copy code
    sql
    --- uid() function to be used in RLS policies
    CREATE FUNCTION next_auth.eth() RETURNS text
        LANGUAGE sql STABLE
        AS $$
      select
        coalesce(
            nullif(current_setting('request.jwt.claim.user.address', true), ''),
            (nullif(current_setting('request.jwt.claims', true), '')::jsonb ->> 'user.address')
        )::text
    $$;
    Now I try to use
    (eth() = owner_of)
    in a RLS policy and it shows
    Error updating policy: failed to update pg.policies with the given ID: function eth() does not exist
    • 1
    • 1
1...120121122...230Latest