https://supabase.com/ logo
Join Discord
Powered by
# help
  • j

    James Q Quick

    06/17/2022, 7:11 PM
    Hey team! I'm wondering how to make queries with one to many relationships. My specific example is an invoicing app where each
    Invoice
    has many
    LineItems
    . My db model is setup where the
    LineItem
    has a reference as
    invoiceId
    to the primary key of the corresponding invoice. I'm wondering how can query and create invoices that includes that line items themselves? The only thing I found in the docs is to include the foreign key relationship which I already have setup. So, I know I can query an invoice from a line item, but how do I query line items from an invoice?
    n
    g
    • 3
    • 31
  • a

    Adi

    06/17/2022, 9:24 PM
    I am using supabase object storage and I have uploaded static JS file can I update same static file keeping url of that object storage same?? I want to have multiple revisions but url should not change
    n
    • 2
    • 1
  • n

    Nin

    06/17/2022, 9:32 PM
    Just checking.. are views available in GraphQL? Because they don't seem to be populated in the schema 🤔
    n
    g
    • 3
    • 4
  • c

    Certinax

    06/17/2022, 10:38 PM
    Hey, I'm trying to delete "my" logged in user by using a rpc call to a stored procedure / function. I'm not sure how to do the workaround to allow the action from client. I know the docs says that this is an action that requires a backend call with service_key, but I don't have any other running backends for my project. I've tried the following: - Set role to
    service_role
    - Grant usage on schema with
    authenticated
    - Create policy on `auth.users`for delete to
    authenticated
    My response:
    Copy code
    message: 'permission denied for table users',
    code: '42501',
    Any suggestions or other workarounds? 👼 My latest attempt:
    Copy code
    create or replace function cleanup_user ()
      returns boolean
      language plpgsql
      as
      $$
        begin
          SET ROLE TO service_role;
          delete from auth.users where id = auth.uid();
          return true;
        end;
      $$
    n
    g
    • 3
    • 4
  • d

    DanMossa

    06/17/2022, 11:14 PM
    Looking for clarification on some concepts: We have Triggers, Functions, Function Hooks, and Edge Functions. I thought Functions Hooks were basically triggers? but then what are
    Triggers
    ? And It seems like
    Functions
    are postgres RPC functions, but then what are Edge Functions?
    n
    n
    g
    • 4
    • 10
  • n

    Nin

    06/17/2022, 11:46 PM
    I'm trying to set up a multi tenant database and am trying to create a new tenant and a user whenever someone signs up. I'm struggling inserting data via a trigger on a new row in auth.users since I'm trying to insert data into two separate tables (tenants and users).
    n
    g
    • 3
    • 42
  • k

    kudziak

    06/18/2022, 5:13 AM
    Hi guys, do u know if there is any way to cascade deleting records from supabase with .delete().match() in javascript?
    n
    s
    • 3
    • 6
  • n

    Nin

    06/18/2022, 9:43 AM
    Trying to set up a RLS policy where if a column on another table contains the value NULL for the current user it gets allowed, otherwise it's not but I am having difficulties with setting up the policy. Anyone that can take a look with me?
    n
    s
    • 3
    • 5
  • s

    s c a p e g o a t

    06/18/2022, 10:45 AM
    Hi all, a question about the
    !inner
    join function in the JS client. Currently the data I get from the database is like the image on the left. The database returns me an array of object which contains another object called
    images
    with the
    url
    inside it. What I want to do is tell Postgres to return only array of
    urls
    from the the
    images
    table, which were obtained through the
    !inner
    join function via the table
    item_image
    . (Continue in the thread --->)
    n
    • 2
    • 5
  • a

    Albert [tox/cis]

    06/18/2022, 12:43 PM
    I can't fetch anything anymore. If I execute a simple query in the SQL Terminal in the supabase app, I get a
    An error has occured: Failed to fetch
    . Why is this happening?
    n
    g
    • 3
    • 17
  • c

    CEbbinghaus

    06/18/2022, 1:00 PM
    When self hosting Supabase the Supabase-db container takes up 10gb of the docker file which is half of my total capacity:
    n
    • 2
    • 8
  • h

    Haus Of Alejandro

    06/18/2022, 1:57 PM
    Hello everyone! how can I implement to login flow with magic link in "native" applications?, for example an ionic app, since the email link will just try to redirect to a web url, thanks in advance!
    n
    g
    • 3
    • 4
  • m

    MyNameUndefined

    06/18/2022, 3:39 PM
    getting error while changing phone number:
    n
    g
    • 3
    • 7
  • b

    Bicijay

    06/18/2022, 4:53 PM
    Hey guys, do you know what can be causing this error on my self hosted instance? 400 : Content-Type not acceptable: text/plain
    n
    • 2
    • 4
  • n

    Nin

    06/18/2022, 6:12 PM
    I'm creating an Edge Function and want to use the example where the auth context is set, however, whenever I pass an authenticated jwt token, the user object remains null. What am I doing wrong?
    Copy code
    const { user } = supabaseClient.auth.setAuth(req.headers.get('Authorization')!.replace('Bearer ', ''))
        console.log(user)
    n
    • 2
    • 3
  • r

    Rickert

    06/18/2022, 9:52 PM
    I'm getting a 403 on my local storage service (Docker). Request looks like this: http://192.168.1.119:5000/storage/v1/object/avatars/ Headers include authorization, apikey ( both ANON_KEY). I'm a bit clueless on this issue.. Everything looks fine in the config files. The fact that i'm getting a 403 indicates that the storage service is active and reachable. Anyone have any clue where i need to look? 🙈 The database and auth service work just fine.
    n
    g
    • 3
    • 16
  • a

    alejojm1201

    06/19/2022, 2:24 AM
    Hello, I am implementing Supabase with Angular and I use the Supabase API from Typescript, the problem that I am seeing is that when I want to use a Postgresql function that receives parameters, since the format of the parameters is a JSON, I observe that in the payload of the call to the API end-point that data is totally visible, therefore totally insecure... do you know if there is something that can be done so that it travels encrypted or something similar. Thanks for your time
    n
    g
    • 3
    • 19
  • d

    DanMossa

    06/19/2022, 2:41 AM
    When putting in the wrong password when connecting to the postgres database, i eventually get locked out ( which is good). How long until I can try to log in again lol?
    n
    g
    • 3
    • 11
  • s

    sascha

    06/19/2022, 9:43 AM
    Hey, supabase doesn't update this value in the email confirmation. Can someone help me?
    n
    g
    +2
    • 5
    • 11
  • p

    philnat0r

    06/19/2022, 11:43 AM
    Hi all. New to supabase here. I am trying to select from a table in the "public" schema, and join it to the users table in the
    auth
    schema, but I get an error. Query:
    Copy code
    let q = supabase
        .from<Message[]>('messages')
        .select('*, channel:channel_id(id, name), user:user_id(id, email)')
        .order('created_at', { ascending: false })
        .limit(100)
    Error:
    Copy code
    "Could not find a relationship between 'messages' and 'user_id' in the schema cache"`
    n
    g
    • 3
    • 3
  • b

    Baorong Huang

    06/19/2022, 1:23 PM
    Unable to deploy edge functions. Nothing happens after I enter "supabase functions deploy hello-world"
    n
    g
    • 3
    • 9
  • d

    Devowl

    06/19/2022, 1:32 PM
    Hello everybody, I was wondering what I did wrong that my database function. It seems not to show up in RPC. The function is as followed:
    Copy code
    create or replace function public.getDepotStats()
    RETURNS TABLE(id uuid, name varchar, number varchar, owner_id uuid, created_at timestamptz,totalExports bigint, totalGainLoss float) 
    language sql
    SECURITY INVOKER
    AS $$
    SELECT depots.id,depots.name,depots.number,depots.owner_id,depots.created_at,
         (SELECT COUNT(*) FROM depot_exports WHERE depot_exports.depot_id= depots.id) as totlaExports,
         (SELECT win_loss_amount FROM depot_exports WHERE depot_exports.depot_id= depots.id ORDER BY export_time DESC LIMIT 1) as totalGainLoss
          FROM depots
          ORDER BY depots.name;
    $$;
    Using Flutter/Dart as a client I get the message:
    Copy code
    PostgrestError (PostgrestError(message: Could not find the public.getDepotStats() function or the public.getDepotStats function with a single unnamed json or jsonb parameter in the schema cache, code: PGRST202, details: null, hint: If a new function was created in the database with this name and parameters, try reloading the schema cache.))
    Any suggestions, ideas what I did wrong?
    n
    g
    • 3
    • 17
  • n

    Nin

    06/19/2022, 3:14 PM
    When I do a setAuth with my service token the user remains null, what am I doing wrong? Also the Docs state there should be an error object but there doesn't seem to be one?
    n
    g
    • 3
    • 13
  • v

    Village

    06/19/2022, 4:52 PM
    Is there a way to inject securely store other data (app-specific auth stuff) in Supabase's JWT tokens?
    n
    g
    • 3
    • 4
  • n

    Nin

    06/19/2022, 5:16 PM
    I'm unable to create a simple if/else function in my database. If I use the example from postgresqltutorial.com it also fails. Any pointers would help..
    n
    g
    • 3
    • 10
  • k

    kirk douglas

    06/19/2022, 6:04 PM
    Hi guys, new to supabase. I have a table of profiles and one of my columns, 'ownedItems', is an array of JSON objects. I want to retrieve the rows from this table if a value, namely 'itemAddress', in the any of JSON objects in the array matches a parameter 'redeemedItemAddress' that I pass in. Any suggestions on how to do this?
    n
    g
    • 3
    • 5
  • n

    Nin

    06/19/2022, 8:05 PM
    I'm trying to access the invited_at column in a database function when a new user is inserted. I have an if statement that says
    if new.invited_at IS NOT NULL
    The if statement itself works fine, however, invited_at is checked and is seen as null even though it's not. Any clue what's happening?
    n
    s
    • 3
    • 16
  • n

    Nin

    06/19/2022, 9:30 PM
    How do I pass user_metadata when inviting a user? Following the docs I get to the following statement however it appears that the metadata isn't set:
    supabaseClient.auth.api.inviteUserByEmail('john.doe@example.com', {data: {first_name: 'John'}})
    n
    s
    • 3
    • 35
  • a

    astrotars

    06/19/2022, 10:24 PM
    Hi all 👋 I'm trying to find a tutorial or other resource on how to use the
    pg_sodium
    extension. The only thing I've been able to find is an announcement and how to enable. Do you happen to know if there are official docs or a tutorial somewhere that could help me out?
    n
    g
    • 3
    • 4
  • b

    Bicijay

    06/19/2022, 11:52 PM
    Hey guys, i have a weird case going on and i dont know if it is the expected behavior. When a user enters my app for the first time, he creates his account via Phone Auth, only with a OTP and without a password. He can however create a new password for his account (auth.update({password: '...'})) It works fine, i can see his password on my database, but when i try to login again with the same phone number without a password, it lets me login without errors. Is that the expected behavior in this case?
    n
    s
    • 3
    • 24
1...287288289...316Latest