https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How do you extend supabase without functions?
    t

    Thoth Trismegistus

    09/12/2022, 4:28 PM
    I am new to supabase. how do you add custom routes and custom functions to the app ?
    g
    o
    • 3
    • 7
  • Changing Team permissions for specific members and projects
    g

    gerry

    09/12/2022, 4:32 PM
    I'd like to give write access to only a few team members on our prod project, and give write access to all members on our staging project. (and give everyone read access to both projects)
    g
    • 2
    • 2
  • Auto Login
    p

    pvtctrlalt

    09/12/2022, 4:51 PM
    Hey, i have built a desktop app using electronjs and am looking to have it automaticly log in after the user has signed in once even after the user restarts there pc. I was looking at ways to store the login detials in there os specific creditional manager and load it in that way, is there any best practices for this?
    g
    • 2
    • 7
  • What data is processed outside of EEA?
    m

    mohammed-io

    09/12/2022, 6:17 PM
    https://supabase.com/docs/company/privacy#6-storing-and-transferring-your-personal-information In the privacy statement, it stats that there's some data is sent outside of EEA area to the US for example. What kind of data is that? Does it include our customers' accounts (registered with Supabase Auth)? Does it include our customers' data stored on Postgres? Considering that our project chosen datacenter is in EU central. Thank you, Mohammed A.
    g
    • 2
    • 4
  • RLS
    n

    ncbphi001

    09/12/2022, 7:59 PM
    I am working on an ecommerce website and I am having trouble with RLS. I have enabled RLS on an order_item table with the following columns: id,created_at, quantity, order_id & profile_id. The profile_id column maps to the user's id from the auth table. I have enabled read access based on the following statement: auth.uid() = profile_id however when I query the order_item table with the right user I am still getting an empty array. I am using NextJS
    g
    • 2
    • 5
  • authListener.unsubscribe is not a function
    f

    flixoflax

    09/12/2022, 9:01 PM
    Hiya! I am new to supabase and I am trying to implement it with NextJs and already found some helpers (https://supabase.com/docs/reference/auth-helpers/next-js). However, I always get this error from the UserProvider component:
    Copy code
    Uncaught TypeError: authListener.unsubscribe is not a function.
    Can somebody help me with this? Thank you very much. I am using typescript btw.
    g
    • 2
    • 2
  • Self-Hosted CORS Error on storage API requests
    p

    pasha_dee

    09/12/2022, 11:32 PM
    hey guys, maybe one of you guys can point me in the right direction with an issue I am having.. developing an app locally with sveltekit (localhost:5173), using the self-hosted supabase deployment over the internet (vps) .. added the localhost:5173 to "additional sites" in the .env for docker, which allows me to authenticate. Ran in to an issue when following the "avatar" tutorial in the supabase docs.. when I go to upload to supabase VPS I get a CORS error.. so obviously whatever handles auth for storage does not permite any requests from "localhost" ... any idea on how to work around or configure this so I can add localhost to the allowed origins?
  • Table editor in app.supabase.com not showing data in the order inserted
    m

    maglev

    09/13/2022, 1:46 AM
    Hi, it might not be much of an issue in practice since the data can be ordered in the request, but is data in the table editor view supposed to be unordered even if each row is inserted sequentially? Thanks.
    t
    g
    • 3
    • 6
  • Getting 502 ORIGIN_BOOT_RPC_ERROR Error when calling Edge Function
    s

    shrey

    09/13/2022, 3:15 AM
    I just deployed a new edge function but I get a 502 ORIGIN_BOOT_RPC_ERROR when I attempt to invoke it. According to this link it seems my bundle size may be too large: https://github.com/supabase/supabase/discussions/6710 Wanted to check how I can find the size of my Deno bundle?
    • 1
    • 1
  • Question about writing database functions in plpgsql.
    s

    Spartan

    09/13/2022, 4:48 AM
    Hi I am new to plpqsql and hope to understand functions. I currently have a function called
    insert_document_contributor_by_update_documents
    which is triggered, as the function states, by an update in the
    documents
    table. This is the current version of the function.
    Copy code
    plpgsql
    begin
      insert into public.document_contributor(document_id, contributor)
      values(new.id, new.created_by);
      return new;
    end
    But I want to check if the
    document_contributor
    table has an existing record with the match of
    document_id
    and
    contributor
    . Fyi, the
    document_contributor
    table is a join table that consists of only two columns stated above,
    document_id
    and
    contributor
    , and uses both of them as a composite primary key. How do I add a condition and modify the function to my needs?
    • 1
    • 2
  • Storage - Flow for creating profiles, then uploading assets that are assigned to posts.
    l

    LeoSonnekus

    09/13/2022, 5:35 AM
    Hi I'm building a platform for selling art and I'm planning on doing the following - Users create accounts which create new row in 'profile' table - Users create new row in 'artworks' table, one profile can have multiple artworks associated with it, to display as a collection of posts or works created by that artist (Displayed as a profile with subpages for each post on the front end) - Other Users can "collect" or "Favourite" or "Like" posts by other users to be displayed on their profiles as references I'm displaying this data via a NextJs Front end and it's going well but I haven't handled Asset storage much and naively thought I could add a column to each post row that would accept assets as an input. So what I'd like to know is what is the general flow for linking storage assets to rows? Any additional advice or resources would be really appreciated
    g
    • 2
    • 4
  • RLS on UPDATE `WITH CHECK` call function using new row data?
    n

    nickreed

    09/13/2022, 6:14 AM
    In the WITH CHECK part of an UPDATE when using RLS, how do I pass the incoming/new row data to a function? (or do I need to simply list every column?) I tried
    my_function(new)
    but get an error that "new is not a column".
    my_function(*)
    also did not work. My function is pretty simple (docs is the name of the table):
    Copy code
    create or replace function public.my_function(docs) 
    returns boolean as $$
    begin
      return true;
    end;
    $$ language plpgsql security definer;
    g
    • 2
    • 7
  • How can I use a join table to then select from a 3rd table
    l

    lewisd

    09/13/2022, 7:21 AM
    Hi guys, im migrating from firebase so im used to noSQL, so im looking for the best way to achieve the following: I have a
    listings
    ,
    listingLikes
    and a
    userData
    table. I have the very standard setup of when a user likes a listing, a
    listingLikes
    row is created connecting the
    listing
    and the
    userData
    .
    listingLikes
    just contains a
    listingId
    and a
    userId
    Using
    supabase-js
    how can i say "Go find all the
    listingLikes
    that has this
    listing
    as the
    listingId
    , then get all the
    userIds
    and select them from the
    userData
    table?
    • 1
    • 2
  • How can I flatten my join response?
    l

    lewisd

    09/13/2022, 9:12 AM
    Copy code
    const { data } = await supabase
            .from("listings")
            .select(`*, sellerData:sellerId(*), listingLikes(userData(*))`);
    listingLikes
    returns an array like so:
    [{userData: {...data}},{userData: {...data}}]
    whereas I would like to just have:
    [{...data}, {...data}]
    s
    g
    • 3
    • 11
  • Can login from urls other than the specified site url
    g

    garyaustin

    09/13/2022, 1:28 PM
    As discussed in the other thread, No way to set CORS domains and SiteURL is mainly used for redirect validation.
  • Filtering by last hour in select()
    r

    Rían

    09/13/2022, 10:39 AM
    Hi there, I'm trying to use filters in the select with a boolean expression similar to the stories RLS example here: https://supabase.com/docs/guides/auth/row-level-security but it seems to be invalid? is this the wrong way to go about this? I have a table called submissions in which I have a content field (arbitrary text) and created_at (now() timestamp) and I'm trying to match all submissions with the same content in the past hour (kind of a duplication check) Here's how I've attempted to do it
    Copy code
    js
        const { data } = await supabase
            .from("submissions")
            .select("content, created_at")
            .gt("created_at", "current_timestamp - interval '1 hour'")
            .eq("content", post);
    g
    • 2
    • 2
  • Can anybody spot why my realtime is not firing?
    l

    lewisd

    09/13/2022, 10:57 AM
    I wanna get user data and also listen to any changes for a specific row.
    Copy code
    userDataSubscribe = supabase.from(`'userData:id=eq.${currentUser.id}'`)
            .on("*", (payload) => {
              console.log("Change received!", payload);
            })
            .subscribe();
    It never fires. I've attached my
    userData
    table
    m
    • 2
    • 5
  • How to block all Domains that are not mine from accessingpostingdeleting Data
    s

    Shecky

    09/13/2022, 11:31 AM
    Hi, i am confuesd with the row level security part. So right now any dummy can go to my code, steal the Supabase key and can access all data from database on his website. How can i stop that? I want only my domain to have access to all the data
    m
    a
    g
    • 4
    • 71
  • Generated definitions and updating to null
    m

    MrGandalfAndhi

    09/13/2022, 11:36 AM
    Hey, I'm trying to update certain columns to null, but the generated table definitions define the types of my nullable columns as
    <column type> | undefined
    . When using undefined as a value in an update to set the column to null it is omitted and thus not updated at all. I am able to set it to null by explicitly setting the value in the update object to null, but this causes typescript to complain about mismatched types. What's the suggested way of handling updates to null while using typescript with the generated definitions?
  • Many to Many link only working one level
    d

    DesertRodent

    09/13/2022, 1:20 PM
    I have the following structure:
    Copy code
    - Muscle_Regions
    - Muscle_Region_Muscle_Parts (M:M)
    - Muscle_Parts
    - Muscle_Parts_Mucles (M:M)
    - Muscles
    From a region level i am able to list all the muscle parts with the following query:
    Copy code
    let { data: muscle_regions, error } = await supabase
        .from<MuscleRegion>('muscle_regions')
        .select('*, muscle_parts (*)')
    but when i try to do the same thing on the muscle_part level i don't get any results... If I try this query it doesn't error but it doesn't show me any muscle results:
    Copy code
    let { data: muscle_regions, error } = await supabase
        .from<MuscleRegion>('muscle_regions')
        .select('*, muscle_parts (*, muscles(*))')
    I have created composite keys and assigned them to the correct tables its just not rendering Any clues?
    g
    • 2
    • 62
  • [Updated] How to get correct types for nested fields without losing types for main object
    g

    garyaustin

    09/13/2022, 4:45 PM
    Maybe this is of help, I don't use typescript though... https://supabase.com/docs/reference/javascript/next/typescript-support#nested-tables
    o
    a
    • 3
    • 2
  • How would you store the total amount of points given to another user
    l

    lewisd

    09/13/2022, 2:39 PM
    I've come from firebase and my original structure was to store a field on my
    userData
    called
    points
    . When a user gives another user points, this amount increments by 100. I would then have a field called
    pointGivers
    where I would store the givers user data + how many points they have given in total. I'm trying not to go back to my noSQL ways so how would you best do this? Would the most sensible thing be to join users and their point givers via a table. In that table we'll store the givers data and the amount of points given and I'll just query that, or would you more SQL experienced guys also have a
    totalPoints
    field stored on each users row.
  • Add phone auth to existing email auth user
    k

    kaaloo

    09/13/2022, 4:06 PM
    Hi, I'm trying to add a phone number to an existing email auth user through the auth.update() function, but when I call auth.verifyOTP() I get a message back stating "User not found". This makes sense because I don't call auth.signUp since the user is already signed up via email. Is it actually possible to implement this flow?
    g
    • 2
    • 2
  • Recommended ORM for supabase + Dart Flutter
    b

    brassknucklenerd

    09/13/2022, 4:39 PM
    Hi all, I’m building a Flutter app that will have some straightforward (one-to-many, many-to-many, etc.) but important relationships. Setting up constraints and foreign keys etc. in the PostgreSQL database itself isn’t a big issue (though I would like to use migrations rather than write SQL scripts manually, for CI/CD purposes) I’m trying to decide how to represent the models and relationships in the code. Is there a recommended Object-Relational Mapping package that will work with Dart and supabase? Does supabase have methods that encapsulate more complex queries? My other option is to write the methods myself and split them up between the models and the repositories, but I’d rather use an existing package for this if it saves time. Some options I’ve seen in the community: - Prisma - Dart Jaguar - use the supabase built-in methods with custom PostgreSQL functions ORMs/ODMs with which I’m familiar from other projects: - ActiveRecord (Ruby on Rails) - Eloquent (PHP) - mongoose (mongodb and Node.js) Is there enough out of the box with supabase to just use the built-in methods and add my own model methods and repositories, or is there an ORM that pairs well with supabase and Flutter? Do we have best practices around this yet? Thanks!
    h
    • 2
    • 6
  • Transfer project to a different organization
    m

    mejiasdev

    09/13/2022, 4:39 PM
    Hi, I started a project using my personal organization and now I want to transfer this project to a new organization, is this possible? or do I need to manually transfer the data?
    m
    g
    • 3
    • 2
  • http_post not working while http_get is fine
    n

    nickreed

    09/13/2022, 5:33 PM
    Queries using http_get work:
    Copy code
    select content::json->>'allowed'
      from http_get('https://jsonplaceholder.typicode.com/todos/1');
    but http_post fails:
    Copy code
    select content::json->>'allowed'
      from http_post('https://jsonplaceholder.typicode.com/todos/1',
        jsonb_build_object('test', 'test')
      );
    with errors:
    Copy code
    hint: "No function matches the given name and argument types. You might need to add explicit type casts."
    
    message: "function http_post(unknown, jsonb) does not exist"
    I don't understand why/how casting is failing, and why get works but not post?
    s
    • 2
    • 3
  • Foreign key from Prisma table to auth.users
    a

    anderjaska

    09/13/2022, 5:40 PM
    Hello! When I run this sql query, I get an error:
    Copy code
    ALTER TABLE "User" ADD FOREIGN KEY ("id") REFERENCES "auth"."users"("id");
    results in:
    Copy code
    Failed to run sql query: foreign key constraint "User_id_fkey" cannot be implemented
    I think the error may be on prisma, is this something that cannot be done? The goal here is that I want to delete a db entry when an auth user is deleted -> perhaps a trigger is more appropriate? Thanks!
    g
    • 2
    • 2
  • Solved
    j

    Jakob

    09/13/2022, 7:07 PM
    Ok I believe the issue was that my JWT expiry limit was set so low
    m
    • 2
    • 5
  • Best way to add geo location?
    d

    DevThoughts

    09/13/2022, 6:16 PM
    how to add column in database for the location that later i can get for google maps?
    j
    f
    +2
    • 5
    • 9
  • Shared Data Example
    b

    BoogersLLC

    09/13/2022, 6:45 PM
    Hello, I'm coming over from Firebase and haven't worked with Data Models like this in a while (Or RLS at all really). I'm trying to make a contrived example of sharing data between users to better understand how to model a real world project. So imagine I have `Users`: A, B, C. and a another table
    Blogs
    User A
    creates
    Blog X
    User A
    invites
    User B
    to able to SELECT/UPDATE to
    Blog X
    and invites
    User C
    to only be able to SELECT from
    Blog X
    --- Is this something that I would handle with RLS? Does anyone have any examples that could get me going in a direction? I've read through [auth policies](https://supabase.com/docs/learn/auth-deep-dive/auth-policies) but most examples like this one seem to be somewhat static (the email
    @blizzard
    isn't something one user could assign/share to another) I'm guessing I may need to add a new role? But I'm not sure how to do that on a many-to-many relationship. i.e. Many users will have different access to many blogs. Also, to reiterate, Blogs is just a contrived example. Imagine this scenario with anything. Chat rooms, Trello cards, Google Docs, etc...
    g
    • 2
    • 2
1...212223...230Latest