https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Verify OTP on sign up vs sign in
    j

    jar

    12/25/2022, 2:56 PM
    When I signUpWithOTP by email it sends the 6 digit token to email. If there is no user it will create one and send the signup email with token However the verifyOTP function requires that I accurately specify type of 'magiclink' or 'signup' . In front end I dont know which code type to use because I don't know which type it checked. What is best way to know this? call to db to check if user with email exists right before signInWithOtp and if no user then set verifyOTP type to 'signup' https://supabase.com/docs/reference/javascript/auth-verifyotp
    g
    n
    j
    • 4
    • 9
  • multi user group
    m

    Mozes

    12/25/2022, 3:53 PM
    How can I create a multi user group since there are three types of members: 1 - User 2- Editor 3- Admin When the user first registers an account, he is in the "User" group, and the user in the "Admin" group can promote him to an admin or editor. Is there an article or a video that I can watch to implement such a feature using Supabase?
    g
    • 2
    • 2
  • How to retrieve sign up with additional user metadata
    c

    chit

    12/25/2022, 5:01 PM
    in the docs, https://supabase.com/docs/reference/javascript/auth-signup, we were taught to use the following syntax to create a user with additional metadata
    Copy code
    const { data, error } = await supabase.auth.signUp(
      {
        email: 'example@email.com',
        password: 'example-password',
        options: {
          data: {
            first_name: 'John',
            age: 27,
          }
        }
      }
    )
    may I ask how may the additional metadata be recorded and stored? is it in the column
    raw_user_meta_data
    inside the auth users table?
    g
    • 2
    • 2
  • Can I use PgTap to test a remote database?
    v

    VWL Tobias Hassebrock

    12/25/2022, 5:09 PM
    If yes, how? Because, "supabase test db" seems to work only locally for me or what am I doing wrong?
    • 1
    • 1
  • How is it possible to check user permissions from client?
    p

    Pierre_

    12/25/2022, 7:54 PM
    I have a
    documents
    table with some row level security policies set for
    select
    and
    update
    actions. A document can be editable, readonly, or neither, based on these policies. The document editor on the client must be configured as being either
    editable
    or
    readonly
    . Is it possible to check from the client if the user is allowed to
    select
    or
    update
    the document by these policies, given the
    user_id
    and the
    document_id
    ?
    Thanks,
    s
    g
    u
    • 4
    • 9
  • Setting realtime on table resets whenever local environment is restarted
    h

    Hermes

    12/25/2022, 10:49 PM
    So if i activate realtime on a table, it doesn't 'save' like other things but defaults back to off when local env is stopped. Its similar to triggers too, they aren't saved. Is there a fix for this?
    g
    • 2
    • 5
  • Expose schema to API not working
    i

    Il

    12/25/2022, 11:04 PM
    I created a schema called data, there are currently 2 tables in it, however there is no API generated for them. I changed the schema for one of the table to public and the API was immediately generated, however when I changed it back to data it disappeared right away. Thanks in advance!
    g
    • 2
    • 21
  • Database Function Array
    j

    jarryd

    12/26/2022, 3:07 AM
    I'm trying to bulk insert data using a database function via API but it only works for the first object in the array. This is some test data I'm passing but it only uses the first object in the array. Do I need to update my function to handle the array? The Javascript library makes it look straight forward but no documentation for the API. [ { "facebook": "", "image": "", "instagram": "", "name": "Test Host 1", "twitter": "", "website": "https://www.host1.com" }, { "facebook": "", "image": "", "instagram": "", "name": "Test Host 2", "twitter": "", "website": "" }, { "facebook": "", "image": "", "instagram": "", "name": "Test Host 3", "twitter": "", "website": "https://www.host3.com" } ]
    c
    g
    • 3
    • 3
  • Avoiding missing realtime messages before subscription
    b

    brianhv

    12/26/2022, 4:15 AM
    I'm looking at the slack clone example (https://github.com/supabase/supabase/blob/master/examples/slack-clone/nextjs-slack-clone/lib/Store.js). It looks like it should try to fetch existing data and subscribe to changes as close to simultaneously as possible, but it also looks like there's nothing preventing one of those connections from being delayed, causing either 1) missing realtime messages because the messages were sent between the data fetch and the start of the subscription, or 2) realtime messages coming in before the initial data load, giving those messages nothing to operate on. Is there a pattern to mitigate this issue, assuming my understanding is correct?
    g
    • 2
    • 2
  • Compressing Image before uploading to storage bucket
    c

    Crownie

    12/26/2022, 5:05 AM
    Copy code
    js
      const formdata = await new Promise((res, rej) => {
        const form = new Formidable({ multiples: true });
        form.parse(req, (err, fields, files) => {
          if (err) {
            rej({ err });
          }
          const daunt = files.image;
          console.log({ daunt });
          res({ err, fields, files });
        });
      });
    
      const formData = formdata as any;
      const { title, description } = formData.fields as formidable.;
      const postImage = formData.files.image as formidable.File;
    
      const imageCompressed = await sharp(postImage.filepath)
        .toFormat("png", { palette: true })
        .png({ quality: 8 })
        .toBuffer();
    
      const ress = await supabase.storage
        .from("post-images")
        .upload(Math.random().toString() + ".png", imageCompressed, { upsert: false });
    This is on `/api `folder of nextjs but when the file is uploaded it is type of
    text/plain;charset=UTF-8 - 157 bytes
    not
    png
    , is there a documentation i can explore on this?
    • 1
    • 1
  • How to recover session in Flutter?
    m

    mukhtharcm

    12/26/2022, 6:23 AM
    I mean when I was using Firebase, I didn't had to do anything to keep my auth state over hot reloads. Is there something like it in supabase?
  • Migrate DB Table to Another Schema
    g

    Gnarusly

    12/26/2022, 7:31 AM
    Hi Team. Is there a realistically simple way to migrate a series of tables from one schema to another via the Supabase GUI?
    g
    • 2
    • 1
  • First OTP often expired right after sending
    f

    Florian

    12/26/2022, 8:29 AM
    I'm setting up auth using
    signInWithOtp
    +
    verifyOtp
    and the first OTP I'm getting is almost always expired. The second one works.
    g
    • 2
    • 21
  • Invalid db.major_version 14
    s

    sven

    12/26/2022, 11:05 AM
    If I want to commit my changes from local development to supabase, I get following message:
    Copy code
    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.
    Try rerunning the command with --debug to troubleshoot the error.
    If I change my db.major_version in supabase/config.toml to 15, i get following error
    Copy code
    Error: Failed reading config: Invalid db.major_version: 15.
    Try rerunning the command with --debug to troubleshoot the error.
    My local version is: PostgreSQL 14.5 My remote db version is: PostgreSQL 15.1 How can I update my local version to PostgreSQL 15.1?
  • Disallow users to call certain postgres Remote Procedure Calls
    c

    chit

    12/26/2022, 11:05 AM
    There is a syntax to call supabase functions
    await supabase.rpc('hello_world')
    But there are also some
    security definer
    functions that I don't want user to call Are users not able to call security definer functions? or what steps can I take to prevent them from being able to call those functions?
    g
    • 2
    • 2
  • I'm getting Error EACCES permission denied, lstat
    c

    Chirag

    12/26/2022, 11:41 AM
    can anyone please help me, because I'm getting this error when I'm setting up the project in my local machine for contribution
  • [ SOLVED ] Fetching table data and updating reactive data (nuxt 3)
    c

    christer

    12/26/2022, 1:08 PM
    Im trying to update the form.data.first_name with account[0].first_name value, but it seems like account[0].first_name is not defined when I try to update the form value. Even though the console.log(account) returns data. I think my pattern might be completely wrong, so if someone has an example of how to properly do this, it would be greatly appreciated.
    Copy code
    const { data: { user }  } = await supabase.auth.getUser()
    
      const form = reactive({
        data: {
          first_name: '',
          last_name: '',
          country: '',
          city: '',
          address_line: '',
          postal_code: '',
          username: '',
          email: '',
          currency: '',
          language: '',
        },
      });
      
      if (user && user.id) {
        const getAccount = async () => {
          const { data: account, error } = await supabase
          .from('accounts')
          .select()
          .eq("user_id", user.id)
          return { account, error };
        };
        const { account, error } = await getAccount();
        console.log(account)
    
        form.data.first_name=account[0].first_name
        
        console.log(error)
      }
    • 1
    • 1
  • Alternative to setAuth() and using RLS
    r

    R4Y

    12/26/2022, 1:40 PM
    Let me explain what I’m doing I am using fastify as the api framework and i was looking on how can i use RLS I though on using setAuth but it’s currently deprecated. So after learning a bit on how authentication works (creates a jwt token for the user’s session) but how can i use RLS with specifying in my supabase query?
    g
    • 2
    • 7
  • Identify if user authe'd thorugh password reset link
    u

    Uberzeek

    12/26/2022, 4:21 PM
    I want the user to be able to change password only when redirected through the resetPasswordForEmail api. he'll then be redirected to some page let's say /password-recovery, the page will check the hash/token that was delivered from the redirection link, if it's valid - the page will be displayed, if not return 404 / redirect home. same thing if user tries to force navigate to /password-recovery, he'll be redirected to home/404. Is that possible?
    g
    • 2
    • 16
  • Best way to prevent alias emails?
    o

    Orange🍊

    12/26/2022, 4:51 PM
    When signing-up new users, I want to prevent aliases such as:
    email@provider.com | email+1@provider.com | ...
    What is the best way using Supabase?
    g
    s
    • 3
    • 4
  • Storing other session data
    t

    toddgeist

    12/26/2022, 5:35 PM
    It doesn't look like we can store other data in the session table. So where do I put things like "Current Team" where I want to be able to use the Current Team Id in rules. I suppose I could put it in the profiles table. Or maybe make another table for user_settings?
    g
    • 2
    • 2
  • handling Credit Card Payments
    d

    draco

    12/26/2022, 5:36 PM
    As the title says. When handling payments with stripe or any other payment processor you get your private api key that you use on the server side or supabase edge functions. This makes sense. The thing I have a question about is how are you supposed to securely send that data to your edge function? Is it ok to just attach it as data with your rpc calls? Is there something else we should be doing to make sure that but of the process is secured?
  • Sign up in vue 3 composition API
    r

    Revaycolizer

    12/26/2022, 7:23 PM
    I am trying to enable a user to sign up using supabase but whenever I click on register button I get a message 'cannot access email before initialization' Below is the code: const {email, password} = await supabase.auth.signUp({ email:email.value, password :password.value )}
    g
    s
    • 3
    • 23
  • migration
    j

    Julian IncrEdelman

    12/26/2022, 8:17 PM
    DB is hard down. No idea why. Restarting doesn't work.
    m
    n
    +2
    • 5
    • 22
  • Multipile table joins query - supabase SDK vs regular SQL queries
    g

    Guy Rozen

    12/26/2022, 9:10 PM
    Whenever I am trying to fetch through supabase's SDK where I need joins from more than two joins, I keep on receiving an error from the sdk. Running a regular SQL script through supabase's SQL editor does work, so either I am missing something in terms of syntax, the SDK's functionality is limited, or there is something I am not aware of. I am using a junction table as the base table. The code is something similar to the associated image. However, adding a third table, would result in as "could not find a relationship in the schema cache". Keep in mind, there is a foreign key for the first two tables, but the third one is ambigous, and I pretty much need the id from the first table (portfolio) in order to associate with the third table's foreign key. The second image shows the working sql script. Am I supposed to chain select functions with the SDK? Is that even efficient? Or would that be considered to be two different requests? Are there other solutions other than saving the script as a function and calling it through RPC?
    g
    • 2
    • 5
  • Getting wrong asset from storage
    d

    DDupasquier

    12/26/2022, 9:31 PM
    Just for reference, I am building a storybook app using SvelteKit. There is a story has multiple pages accessible via slug routes. The pages are displayed in the image provided. When I click to the next page, I get images loading in the wrong spot. But once I refresh the page the images appear correctly.
    Copy code
    js
    const getElement = async () => {
            const { data: url } = supabase.storage.from('svg-assets').getPublicUrl(element.elementName);
            return url;
        };
    
        let image: { publicUrl: string };
        let loading = true;
    
        $: console.log(image, element.elementName)
    
        onMount(async () => {
            image = await getElement();
            
    
            setTimeout(() => {
                loading = false;
            }, 1000);
        });
    Here is the output of that console log: {publicUrl:
    Copy code
    'https://latdcbfvbassfihdwpwi.supabase.co/storage/v1/object/public/svg-assets/totoro_umbrella'} 'totoro_umbrella'
    'https://latdcbfvbassfihdwpwi.supabase.co/storage/v1/object/public/svg-assets/totoro_umbrella'} 'moon_loader'
    As you can see, the getElement function isn't always grabbing the correct asset, even though my 'element.elementName' is always correct no matter what. Which leads me to believe that this is an issue (or oversight) that I'm having with supabase. Any insight is appreciated! Thanks!
    s
    g
    • 3
    • 5
  • Handle user deletions
    t

    Tobias Grether

    12/26/2022, 10:12 PM
    When a user is deleted from the database, the session is no longer valid. However, if the user is already logged in, auth.getSession() will still return the current session, but when you call auth.refreshToken(), it will return an error 400. Is there a better way to handle this so that if my user gets deleted and they refresh the page, the frontend immediately knows that the session is invalid? Kind regards, Tobias Grether
    g
    • 2
    • 2
  • video player thumbnails
    n

    nkeating

    12/26/2022, 10:37 PM
    We're using supabase storage and videos ( on a basic video gallery type page) and they tend to load a little slow. We're ok with that but need to add the custom thumbnails so users know what they are clicking on/waiting for. Our previous app used the cloudinary player which did all of this for us (mainly generate automatic thumbnails) - does anyone have any recommendations on the cleanest route to accomplish this with supabase storage + [insert minimal footprint package you recommend]?
    g
    • 2
    • 1
  • Edge function temporary filesystem
    c

    Chk

    12/26/2022, 11:06 PM
    Hey, I have a use case where I would need to access the filesystem to store temporary files and run shell commands on them. It works perfect locally but I saw that a limitation of Deno Deploy was "Cannot write to File System" and indeed it does no longer work when deploying the edge function. Is there any way to circumvent this or is this currently a hard limitation with no good solution?
    g
    • 2
    • 1
  • NavBar Props to product page
    i

    iStun4Fun

    12/27/2022, 12:05 AM
    I've got a navbar and inside the navbar there is a select drop-down On the product pages I would like to fetch only the products of the shop selected in the drop-down The code is ready to run hardcoded but I can't pass the value from navbar to productList.js So anyone is giving me a hand with context Providers to do it easily and finish this example?
1...798081...230Latest