https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • TypeError: Module specifier, '@supabase/supabase-js' does not start with
    g

    Gitanes

    02/25/2023, 5:30 PM
    How do I use a supabase import in a script tag with a module specifier? I get an error saying
    [Error] TypeError: Module specifier, '@supabase/supabase-js' does not start with "/", "./", or "../". Referenced from http://localhost:8888/home/
    Copy code
    <script type="module">
        import {createClient} from '@supabase/supabase-js'
  • Github Application
    d

    Daniel Netzer

    02/25/2023, 6:48 PM
    Hello everyone, I've created a new Github Application (not OAuth). I've tried to configure and setup the OAuth flow in there similar to what needs to be done with the OAuth application and i'm seeing the following error
    missing state parameter
    Did anyone tried to do the same setup and had better luck?
    • 1
    • 2
  • Infinite user session alternatives? 🤔
    k

    kevlust

    02/25/2023, 7:27 PM
    For the social app I'm building on Swift/iOS, I was hoping to be able to allow users to be signed in indefinitely until they sign out, even if/when the app stops running in the background. However, I saw that the maximum JWT expiry time is 1 week. Given that limitation, is there a way to achieve what I'm looking for (without compromising RLS)? Please bear with me, as this is my first time dealing with authentication, JWTs, user sessions, etc, and I'm not very knowledgeable about this. A few options I read about and have been considering: - Set the JWT expiry limit to the max, for sure. Then, as long as the app is running, refresh the token every 5 days or so to keep the session running. How would one do this? Would it work (at least for the case where the app is still running in the background)? - To account for when the user kills the app, I read it's feasible to give them a "remember me" option upon sign in. That way, if they come back to the app and the session has already expired, I can use those locally-stored credentials to sign them in automatically. Any thoughts on these options? Am I missing something important? Any other ideas? All feedback is greatly appreciated, as I'm kinda new to this. Thanks in advance!
    g
    • 2
    • 7
  • CLI docker container environment variables?
    j

    JubilantJam

    02/25/2023, 8:12 PM
    I need to set the SUPABASE_PUBLIC_URL env variable for the Studio docker container. Is there a way to do this using the CLI? It doesn't look like SUPABASE_PUBLIC_URL is accessible through the config.toml
    s
    • 2
    • 2
  • Is it possible to send the authentication emails with an SMTP provider?
    a

    Atrox

    02/25/2023, 8:24 PM
    I'd like to be able to send magic links, signup confirmations, etc through a transactional email API instead of letting Supabase handle it. Is this possible? The documentation for email templates makes it seem like it's not. Hoping that I'm missing something here. Not a fan of how Supabase removes everything outside of
    <body>
    . This makes styling unnecessarily difficult and prevents using any kind of custom metadata or web fonts.
    g
    • 2
    • 3
  • Failed to Reset Database Password
    k

    Kuba

    02/25/2023, 8:44 PM
    Hello! I wanted to reset a database password (Database Settings > Reset Database Password). When I entered in
    ,.WuxplAa3CDo!Z^wKofi*c%0+yQ(6q|(~#GWJKe)4hn4Jj:k'
    as a new password, it was validated as
    strong
    , but clicking on
    Reset password
    brought me an error:
    Copy code
    Failed to reset password
    Generating a new password from the modal worked, but it's much less secure password that what I would like to use. Moreover, I had the same password as the one above in the beginning, when I was setting up a database, just with one different character and there was no issue. PS. Yes, I'm aware I disclosed my password. It's changed, so it isn't a big deal.
    s
    • 2
    • 2
  • Request keeps failing
    b

    BraverElliot.eth

    02/25/2023, 8:45 PM
    I am using next-auth and I am storing uuid in my next-auth schema. I created other columns for the user table within the next-auth schema and I want to edit those. I need help, thanks.
    • 1
    • 3
  • Cannot destructure property 'user' of 'session' as it is undefined.
    x

    xdotcommer

    02/25/2023, 8:46 PM
    I get a pop up with this error and the "username" field is null - using the example provided in the docs to getProfile
    g
    • 2
    • 1
  • Inner join on many to many with match all filter JS client.
    m

    Macpire

    02/25/2023, 8:47 PM
    Product table id | product 1 | p1 2 | p2 Tag table id | tag 1 | t1 2 | t2 ProductTag table id | product | tag 1 | p1 | t1 2 | p1 | t2 3 | p2 | t1 Getting the records: await client.from('product').select('id, productTag!inner(tag)')..... How to i filter so I will only get product that match ProductTag.tag in [1,2] meaning both needs to apply the result should be p1 which have both t1 and t2. Today i get this:
    Copy code
    Query:
    const product = await client.from('product').select('id, productTag!inner(tag)').in('productTag.tag', [20, 57])
    
    Output:
    data: [
        { id: 32, productTag: [ { tag: 20 }, { tag: 57 } ] },
        { id: 33, productTag: [ { tag: 20 } ] }
      ],
    I prefer not to filter this list on JS based on productTag count after getting all products :/ Thank you!
    g
    • 2
    • 9
  • Querying for count is null when using { count: "exact" }
    k

    Kuba

    02/25/2023, 9:57 PM
    Hello again! I'm a bit confused as to why this returns a null:
    Copy code
    js
    const { data } = await supabase
      .from("questions")
      .select("*", { count: "exact", head: true })
      .eq("quiz_id", quizData.id);
    // result: null
    while this returns an object that contains the desired result of counting the results:
    Copy code
    js
    const { data } = await supabase
      .from("questions")
      .select("count")
      .eq("quiz_id", quizData.id)
      .single();
    // result: { count: 2 }
    The first code is literally the code from the docs, so why it does return
    null
    ?
    g
    • 2
    • 2
  • Max rows when self hosting
    o

    oldwired

    02/25/2023, 10:11 PM
    The documentation for Fetch says "By default, Supabase projects return a maximum of 1,000 rows. This setting can be changed in your project's API settings." Is this also the case for self hosted (docker) Supabase? If so, where can I change it? I don't see a setting in the .env
  • import users from firebase doesn't preserve their firebase uids
    i

    imagio

    02/25/2023, 10:46 PM
    I'm attempting to import my firestore data and users to test out Supabase. The officially recommended migration tools don't appear to be usable as they don't preserve the original firebase uid. Without the firebase uid I can't relate the imported users to their imported data from firestore. How have other people who migrated from firebase solved this? https://github.com/supabase-community/firebase-to-supabase
    g
    • 2
    • 3
  • Joined table types are broken?
    d

    DYELbrah

    02/26/2023, 12:28 AM
    I have the following call:
    Copy code
    const { data, error } = await ctx.supabase
            .from("customer_transaction")
            .select("id, customer(business_name)")
            .eq("id", id)
            .single();
    
          if (error) {
            throw error;
          }
    
          return data;
    When I try to access the data I'm doing:
    Copy code
    fetchedTransaction.customer?,business_name
    I get an error:
    Copy code
    Property 'business_name' does not exist on type '{ business_name: string | null; } | { business_name: string | null; }[]'.
      Property 'business_name' does not exist on type '{ business_name: string | null; }[]'.ts(2339)
    • 1
    • 2
  • How to prepend a string to the front of an autogenerated integer ID column?
    a

    Actual Left Shark

    02/26/2023, 12:52 AM
    I have a basic table, that I use the default, auto generated ID column. Instead of just the id's being 1,2,3,4... I want to add a string to the front such as "Listing_" and so it would be instead Listing_1, Listing_2, Listing_3... etc...
    g
    • 2
    • 1
  • Related Posts by Tags in Common
    j

    jdgamble555

    02/26/2023, 1:03 AM
    So looking for a real SQL guru to help me on this one: Model:
    Copy code
    tags
    - name
    - pid (short for post_id)
    (fk = name + pid)
    
    posts
    - id
    - title
    - content
    (all posts have minimum of 3 tags)
    ...
    Function:
    Copy code
    ts
    create function get_related_posts(post_id uuid)
    returns setof posts
    language plpgsql
    as $$
    begin
        return query
        select 
        ... (code here)  
        posts.id = $1;
    end;$$;
    Looking to create a function get_related_posts, which lets me get the related posts by tag like so: - grab all posts with all 5 tags in common (if 5 tags) - grab all posts with any 4 tags in common (if 4 tags) - grab all posts with any 3 tags in common (if 3 or less tags) - grab all posts with any 2 tags in common - grab all posts with one tag in common And then I could limit those results on the front end. Can't wrap my head around this... J
    g
    • 2
    • 3
  • Can't create a real time table
    n

    n00t

    02/26/2023, 1:10 AM
    As I attempt to create a real time table I only get the message
    All table's elements must be unique
    Even if I remove all columns except an id column. See image Feels like I tried everything
    g
    j
    • 3
    • 31
  • Is edge functions URL safe to use in the client?
    j

    jinsley8

    02/26/2023, 2:22 AM
    Is the edge functions URL (https://abcdomain.functions.supabase.co) safe to use on the client side? I'm using it to generate OG images. Also, can this URL be changed with a vanity URL or custom domain?
  • Database Question With Auth
    l

    lecookie

    02/26/2023, 3:45 AM
    How can I store a value(token) that is specifc to a user and that I can only access if I am that user ?
    g
    • 2
    • 4
  • Is it possible to apply on delete cascade to supabase storage?
    p

    pakkerr

    02/26/2023, 4:30 AM
    What I'm looking for is that when a user is deleted, their corresponding files in Supabase Storage are deleted.
    g
    j
    • 3
    • 6
  • `supabase db reset` deletes the bucket storage and all of the folders/files.
    a

    Amr

    02/26/2023, 10:58 AM
    How do I at least define a bucket in
    seed.sql
    so that I can safely reset the database after each migration? It's not very important, just a nice to have while local developing
    g
    • 2
    • 4
  • Changing profile viewable RLS Policy
    c

    chrtravels

    02/26/2023, 11:08 AM
    Hello all. New to Supabase and following the tutorial for User Authentication for Next.js. It's recommended to setup a public profile but I wondering if this can be setup so that the policy can be changed by a user, if they want to hide their profile? Also wondering if it would be best to also have a separate users table to contain private information, such as password, phone number and things like that? Basically I wasn't sure if the profile table is public, would all of the tables basically be insecure? From what I can tell, the RLS is Table wide and not per column, so we would be better off, having a private 'users' table and a 'public' profiles table, which can be toggled on/on if the user wants their profile hidden. ? From what I have read, column level security is a difficult prospect, so two tables would be better. Am I thinking about this correctly Thanks for entertaining noob questions. 😉
    g
    • 2
    • 4
  • how to resume a paused database?
    d

    doğukan

    02/26/2023, 11:31 AM
    After a 2 week break I started working on my supabase project again and I saw that the signup API call returns 500. I think my database was stopped. But I can't figure out how to restart it. Where is the restart button?
    e
    • 2
    • 1
  • Custom confirmation_token is not working
    d

    DoDo

    02/26/2023, 12:33 PM
    To create test account for SMS OTP auth, we create database function for custom confirmation_token as first picture. Until yesterday, it worked. But suddenly it doesn't work TT. Is there any change for OTP? And I found a point that custom confirmation code is not encrypted but the real one is. (2nd pic) Is there encrypt function that I can use it in SQL editor?
  • Send a pass word reset request
    d

    DevThoughts

    02/26/2023, 1:24 PM
    I found this example in the docs, where does onAuthStateChange should run in the password-reset component?
    Copy code
    useEffect(() => {
       supabase.auth.onAuthStateChange(async (event, session) => {
         if (event == "PASSWORD_RECOVERY") {
           const newPassword = prompt("What would you like your new password to be?");
           const { data, error } = await supabase.auth
             .updateUser({ password: newPassword })
    
           if (data) alert("Password updated successfully!")
           if (error) alert("There was an error updating your password.")
         }
       })
     }, [])
    My protected routes looks like this
    Session ? <App /> : <Login />
    every time when i click on the mail link my app gets logged in instead of coming to reset-password route, i guess reset password link has an token=. My app is vite create react app.
    g
    s
    • 3
    • 3
  • Does supabase auth automatically handles email logins that are same with an oauth providers email?
    s

    sovereign

    02/26/2023, 1:25 PM
    I want a user that signups with example@gmail.com to be identified as the same user that signs-in with google and the google email for that account is example@gmail.com. Does supabase support this ootb or do you know of an example implementation you can point me to?
  • Unable to access my Supabase account
    a

    ajdavies

    02/26/2023, 1:36 PM
    Hi all. Yesterday I updated my Github account username and email for the account I've used to sign into Supabase. Since then I have not been able to login to the Supabase admin portal. I also don't seem to be able to submit a support ticket and the 'email support' requires you to be logged in. I've tried all the normal steps to find a fix (different browser, clear cache and browser data, etc) but I've had no luck. Any help would be much appreciated!
    g
    • 2
    • 2
  • Failed host lookup error
    f

    Flyte

    02/26/2023, 1:44 PM
    I get 'failed host lookup' followed by my supabase url when I try to sign in or sign up on the apk version of my app. No error when I do it on windows , emulator , web or when emulating on the same device that I use the apk on. Any idea where I should look ?
    g
    • 2
    • 4
  • How to add users without invite in Authentication -> Users?
    a

    amyp

    02/26/2023, 1:57 PM
    After disabling Email inside Authentication > Providers it still asks for email in Authentication -> Users
    g
    • 2
    • 1
  • type error in nextjs quickstart
    a

    alana

    02/26/2023, 2:12 PM
    hello! i'm following this guide and when i paste the code into index.tsx i'm getting this error on countries. is there something simple i'm missing? sorry i'm new to typescript! https://supabase.com/docs/guides/getting-started/quickstarts/nextjs
    m
    s
    • 3
    • 10
  • IP-based user authentication and authorization
    a

    amyp

    02/26/2023, 2:19 PM
    How can this be achieved in Supabase? 1) Could you please allow to specify an IP address in Authentication -> Users that than is written into pg_hba.conf? https://www.postgresql.org/docs/current/auth-pg-hba-conf.html 2) Could you please add a auth.ip() to create a RLS policy
    g
    • 2
    • 1
1...146147148...230Latest