https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • It is possible to require both phone number and email address when signing up?
    y

    Yumi

    05/26/2023, 7:58 AM
    I am using Twilio's phone number verification currently, and I want to make sure that the user has their email address also verified (or at least associated to their user in the user db). Is it possible to make them both a requirement using something like RLS?
    g
    • 2
    • 1
  • Edge function documentation
    t

    TheRien

    05/26/2023, 8:19 AM
    I've been adding some edge functions lately and love the experience so far. What I'm missing though is some documentation in the Studio. All I can find is a list of function names and URLs. Is there any way of getting more docs? I want our frontend-team to know which functions we have and how to use them. So they need to know what parameters they have and what it returns etc.
  • Auth not working after trying to upgrade to app-folder
    v

    Vimes

    05/26/2023, 9:21 AM
    Now that the app folder is stable I want to play with the new toys I upgraded supabase and next, and created a new login page straight from the supabase docs to get login working. But whenever I try to log inn I get an error stating "400 bad request". I've added the middleware.js file recommended in the docs, but it shouldn't matter in client components. Any ideas what I'm doing wrong? can provide any other code too. This runs in the app-folder https://pastebin.com/VMuM9001 I guess I don't have an auth provider file in my app folder, does the middleware file do this for you? 🤔 Found no auth providers in https://supabase.com/docs/guides/auth/auth-helpers/nextjs
    s
    • 2
    • 23
  • Updating @supabase/auth-helpers-nextjs from 0.6.1 to 0.7.0 breaks SAML Auth
    r

    Razoth

    05/26/2023, 10:00 AM
    i still use the pages directory but i tried it with the app directory too (everything like it's on the docs) if i use the new "createPagesBrowserClient" on the pages directory version of the app i get some SameSite Policy warning about the refresh and token cookie. if i try to login the application logs into MS active directory, i get back to localhost with the token in the url and its valid. the client doesn't seem to be able set the auth cookie, nor changes the state. i tripple checked all callback url's, its all fine if i reverse to 0.6.1. i don't know what kind of information you need, since i don't get an error on either the client nor server side. it just doesn't login.
    s
    • 2
    • 32
  • Supabase - Make.com/Zapier integration
    w

    wonsky

    05/26/2023, 10:35 AM
    Hello, I would like to ask if there is any way to connect Supabase with automation tools like Make.com or Zapier. I use a Supabase as a DB for my project in Flutterflow. Integration with Make could open a whole new world of ideas :)) Especially when it can be daone on a no-code level. I have found that there are Supabase integrations in n8n but Make seems more widely used and more powerful. Does anyone knows something about it?

    https://cdn.discordapp.com/attachments/1111603430591582239/1111603430994219008/image.png▾

    g
    k
    • 3
    • 7
  • I'm having hard time allowing INSERT & UPDATE with RLS
    d

    Daniel Klein

    05/26/2023, 12:54 PM
    Hi, I'm new to supabase and I'm having a tough time with RLS on storage I have one Bucket called 'hub' set as public with one root folder 'avatars' which has two folders inside it 'general' & 'users' I'm using 'users' folder to store uploaded profile pictures by users. Where name of folder is their authId from supabase. Yesterday It was working just fine but today I added 'upsert': true option to upload function provided from useSupabaseClient.storage and now it just keeps throwing RLS errors. Also I feel like there is not enough resources regarding RLS for storage. There is a few in docs but it doesn't really help. I was also checking out video on youtube published by Supabase but what surprised me is when I tried to create RLS according to video it just keeps throwing weird error. I would add some screenshots of RLS but I've just tried so many times that it wouldn't even help. It would be really great if someone who's experienced could explain to some basics. fe. why exactly am I getting and error on storage.objects when I have declared RLS on the bucket itself and why when I add Insert and update rls directly to storage.objects instead of bucket with just true values I still get errors regarding RLS Thanks in advance.
    g
    • 2
    • 23
  • HELP needed - Edge function crashes - auth-helper library can not define res.headers.set()
    e

    Elofin

    05/26/2023, 12:54 PM
    I see the following error log in my NextJS server logs a lot and randomly, it blocks me from launching my project, so I need emergency help 🥲 [TypeError: Cannot read properties of undefined (reading 'set')] It is about createMiddlewareSupabaseClient in @supabase/auth-helpers-nextjs/dist/index.js setCookie(name, value, options2) { const newSessionStr = (0, import_auth_helpers_shared.serializeCookie)(name, value, { ...options2, httpOnly: false }); context.req.headers.append("cookie", newSessionStr); context.res.headers.set("set-cookie", newSessionStr); } There is also reported open issue: https://github.com/supabase/auth-helpers/issues/523
  • Logged in user not access to RLS with authenticated
    v

    viktor

    05/26/2023, 1:12 PM
    So I want to let all logged users insert into myTable, I would think the following would work, but I get RLS error.
    Copy code
    CREATE POLICY "logged in users can insert into myTable"
        ON public.myTable FOR INSERT to authenticated
        with check (
          true
        );
    Error new row violates row-level security policy for table "myTable Postgres Username authenticator Also is there an easy overview of all the different roles/ postgres usernames used, when they are used and for what? I fail too find one, would be nice with a cheatsheet.
    g
    • 2
    • 22
  • scope
    p

    probo

    05/26/2023, 1:20 PM
    I can't get user data like email, username etc when skipbrowserredirect is set to true, not only that, how to properly get data? I am using javascript only
  • How to get user data like email, username etc using google provider and javascript?
    p

    probo

    05/26/2023, 1:26 PM
    Also what about new identity based auth?
    g
    • 2
    • 41
  • typescript is not assignable to type even though data matches type
    v

    Vimes

    05/26/2023, 1:41 PM
    This may not be strictly supabase related. Trying to learn TS and use the supabase TS defintions. Things seem to work untill I want to actually use a component that uses the supabase types. I get an error stating
    Copy code
    Type '{ [x: string]: any; }[]' is not assignable to type '{ contact_point: string....
    I'm wondering how I can use these magical supabase types without TS saying "no sir"
    Copy code
    js
    
    type TaasTypes = Database["public"]["Tables"]["taas"]["Row"];
    
    function TaaS({ tasks }: { tasks: TaasTypes[] }) { <- no error here
        return (
            <>
                {tasks.map((task) => (
                    <div key={task.id}>
                        <h3>{task.task}</h3>
                        <p>{task.description}</p>
                        <p>Kontaktpunkt: {task.contact_point}</p>
                    </div>
                ))}
            </>
        );
    }
    
    const Kundeportal = async () => {
        // Start supabase server client
        const supabase = serverClient();
    
        
        // Henter TaaS timer profilen kan se
        const { data: taas, error: taasError } = await supabase
            .from("taas")
            .select(`*`);
      
        return (<>
          {taas ? <TaaS tasks={taas} /> : <p>Ingen TaaS-timer tilgjengelig</p>} <- ERORR is here
        </>)
    }
    Tried something like this
    Copy code
    js
    const { data: taas , error: taasError } = await supabase
            .from<TaasTypes>("taas")
            .select(`*`);
    adding <> behind types gives error
    Copy code
    No overload expects 1 type arguments, but overloads do exist that expect either 0 or 2 type arguments.ts(2743)
  • Supabase import error
    i

    imp

    05/26/2023, 1:52 PM
    Hey people. I'm getting this error and unsure of how to proceed->
    Copy code
    from supabase import create_client, Client
    ModuleNotFoundError: No module named 'supabase'
    Basically trying to import the supabase python library (I've tried
    Copy code
    pip install supabase
    and
    Copy code
    pip install supabase-client`
    already), but I keep getting this error. Does anyone have any suggestions or ideas on what could be wrong?
  • Cannot find module '@supabase/auth-helpers-react' or its corresponding type declarations.
    p

    PorkchopPanties

    05/26/2023, 1:59 PM
    Hi, evryone. I am trying to get the Next.js Subscription Payments Starter running locally, and I am receiving this error in _app.tsx. I have installed and reinstalled the auth helper - no joy. Thanks in advance!
  • Upserting increased DB size
    m

    MartiN

    05/26/2023, 2:24 PM
    I use python's supabase client. I have a jsonb column where I inserted a wrong json. I selected 'id, jsonb_column', modified the json to make it 10 times smaller, and upserted the new json. With the old json the DB size was 380 MB. With the new one which is smaller it rose up to 442 MB. And as a json file, the json is only 15 MB. Basically, reducing the data size, increased the DB size.
    v
    • 2
    • 1
  • Custom SMTP not working for user auth emails
    m

    mvmt

    05/26/2023, 2:30 PM
    Our app is currently experiencing very high signup volume and our users are getting errors when trying to sign up due to the email confirmation rate limits by Supabase (100/hr for pro plans). We're trying to switch to custom SMTP for this, I've made a Mailgun account and added my SMTP information to the auth settings and it isn't working. When trying to sign up on our app, we get this error message: 'code":500,"msg":"Error sending confirmation mail' Any ideas of what we could be doing wrong? All of the SMTP information entered is correct so I'm not sure why it wouldn't be processing the emails properly. This is severely limiting our users since only 100 per hour can sign up.
    g
    • 2
    • 1
  • Import CSV data directly from Google Cloud Storage into a Supabase database
    r

    Richfella

    05/26/2023, 3:17 PM
    Can one import a csv file from Google Cloud directly into a Supabase database table. The file is 181 GB in size so I don't want to download it first.
  • Javascript library, define colum using ::text etc
    s

    SunTzu

    05/26/2023, 3:17 PM
    In the SQL Editor I can run on a JSONB column
    Copy code
    SELECT * FROM messages m WHERE m.sources::text LIKE '%"document": 25%';
    And works completely fine, I'm trying to replicate this with the js library
    Copy code
    const { data, error } = await supabase
        .from("messages")
        .select(`*`)
        .like("sources", `%"document": ${id}%]`);
    however unsure how I replicate the ``::text`` as like the SQL query
    g
    v
    • 3
    • 11
  • why onAuthStateChange make function loop
    j

    James singh

    05/26/2023, 3:30 PM
    Hello there! Basically, I want to save my login user data to my database, but here's the issue: when I put supabase.auth.onAuthStateChange on my next page/_app.js, it makes it loop and ratelimit my database API.
    Copy code
    js
        supabase.auth.onAuthStateChange(async (event) => {
          if (!event) return;
          if (event === 'SIGNED_IN') {
            console.log('User signed in'); //this span in console multiple times
          } else return
        });
  • Check my function?
    d

    dmayo2

    05/26/2023, 4:56 PM
    table.grammar_count has one row, two columns id (int2 primary) total (int4) table.grammar_stats is getting updated via the JS library v2: id (uuid) char_count (int2) My trigger seems to be firing, but the table.grammar_count is not updating. Any pointers would be appreciated. Thanks.
    Copy code
    CREATE OR REPLACE FUNCTION update_grammar_count()
    RETURNS TRIGGER AS $$
    BEGIN
      UPDATE grammar_count
      SET total = total + NEW.char_count
      WHERE id = 1;
    
      INSERT INTO custom_logs (message)
      VALUES('Trigger update_grammar_count fired');
    
      RETURN NEW;
    END;
    $$ LANGUAGE plpgsql;
    
    DROP TRIGGER IF EXISTS grammar_count_insert_trigger ON grammar_stats;
    
    CREATE TRIGGER grammar_count_insert_trigger
    AFTER INSERT ON grammar_stats
    FOR EACH ROW
    EXECUTE FUNCTION update_grammar_count();
  • Integrating PostGIS to an existing database.
    b

    blakecross

    05/26/2023, 5:33 PM
    Hey everyone, New to Supabase here but I assume this is pretty straightforward. I have a database that already has a latitude and longitude column and I want to be able to sort them by location. I already have PostGIS enabled, so is there an SQL command I can run to copy the data from these two columns and add them to a new location column?
    v
    g
    • 3
    • 4
  • Can't delete with new column in auth.users
    x

    xdcx18

    05/26/2023, 5:39 PM
    So I am trying to add a groupId to the auth.users table that I am going to use directly with the RLS. Initially this groupId is the same as the Id in auth.users. The default value is null. I have created the following function and trigger to set the groupId to be the Id when an insert happens on auth.users. To test this I was trying to delete a user and sign up with the same user to make sure it is working. However when I go the authentication tab and try to delete that user It says "Failed to delete user: property groupId should not exist". Should I have tried removing all users before implementing the function and trigger?? is there a better way to go about this?? *sql code was generated by the supabase AI
    Copy code
    sql
    
    -- Drop the function if it exists
    DROP FUNCTION IF EXISTS public.initialize_group();
    
    -- Drop the trigger if it exists
    DROP TRIGGER IF EXISTS initialize_group_trigger ON auth.users;
    
    -- Create the function
    CREATE FUNCTION public.initialize_group()
    RETURNS TRIGGER
    LANGUAGE plpgsql
    SECURITY DEFINER
    AS $$
    BEGIN
      NEW."groupId" := NEW.id;
      RETURN NEW;
    END;
    $$;
    
    -- Create the trigger
    CREATE TRIGGER initialize_group_trigger
    AFTER INSERT ON auth.users
    FOR EACH ROW
    EXECUTE FUNCTION public.initialize_group();

    https://cdn.discordapp.com/attachments/1111710153620852787/1111710154535227534/Screenshot_2023-05-26_at_12.38.27_PM.png▾

    v
    g
    • 3
    • 5
  • Write a plpgsql function to migrate to new schema
    m

    matth

    05/26/2023, 5:49 PM
    This is the first time I'm trying to write a plpgsql function and I'm having some difficulty. I would like to write a function that loops through each row and updates the row depending on specific field value I've attached (2) screenshots of the original table and what the table should look like after running the function. This code is just focusing on 1 record at this point and once I got this working I was going to figure out the loop
    Copy code
    create or replace function migrate_contact_roles() returns setof test_contact_roles as $$
      declare
        d_roles text[] := array[]::text[];
        d_id int;
        d_acct boolean;
        str_acct text = "acct";
      begin
        -- lookup 1 contact
        select 
          id, is_acct into d_id, d_acct
          from test_contact_roles where id = 1;
    
        if (d_acct) then
          d_roles := d_roles || str_acct;
        end if;
        update test_contact_roles set roles = d_roles where id = d_id;
        return query select * from get_contacts()
          where id = 1;
      end;
    $$ language plpgsql;
    When I run the function I'm getting the following error > Failed to run sql query: column "acct" does not exist Any help or suggestions greatly appreciated! Thank you

    https://cdn.discordapp.com/attachments/1111712651182092289/1111712651295326279/Screenshot_2023-05-26_at_12.38.16_PM.png▾

    https://cdn.discordapp.com/attachments/1111712651182092289/1111712651567976549/Screenshot_2023-05-26_at_12.38.51_PM.png▾

    v
    • 2
    • 22
  • Why onAuthStateChange load multiple times still event is not exist?
    j

    James singh

    05/26/2023, 6:42 PM
    Hello there! Basically, I want to save my login user data to my database, but here's the issue: when I put supabase.auth.onAuthStateChange on my next page/_app.js, it makes it loop and ratelimit my database API.
    Copy code
    js
        supabase.auth.onAuthStateChange(async (event) => {
          if (!event) return;
          if (event === 'SIGNED_IN') {
            console.log('User signed in'); //this spam in console multiple times without load page
          } else return
        });
    c
    • 2
    • 3
  • How do I best load my products?
    c

    Cedric

    05/26/2023, 7:03 PM
    So I have a database with my products on supabase with eg clothing items (pants, shirts, jackets etc). No right now I ofcourse only have a few items to test, but its ofcourse meant to grow to a decent size. Now I'm wondering how I best load these items. Do I load them all at once and store them in a state making for a longer load time, do I load them per catagory when I need them, or do I only ask from the backend what I need every time making a lot more API calls to my backend ofcourse, or something else? Also if someone is familiar with Stripe I'm really starting to break my mind about if I should store and fetch my products from the Stripe site (perhaps making the supabase db obsolete), keep them on supabase and like make a function that handles the migration of them to stripe or the other way around. (I know this might perhaps be some stupid questions)
    v
    • 2
    • 5
  • How can I create more than 10 edge functions?
    o

    osamita

    05/26/2023, 7:10 PM
    I dont know if i'm doing something wrong, but when I run supabase functions deploy my-function supabase client show a message that say that I reached the limit of edge functions, but I need more 😦 how can I do in this case?
    g
    v
    s
    • 4
    • 11
  • Critical Issue with Stripe client
    s

    sudoramen

    05/26/2023, 7:44 PM
    My Stripe integration recently stopped working but only for deployed functions. It doesn't error or anything, just silently hangs. To recreate, I created a test function
    Copy code
    ts
    import { serve } from "https://deno.land/std@0.168.0/http/server.ts"
    import Stripe from "https://esm.sh/stripe@11.0.0?target=deno&no-check";
    
    serve(async () => {
      const stripe = Stripe(Deno.env.get('STRIPE_PROD_SECRET'), {
        apiVersion: "2022-11-15",
        httpClient: Stripe.createFetchHttpClient(),
      })
    
      return new Response(
        JSON.stringify(await stripe.customers.list()),
        { headers: { "Content-Type": "application/json" } },
      )
    })
    This runs just fine when serving locally but when deployed, I never get a response back. The env var does match so I know that's not the issue.
    c
    s
    • 3
    • 9
  • Auth with new helpers
    c

    cufta22

    05/26/2023, 8:14 PM
    So my workflow before was this, I had auth subdomain ( auth.example.com ) and another subdomain ( x.example.com ), i would just set cookieOptions.domain to "example.com" in createBrowserSupabaseClient and redirect to x.example.com from auth.example.com and the session would be shared, the cookie domain was set correctly to example.com and i could authenticate any *.example.com domain like this Now when i set cookieOptions.domain to "example.com" in new createPagesBrowserClient it always sets the cookie ( \*-auth-token-code-verifier ) to auth.example.com ( with cookie domain set to "auth.example.com" even tho i set cookieOptions.domain to "example.com" ) and no cookie gets set to my x.example.com, i tried redirecting like before to just x.example.com/ and x.example.com/api/auth/callback but this gives the following error "AuthApiError: invalid request: both auth code and code verifier should be non-empty", which i think is because my x.example.com doesn't have the \*-auth-token-code-verifier cookie. I added the new /api/auth/callback.ts file to both auth.example.com and x.example.com Any idea how to create this workflow with the new helpers
  • Deploying langchain on supabase
    r

    ReactingMe

    05/26/2023, 9:15 PM
    I was wondering if we can deploy our app with a copy of langchain installed on supabase - if so, are there any online resources to walk me through?
    g
    v
    • 3
    • 3
  • Right way to send files to edge function
    o

    osamita

    05/26/2023, 10:15 PM
    I have this inside my edge function: --- const { my_files} = await req.json(); return new Response( JSON.stringify({ files: my_files, }) ); --- and im calling that function this way: --- let { data, error } = await supabase.functions.invoke("files-function", { body: { my_files: my_input.target.files }, }); --- but if I send N files, my edge function receive and return N empty objects. For example: sending 4 files, returns { my_files: [ {}, {}, {}, {} ] } sending 2 files, returns: { my_files: [ {}, {} ] } what is the right way to send files to my edge function?
    v
    • 2
    • 1
  • Moving to Supabase: How to import an existing SQL DB in to Supabase
    t

    teekster

    05/26/2023, 10:50 PM
    I have an application built with PHP & Mysql that I'd like to move to Supabase. I obviously just want to create web services for this part, and have already converted the DB form mysql to postgres. PS - I'm a newbie in supabase, and do not have a pro plan. I see that Supabase uses UUIDs for the user table, but mine are simple incremental IDs. 🆔 1.) What should be the best way to import the external DB in to Supabase? 2.) How to add the additional UUID field to the newly imported DB? Many thanks 🙏
    g
    • 2
    • 2
1...226227228229230Latest