https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Storage Egress
    m

    Mihai Andrei

    01/03/2023, 4:41 PM
    Hello! Does the storage Egress reset every month? Or is it a permanent thing
  • Fuzzy search across multiple columns
    c

    chinds

    01/03/2023, 6:02 PM
    I need fuzzy search like functionality across multiple columns in a table. i.e. search for name or email where the search term
    chris
    would search for a first or last name that contains
    chris
    i.e ['chris', 'christine', 'christopher'] etc but also search the email column returning i.e. with an email of
    foo@chris.com
    I am seen some chatter of using postgres functions for doing this but have never actually seen an example of it working.
    g
    u
    • 3
    • 5
  • trigger in migration not appearing when running 'supabase db reset'
    d

    dont

    01/03/2023, 6:24 PM
    Hi I have a trigger, here:
    Copy code
    create trigger on_auth_user_created
      after insert on auth.users
      for each row execute procedure public.create_profile_for_new_user();
    for creating a profile row when a user is created. The above snippet is copied from the migration after creating it via the supabase studio thing. This trigger does not appear when resetting my db or deploying to staging. How should i get this trigger automatically in my different environments?
    g
    • 2
    • 3
  • Is is possible to have multiple authentication methods?
    n

    neil

    01/03/2023, 6:32 PM
    Would love to enable each user to log in with email and SMS if possible. Even if it requires a hack would love to be able to do this.
  • Constant Outages
    p

    patrick

    01/03/2023, 7:34 PM
    Hi, I'm getting constant outages with my new app – not sure the right channel to discuss this but the server is frequently returning
    BLOCKED
    for our auth calls, and thus not handling our use case well
    g
    • 2
    • 17
  • RLS policy editing for non-public schemas?
    r

    reno

    01/03/2023, 9:42 PM
    Can you use the policy editor (https://app.supabase.com/project/xxx/auth/policies) to edit RLS policies for schemas other than
    public
    ? There doesn't seem to be way to change the schema. I know I can create them with PSQL statements, but it would be handy to have them viewable and editable in the UI.
    g
    • 2
    • 2
  • Conditional createClient
    e

    emre_

    01/03/2023, 10:09 PM
    I want to initilaize my supabase as following but it doesn't work. How can I conditionally createClient? `export const supabase = async () => { const { access_token } = await getTokensFromStorage(); if (!access_token) { return createClient(SUPABASE_URL, SUPABASE_ANON_KEY); } else { const options = { global: { headers: { Authorization:
    Bearer ${access_token}
    , }, }, }; return createClient(SUPABASE_URL, SUPABASE_ANON_KEY, options); } };` This code is returns errors like:
    Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'getUser')
    g
    • 2
    • 17
  • Dashboard back to beginning
    a

    Axel

    01/04/2023, 4:12 AM
    Hi guys, I have been using the same database for almost a year and had everything working correctly until yesterday, the dashboard seems to be back to the welcome page and I have no idea why. The database and edge functions seems to be working fine, I'm assuming this is only UI/editor problem. Weirdly, this problem only occurs on this database, my other database is working just fine. May i get help from the team? Supabase ID
    xbrgrzbpugippzsbortq
    g
    • 2
    • 4
  • how to avoid the data in a public table from being dumped all at once using a select * query
    d

    Deng

    01/04/2023, 5:18 AM
    I was wondering if there is a way to avoid the data in a public table from being dumped all at once using a select * query. For example, in the case of a profiles table, it would be preferable to prevent someone from being able to retrieve all of the data in the table with a single query, even though the data is public. Is there a way to do this in Supabase?
    u
    g
    • 3
    • 6
  • update or delete on table case_category violates foreign key constraint cases_category_fkey on t
    m

    Maomao

    01/04/2023, 7:10 AM
    +page.server.js
    Copy code
    delete_category: async (event) => {
            const { supabaseClient } = await getSupabase(event)
            
    
            const formData = await event.request.formData()
            const categoryId = formData.get('id')
            
            const { error } = await supabaseClient
            .from('case_category')
            .delete()
            .eq('id', categoryId)
            
            if (error) {
                return invalid(500, {
                    error: 'Server error. Try again later'
                })
            }
            
            return {
                success: true
            }
        },
    +page.svelte
    Copy code
    const deleteCategory = async (categoryId) => {
            deleteCategoryLoading = true
            const data = new FormData()
            data.append('id', categoryId)
            const response = await fetch('/call-centre/settings?/delete_category', {
                method: 'post',
                body: data
            })
            const result = await response.json()
            deleteCategoryLoading = false
            if (result.type === 'invalid') {
                displayAlert(result.data?.error, 'error')
            } else {
                await invalidate('supabase:auth')
                await applyAction(result)
            }
        }
    
    <button on:click={() => deleteCategory(category.id)}>
        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="text-success hover:text-success-content rounded-full w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" />
        </svg>
    </button>
    m
    g
    • 3
    • 11
  • Endpoint for Graphql
    d

    Devr

    01/04/2023, 10:01 AM
    Hey there! I just want know that what api url is used for graphql for my supabase project ? If I use https://.supabase.com/graphql/v1 it shows null data.., is anythinng wrong in that?, thanks!
    w
    • 2
    • 1
  • CLI diff connection failed
    ł

    ŁukaszW.

    01/04/2023, 10:44 AM
    After updating the CLI i Have a problem with diff script.
    Copy code
    hostname resolving error
    lookup supabase_db_xxx no such host
    s
    q
    • 3
    • 9
  • How to create table containing some columns of type object and others array
    k

    KennStack01

    01/04/2023, 10:47 AM
    Sorry to bother you, guys. I'm new to Supabase (been using NoSQL), please help me out. I want to save these data in a single table called "sites", some columns are of type object, others array. Could you please help me out with some insights? Thanks 🙏
    s
    u
    • 3
    • 12
  • Rls policy error
    u

    !Daniel

    01/04/2023, 10:54 AM
    I have a table with user_id and i want users to be able to insert or update values to that table, if user_id corresponds to their id, or the user_id is null. I have this "((uid() = user_id) OR ((user_id)::text = 'null'::text))" but idk what is not working. Can anyone help me? 🙂
    u
    • 2
    • 21
  • Admin Panel Access
    u

    𝖘𝖚𝖗𝖌𝖎𝖊𝖇𝖔𝖎 | Drooler

    01/04/2023, 11:25 AM
    Has anyone else experienced issues in accessing the admin panel over the last 48 hours? I experienced connection issues yesterday, and again today (ie. something went wrong screen) 😢 On a random refresh, after ~5-10 minutes, the admin panel re-appears with a loading screen. The loading screen takes longer than usual, after the issue, but it does load.
    s
    • 2
    • 5
  • Supabase Facebook Auth returning error in the URL
    k

    KennStack01

    01/04/2023, 12:47 PM
    All is working fine now, except the Facebook Auth method (returning an error: "error=server_error&errordescription=Error+getting+user+email+from+external+provider#=_")... Whereas I've already enabled the Facebook Provider... Any help?
  • How to use pg_crdt with y.js in the frontend for realtime collaboration
    j

    Julian Derungs

    01/04/2023, 12:59 PM
    Hey community! I want to make use of
    pg_crdt
    combined with
    y.js
    in the frontend. As
    y.js
    uses providers to sync data back to a server (e.g.
    y-websocket
    ) I'm not sure how to make this work. Do I need to write a custom provider or am I able to just point to the supabase instance when using
    y-websocket
    to persist my ydoc? I am using
    tiptap
    editor in the frontend. Any hint appreciated 🙂
    m
    • 2
    • 1
  • Connect with supabase wordpress
    j

    Jodrigabber

    01/04/2023, 1:05 PM
    Hello, Is it possible to connect inside a wordpress envoirment and connecting with a plugin? What would be the best way to make the connection to the api?
    t
    • 2
    • 2
  • What is the best way to track history of a table?
    r

    rjdavis

    01/04/2023, 2:07 PM
    Is there a supabase supported postgres extension that can handle setup of a history table for a given set of tables? I will have some inventory, product, and order tables what I will want to track histories for and store for varying amounts of time. Ideally we would have a snapshot of the row before it was changed after along with a link back to the user that made the change. I found this article from PostGIS which seems like it could work: https://postgis.net/workshops/postgis-intro/history_tracking.html Can anyone suggest another way or give some insight on how their implementation of a history table with PostGis went?
    g
    • 2
    • 1
  • Distinguish between wrong password and non existent user?
    f

    Fabrizio

    01/04/2023, 2:32 PM
    I am coding a simple login system, and I noticed that I get the same error (AuthException(invalid Login Credentials) both when the user inserts the wrong password and when the user tries to log-in with a non existent email. I was wondering, is it possible to distinguish between these situations, for example by checking wether an email has an associated account to it?
    g
    • 2
    • 7
  • Backend server processing before saving to DB
    k

    Karan

    01/04/2023, 2:43 PM
    I am new to Supabase so trying to understand best practices. For updating data from client (web & mobile), I'd like to do validation and sanitization such as phone number is in right format, maybe some resource exists before we can write. Typically this would be done on the backend system. How do we solve for this, call edge function (typically a different url), then the edge function can use the supabase clientJS package to call the rest API?
    g
    u
    l
    • 4
    • 10
  • I am trying to do 2 inserts in a function run via a trigger
    d

    dont

    01/04/2023, 3:17 PM
    the second insert needs to use the id from the first. I have the following but it does not work, any ideas?
    Copy code
    begin
    with team_insert as (
       insert into public.teams(name, created_by) 
       values(new.first_name, new.user_id) 
       RETURNING id
    )
    insert into public.team_members (team_id, user_id)
    values((select id from team_insert), new.user_id);
    end;
    g
    • 2
    • 21
  • Show Types
    r

    robkuz

    01/04/2023, 3:45 PM
    Hi, is there a way to show the defined Types on a DB? for example
    CREATE TYPE gender AS ENUM ('M', 'F', 'D');
    g
    • 2
    • 3
  • How to handle backend validation for more complex fields (i.e. emails, urls, enums, etc)
    n

    nnet3

    01/04/2023, 4:41 PM
    I want users to be able to enter in their website, email and use a multi select tool that relates to an enum on the BE. I want to validate those fields before inserting into the DB. Is there an efficient way which preferably uses a 3rd party library. I prefer to use a library > regex to prevent rejecting valid fields. What implementations have you used? What do you recommend? Thanks
    z
    m
    +3
    • 6
    • 13
  • SQL Injection potential in functions?
    n

    nnet3

    01/04/2023, 4:48 PM
    If I create a function that inserts into a table called company upon sign up and inserts a company name that is a string. Does that not make me vulnerable to sql injection? Example: INSERT INTO public.company (name) VALUES (new.raw_user_meta_data->>'company_name') RETURNING id INTO company_id; In this case, if the user just sends a request and specifies the company_name to be some SQL command, could this be a SQL injection vulnerability? If for some reason there is an exception to this due to the way auth works, what if there was another function created that just inserts into the DB using a field a user entered on a form. This would almost certainty contain SQL Injection vulnerabilities? Would this function also require parameterization and prepared statements? Thanks.
    g
    • 2
    • 2
  • CLI Auth container migrations fails
    ł

    ŁukaszW.

    01/04/2023, 5:44 PM
    Migration
    Copy code
    20221114143410_remove_parent_foreign_key_refresh_tokens.up.sql, sql: alter table only auth.refresh_tokens\n  drop constraint refresh_tokens_parent_fkey;\n: ERROR: constraint \"refresh_tokens_parent_fkey\" of relation \"refresh_tokens\" does not exist (SQLSTATE 42704)","time":"2023-01-04T17:31:18Z"}
    Has some errors in my case on the latest version of CLI , so the auth container is not starting
    e
    • 2
    • 3
  • Extract data from Airtable to Supabase table
    o

    organicnz

    01/04/2023, 5:47 PM
    Hi folks, Is there an optimal way to get data from Airtable to Supabase table? I would like to retrieve street fridge data from LA Community hosted on Airtable, as this is already implemented via Rowy in Firestore 🙂 Thank you 🙂
  • About Auth
    m

    Matheus (M1)

    01/04/2023, 6:21 PM
    Hi everyone! I'm seeking for a OAuth Provider, to authenticate my microsservices in a centralized way and a came across Supabase. So I'd like to know if supabase is for me. Just to be clear, my microsservoes doesn't use supabase, and not only typescript, they have its own data sourcers and is written and different languages. The main question is: Does Supabase Auth works similarlly to providers like keycloak and Auth0?
    k
    • 2
    • 1
  • Using storage.local instead of localStorage in createClient()
    e

    emre_

    01/04/2023, 7:37 PM
    I looked everywhere but there is no information about this. We can use either localStorage or asyncStorage(Native) to store session information but is there any chance to use chrome.storage.local for session storing. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/local This is a extension level storage which persists across different domains. So I can actually keep people signed in every tab.
    h
    • 2
    • 4
  • How to link 2 tables using a FK table with supabase-js syntax?
    m

    miky2fois

    01/04/2023, 7:50 PM
    I have 3 tables
    Copy code
    food
    - id
    - name
    
    food_meal_type (FK table)
    - id
    - mealTypeId
    - foodId
    
    meal_type
    - id
    - name
    - value
    - enabled
    in SQL I would do something similar to:
    Copy code
    select * from food
    inner join food_meal_type on food.id = food_meal_type."foodId"
    inner join meal_type on food_meal_type."mealTypeId" = meal_type.id;
    I tried multiple ways including the below, but I haven't found a way to achieve it
    Copy code
    const { data, error } = await supabase
        .from("food")
        .select(
          `
          id,
          name,
          mealTypes: food_meal_type(
            *,
            meal_type!mealTypeId(*)
          )
        `
        )
    The ideal result would be:
    Copy code
    {
      "id": "99fc8f86-36f3-4146-b8f2-78f0f8797f95",
      "name": "Pesto fish fingers with broccoli mash",
      "mealTypes": [
        {
          "id": "a27b61c0-0367-418a-bd85-6c0b0640b89e",
          "mealTypeId": 4,
          "foodId": "99fc8f86-36f3-4146-b8f2-78f0f8797f95",
          // the fields below come from the meal_type table
          "name": "lunch",
          "value": "LUNCH"
        }
      ]
    }
    How can I do the same using the supabase-js syntax? Thank you.
    g
    • 2
    • 21
1...878889...230Latest