https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • RLS With Join Table
    l

    Lukas

    11/19/2022, 6:21 PM
    I have 2 tables that are linked together via another table using references. I'm able to easily use it in javascript code, but I can't figure it out when using sql queries.
    s
    i
    +2
    • 5
    • 14
  • realtime with v2 not working
    k

    KTibow

    11/19/2022, 6:55 PM
    recently upgraded my project to v2, however i can't get realtime to work using the example one to listen to everything:
    Copy code
    js
    temp0
    
      .channel('*')
    
      .on('postgres_changes', { event: '*', schema: '*' }, payload => {
    
        console.log('Change received!', payload)
    
      })
    
      .subscribe()
    nothing happens when i edit a row with realtime on and rls select enabled from the supabase ui one thing i noticed was that it was sending a null access token, any ideas on how to get it to use the auth with realtime?
    g
    • 2
    • 27
  • Filter using json isnt working
    u

    UCDFiddes

    11/19/2022, 8:12 PM
    Im trying to filter my table by looking withing a json object in each record and it dosent seem to work.
    Copy code
    json
    {"code":"22P02","details":"Token \"2d01f68a\" is invalid.","hint":null,"message":"invalid input syntax for type json"}
    s
    g
    • 3
    • 7
  • RPC parameter list
    d

    draco

    11/19/2022, 8:53 PM
    Is there full documentation of all parameters/arguments available in rpc calls? Ex. Let’s say I have a function called hello. When I call that function. In the body of the function what arguments are available for me automatically? I am trying to build an api for my app and want to put it together well but am having a hard time figuring out what’s there and what isn’t. I know I can get user id, but can I also get information about the machine that initiated the call like user agent, url, etc?
    g
    • 2
    • 3
  • How to add data while user signup
    m

    Mozes

    11/19/2022, 9:01 PM
    Hello guys I used the user managment with some modfications to fit my needs which is add two columns: username, user_group and need when user signup it will get his username and user_group and insert it but the problem It can't see the data and return null How can I send data when user signup?
    g
    • 2
    • 26
  • Set url for supabase project
    r

    Ralph

    11/19/2022, 9:22 PM
    Is it possible to set a custom human readable url for a supabase project? Right now reference id is like: nnydmuckhjwtxbaahzzz and url is: https://nnydmuckhjwtxbaahzzz.supabase.co I was hoping to set the the url to something like: https://friendlyname.supabase.co I understand that this might not be possible with an existing project. But is it possible to set when creating a new project?
    g
    • 2
    • 2
  • React - One subscription consumed by in multiple components
    l

    LufyCZ

    11/19/2022, 9:56 PM
    Hey! I've been trying to figure this one out for the last couple days, haven't been able to find a good solution yet though. I'm using React. For simple fetches, I can do "caching" just fine with
    swr
    , however, this is not possible for subscriptions. I've got a hook that takes care of everything (initial fetch, updates using
    useReducer
    ) which works perfectly when used once, problem is, if I want to consume the same data in multiple components (not in a parent-child relationship), it starts acting up for some reason (+ there's no point fetching the same data n times anyway). Anyone know how to handle this? Would really appreciate it ^^
    g
    • 2
    • 2
  • how to sum when columns are float?
    i

    iStun4Fun

    11/19/2022, 10:26 PM
    I was researching that float sums can lead into problems giving bad results. My question here is how should we re-model our db to import this data into it again ? The main problem is that much rows have numbers like 0.00000456 and this is repeated hundred times when we after need to sum and expose that number into front end.
  • How to get id from auth table by email?
    t

    Taeyang Kim

    11/19/2022, 11:45 PM
    We cannot seem to find a function that access the user with email. There are some functions to find the user by id or get the list of all users, but there was no function to get id by email. Is there an easier way to do that rather than looping through the array to get the id by matching the email? Language: JavaScript or Rust
    g
    • 2
    • 2
  • accessing values set in app_metadata security definer
    j

    jopfre

    11/20/2022, 1:45 AM
    Following the managing user data guide https://supabase.com/docs/guides/auth/managing-user-data I have got users profiles created when a user signs up. However I am also storing a user role within the app_metadata object. When I try and access this value within the security definer using
    new.raw_app_meta_data->'role'
    I get null. If I
    raise log '%', new.raw_app_meta_data;
    I get
    {"provider": "email", "providers": ["email"]}
    . Whereas in auth.users.raw_app_meta_data I can see
    {"role":"admin","provider":"email","providers":["email"]}
    . Why is my role not available within the
    new
    object?
    g
    n
    • 3
    • 66
  • error saving new user?
    b

    bennypc

    11/20/2022, 2:31 AM
    i have this handle new user function
    n
    g
    • 3
    • 41
  • Using Storage with Prisma
    j

    jacobL

    11/20/2022, 2:41 AM
    Hi! I'm making a site with Supabase and decided to switch to using Prisma for accessing the database, but I'm not sure how to use it with Supabase storage. Anyone know if this is possible?
    n
    • 2
    • 4
  • Reactive Client DB Cache
    a

    andreterron

    11/20/2022, 2:50 AM
    I’ve been using SWR to cache Supabase queries, but I don’t want to manually trigger a refetch every time I do an insert/update. Has anyone built/seen a reactive db replica/cache on the client? For more context, the scenario I’m thinking is the following: I’m showing a list of X, when the user creates a new X, I want the list to update immediately with the local data, and also trigger a new query request to Supabase. I might build this if it doesn’t exist, but I wanted to first ask about it.
  • redirect link sending to wrong link
    b

    bennypc

    11/20/2022, 3:11 AM
    i have this fucntion for user creation
    s
    • 2
    • 4
  • Best way to copy a dev database over to a new production project?
    u

    49Ryann

    11/20/2022, 3:37 AM
    Is there anyway to copy a dev environment project with functions etc I've been working on in a project into a new production project?
    b
    j
    a
    • 4
    • 5
  • Unable to update value of one column in the row in Python client
    w

    wanderexplorer

    11/20/2022, 9:15 AM
    Hi, I am trying to update the value of a preloaded table's column's value for a given row. Python doesn't throw me any error and the Supabase table also doesn't reflect any change, here's the code I'm using: update = supabase.table("stocks").update({'last_closing_price': '24.56'}).eq('stock_symbol', 'LCAA') Any thoughts? I initially thought it was a policies issue but I now have public update access on this table and still no change
    • 1
    • 1
  • Querying Multiple Keys of JSONB
    a

    anggoran

    11/20/2022, 9:24 AM
    Hello, in the Supabase Docs, we have this syntax to query JSONB key, which is
    ->
    .
    Copy code
    const { data, error } = await supabase
      .from('users')
      .select(`
        id, name,
        address->city
      `)
    If we want to query multiple keys of JSONB, how can I do that? Can I do something like this to prevent repetitive?
    address -> (city, district, postcode)
    g
    r
    • 3
    • 2
  • My project got deleted?
    m

    MaGnezij

    11/20/2022, 10:44 AM
    Has anyone experienced a similar issue? So till yesterday I was able to see my project in the UI, access the tables etc.. Today when I click on the bookmarked tab for the projects I get a notification that the project doesn't exist anymore. But I can still access the data through requests? Any idea why the UI is gone?
    s
    • 2
    • 1
  • Constantly getting db migration error on Logs Explorer
    b

    bimsina

    11/20/2022, 2:02 PM
    Severity : Fatal Event Message running db migrations: error executing migrations/20221003041349_add_mfa_schema.up.sql
    • 1
    • 1
  • Supabase CLI throwing terminal error during yarn upgrade
    s

    Spoonz

    11/20/2022, 5:01 PM
    I'm trying to run
    yarn upgrade
    on my project and it's throwing an error from the Supabase CLI package during rebuilding.
    Copy code
    error D:\project\node_modules\supabase: Command failed.
    Exit code: 1
    Command: node scripts/preinstall.js
    Arguments:
    Directory: D:\project\node_modules\supabase
    Output:
    Downloading https://github.com/supabase/cli/releases/download/v1.14.3/supabase_1.14.3_windows_amd64.tar.gz
    node:internal/process/esm_loader:94
        internalBinding('errors').triggerUncaughtException(
                                  ^
    
    [Error: EEXIST: file already exists, link 'D:\project\node_modules\supabase\bin\supabase.exe' -> 'D:\project\node_modules\supabase\bin\supabase'] {
      errno: -4075,
      code: 'EEXIST',
      syscall: 'link',
  • Storage ``from.update()`` vs ``from.upload()``
    n

    NMS

    11/20/2022, 5:05 PM
    Is there any difference between the two functions? Seems like both requires ``{upsert: true}`` to replace existing file. What I expect from ``update()`` function is to be able to replace ``profile.jpg`` with ``profile.png``.
    g
    • 2
    • 1
  • Can this query be written in Supabase?
    s

    Smardrengr

    11/20/2022, 5:52 PM
    I'm developing an app for organizing team sports among friends, have it mostly working, but there's a query I need for displaying “open” games available to join (created by me, or by one of my friends). Specifically: I want to
    select
    1. games organized by me (I am the organizer) 2. games organized by one of my friends (open to friends) 3. games I'm playing in (joined) I can easily write the query in regular SQL:
    Copy code
    select games.* from games where games.organizer_id = session.user.id
    or games.organizer_id in (select friends.friend_id from friends where friends.user_id = session.user.id and friends.accepted = true)
    or games.id in (select players.game_id from players where players.user_id = session.user.id);
    ...But cannot see how to do it using the Supabase API. Peaking into two foreign tables
    games → players
    and
    games → friends
    with where clauses, Is it even possilbe? If not, maybe I could achieve the above with an RLS policy?! Any tips or suggestions are very appreciated.
    g
    • 2
    • 19
  • Empty array as response
    t

    theravenstone

    11/20/2022, 6:24 PM
    Hey i wanna fetch events from my tables, but i only get an empty array. My project uses Nuxt3, Supabase (@nuxtjs/supabase) Auth works perfectly but fetching data does not code to fetch data
    Copy code
    js
    const user = useSupabaseUser();
    const client = useSupabaseClient();
    
    let { data: events, error } = await client
      .from('events')
      .select('id', 'title', 'description', 'created_by')
    
    console.log(events)
    m
    • 2
    • 7
  • Error sending int data but supabase converted it to string
    m

    Mozes

    11/20/2022, 7:09 PM
    Hello, I have column in my table called "user_xp" which is int8 when user signup for the first time it take 0 as int from frontend an pass it to function in supabase but I got error the value supabase got is string and the column is int8 My problem is how to make the function stored in supabase to not convert the value it takes from frontend?
    g
    • 2
    • 2
  • [Solved] What does signInWithOtp use to determine SignUp or SignIn?
    k

    komagata

    11/20/2022, 7:39 PM
    I am registering initial user data in seed.sql. Even though I have a user with the same Email, SignInWithOtp creates a new user. What does SignInWithOtp use to determine SignUp and SignIn?
    g
    • 2
    • 7
  • TS and Database
    r

    redwookie

    11/20/2022, 9:29 PM
    I am trying to do the quickstart guide using TS, but I seem to be missing some files. Util.database any documentation on how to go about doing the quickstart with TS?
    s
    • 2
    • 7
  • Trigger Sign-In Callback (Sveltekit Auth Helper)
    s

    sixfour

    11/20/2022, 10:29 PM
    Hi, I want to trigger a callback once a user has signed into my app. I've tried to use the client side supabaseClient.auth.onAuthStateChange and look for the SIGNED_IN event, but the results have been flakey. The callback is often not trigger until ~10-20 seconds after the user logs in and sometimes its not trigger at all. Is there a pattern for server-side sign in callbacks for the Sveltekit Auth Helper? Thanks.
    s
    • 2
    • 1
  • Supabase deep linking with facebook oauth
    g

    gtims123

    11/21/2022, 12:29 AM
    Hi, I am using Sign in with Facebook with supabase. I have a simple Next.js web page with a Sign in with Facebook button. I'm showing this web page in my react native app in a react-native-webview modal. The problem is that the auth link takes the user to facebook and makes the user sign in with facebook username and password every time. I was wondering how I could make it such that it deep linked into the Facebook app on the user's phone if they have it installed. I've seen apps such as Zero with this type of functionality. They have a web view modal which opens when user wants to sign in with facebook, and right away there's a pop up that asks the user if they want to deeplink into the facebook app. Would appreciate any help here!
    g
    • 2
    • 3
  • How supabase authorization works
    j

    James Blond

    11/21/2022, 3:38 AM
    I've read the docs and I'm curious about this part https://supabase.com/docs/guides/auth#how-it-works
    4. Postgres inspects the JWT to determine the user making the request.
    question: when it says "postgres inspects the JWT", does postgres actually query the database to match a stored JWT ? or how postgres "inspects" the JWT? thank you in advance for the answers
    g
    • 2
    • 5
  • Missing pause project button
    u

    [GodderE2D]

    11/21/2022, 4:38 AM
    In the dashboard under Project Settings > General > Infrastructure, the pause project button is missing. On all of my other unpaused projects, the button is still there. Before this, I tried to pause the project and it showed that it was loading. Refreshed the page after ~2 mins, project is still usable but no pause button. I tried restarting the server, logging in & out, and clearing my browser cache, however, to no avail. Project ID:
    fnuvrlvsrpjvtcilxeit
    deleted
1...686970...230Latest