https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How to filter a jsonb[] array by index?
    s

    stevenbdf1

    01/10/2023, 7:24 PM
    In my table I have a column named "status" of type
    jsonb[]
    (important, the column is not
    jsonb
    ) and I store objects of the following shape.
    [{"status":"pending","response":null,"created_at":"2023-01-10T17:45:11.824Z"}]
    I have built this PostgreSQL Query that looks for the records which their first element in the status array is status = ''pending".
    SELECT status FROM queue_events WHERE status[1]->>'status' = 'pending'
    I want to run this query using
    supabase-js
    . I have tried
    const { data } = await supabase.from('queue_events').select('status').eq("status[1]->>'status'", 'pending');
    But it returns
    null
    . Does the javascript client supports queries like these? If not, is there a way to run a plain SQL query?
    p
    g
    • 3
    • 3
  • invalid input syntax for type uuid
    s

    stillmotion

    01/10/2023, 7:35 PM
    Having issues deleting rows via a foreign key.
    Copy code
    const { error: pagesError } = await Supabase.from("pages").delete().eq("story_id", id).select()
    Error:
    Copy code
    invalid input syntax for type uuid: \"story-xjYRGelSlIQsIuxCNtLIF\"
    story_id is a text column and the PK of the story
    id
    column is text also. I am not using UUIDs in the current version of this table (I was previously, but dropped the table and created a new one with the same name). RLS is disabled.
    g
    • 2
    • 8
  • Order by multiple columns
    x

    Xki

    01/10/2023, 7:45 PM
    I want to order my list after multiple columns, first order column A then order the duplicates that have the same values with column B
    g
    • 2
    • 11
  • How to delete an edge function?
    s

    shashankdaima

    01/10/2023, 7:52 PM
    Hey I was trying edge functions. So, I got 2 issues while using your cloud functions. 1.
    supabase functions delete hello-world
    is not working. giving
    Error: Cannot find project ref. Have you run supabase link?
    . What to do in such case. 2. redeploying command is updating the version of cloud function on web-ui but running the curl command is not showing updated results. thanks.
    g
    • 2
    • 9
  • How to set a custom invite email template when running locally through CLI?
    k

    kjames

    01/10/2023, 8:38 PM
    I want to use a custom email template locally while developing. If I understand correctly, since I'm using the CLI my config goes in
    config.toml
    But I'm not sure if there are
    config.toml
    variables for setting custom email templates, and if so what they are called?
    s
    • 2
    • 1
  • What are some performance improvement you can do to API's that have the highest usage?
    v

    Vik

    01/10/2023, 10:22 PM
    I'm curious on what kind of performance improvements can be made to certain API's that receive the most usage. For example, I have a search API that get's hit a lot because people want to search for their friends. Using React Query I can cache most results for the users and keep them good for 20~ seconds or so to reduce the amount of times the API is hit. But, if many users are hitting the same API this doesn't matter. What can be done or kept in mind when developing such API's?
    a
    • 2
    • 2
  • Foreign keys query broke down?
    u

    urth

    01/10/2023, 11:50 PM
    Copy code
    let user = await supabase.from('users').select(`
        id,
        username,
        email,
        created_at,
        steam_id,
        stats (
            *
        ),
        flags(
            *
        ),
        friends!friends_user_id_fkey (
            friend_id,
            user_id,
            status,
            user:users!friends_user_id_fkey (
                username
            ),
            friend:users!friends_friend_id_fkey (
                username
            ),
        ),
        `).eq('username', username).single();
    Hi, were there any updates to the supabase? I can swear that this code used to work as is up to a week ago
    g
    • 2
    • 6
  • realtime with live chat app
    g

    Gregory

    01/11/2023, 12:38 AM
    with realtime, how does it work when i'm going to have a bunch of distinct chat rooms all receiving live chat messages? is it okay if all those messages share the same table, or should i be handling it differently? it seems like every chat room is going to get updates when a different chat room receives a new message. Does that cause me to use up all of my real-time allotment? Thank you
    g
    • 2
    • 4
  • textSearch not working
    l

    lyu

    01/11/2023, 1:00 AM
    This is my sql
    Copy code
    select
      *
    from
      profiles
    where
      to_tsvector(title) @@ to_tsquery('Smith');
    and there's definitely a row with title column containing
    Smith
    But when I run it in supabase SQL Editor it returns empty result. Does anyone know the reason? Thanks
    j
    • 2
    • 2
  • How to play a video on a private bucket without downloading?
    v

    VimHax

    01/11/2023, 2:21 AM
    I have a bucket which has RLS policies for which users can access the data in it, including videos. I want to know how you can play a video on the browser without downloading all of it. I'm assuming
    supabase.from(...).download(...)
    actually fully downloads the video and you won't be able to see it until it does so. And for
    supabase.from(...).createSignedUrl(...)
    my issue is that this will allow anonymous users to view the video temporarily and that the video will only be watchable for the time allocated. (which may be too much or too little) I want an experience like private YouTube video where only you can see it and you can watch it for as long as you wish anytime without downloading it.
    g
    • 2
    • 17
  • Can check constraints be viewed in the Supabase table GUI?
    j

    jinsley8

    01/11/2023, 2:23 AM
    I added check constraints to some table rows by adding them with a SQL query. Is there any way currently to view these in the table GUI?
    g
    • 2
    • 1
  • Invalid login credentials even though theyre valid?
    s

    salzar

    01/11/2023, 2:49 AM
    Im having trouble getting sign in to work on my site using the auth UI. made an account and I know the credentials are correct, but its giving me this
    g
    u
    • 3
    • 8
  • RLS not letting me update profile (following egghead and Supabase video guide)
    c

    Cabtn

    01/11/2023, 4:47 AM
    Hey all, I'm following the guides here (https://egghead.io/lessons/supabase-implement-authorization-using-row-level-security-and-policies) and here (https://supabase.com/docs/guides/auth/row-level-security) I've create a profile table that has a relation with the supabase auth table but I'm unable to update it with my stripe info. It works fine if i disable RLS so i know it isn't my client logic. My policy is simply set to ALL and i am doing:
    auth.uid = id
    . Any ideas of what I'm doing wrong here?
    u
    g
    n
    • 4
    • 24
  • Empty array when trying to list bucket and access one
    s

    salzar

    01/11/2023, 5:13 AM
    Hi, i have some code that is trying to list all buckets in a project and list files in a bucket. The response code is 200 but the array returns 0. The buckets are also set to public. How can i get this to work?
    g
    • 2
    • 37
  • Using DB & Storage REST API on Github Actions
    a

    anggoran

    01/11/2023, 6:31 AM
    Hello would like to ask about this topic. So, in Supabase Docs, we have this example for calling REST API.
    Copy code
    pwsh
    # Append /rest/v1/ to your URL, and then use the table name as the route
    curl '<SUPABASE_URL>/rest/v1/todos' \
    -H "apikey: <SUPABASE_ANON_KEY>" \
    -H "Authorization: Bearer <SUPABASE_ANON_KEY>"
    And in the supabase github action example, we have this example.
    Copy code
    yaml
    env:
      SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
      SUPABASE_DB_PASSWORD: ${{ secrets.STAGING_DB_PASSWORD }}
      PROJECT_ID: cimpzzikygouamvsjwxa
    
      steps:
        - uses: actions/checkout@v3
    
        - uses: supabase/setup-cli@v1
          with:
            version: 1.0.0
    
        - run: supabase link --project-ref $PROJECT_ID
    My questions are: 1. Should I use
    Service Role
    or
    Access Token
    in Github Actions? 2. Where can I find the endpoints for database and storage?
    g
    • 2
    • 4
  • Realtime performance
    v

    VimHax

    01/11/2023, 7:27 AM
    1. Are all subscriptions routed through one WS connection? I'm assuming it is for performance reasons. 2. Is it a bad idea to have possibly 100s of Realtime subscriptions to the DB? 3. Is there a big performance difference (i.e. worse) selecting to listen to multiple records on the DB with RLS (basically restricting access to the record changes that I care about) vs having multiple subscriptions where each are selecting a specific ID of a record in the DB. Example:
    Copy code
    js
    db.on(
        'postgres_changes',
        {
            event: 'UPDATE',
            schema: 'public',
            table: 'projects'
        },
        (payload) => { ... }
    ).subscribe();
    vs
    Copy code
    js
    db.on(
        'postgres_changes',
        {
            event: 'UPDATE',
            schema: 'public',
            table: 'projects',
            filter: `id=eq.1`
        },
        (payload) => { ... }
    ).on(
        'postgres_changes',
        { filter: `id=eq.3` },
        (payload) => { ... }
    ).on(
        'postgres_changes',
        { filter: `id=eq.3` },
        (payload) => { ... }
    ).subscribe();
    4. Is it possible to listen to updates to objects in storage with Realtime? (no file name changes, upserts) My goal is to have virtually all user content be updated in realtime for all users on changes.
    g
    • 2
    • 4
  • Best practices for Images stored in Buckets and fine grained usage insight
    l

    legousk

    01/11/2023, 7:50 AM
    Hello, I am developing an app where users can see and vote on images. I thought I was doing a pretty good job, but I recently stumbled upon the storage usage in Settings -> Usage -> Storage. And my current usage is about 9.5GB out of the allowed 2GB allowed on my Storage Egress (I am still in the free tier). I have a couple of questions: - Storage Egress is when I post images in my Buckets and then retrieve them right? - Will I be billed for this 'overusage'? Or how does that work? Estimated costs are still at 0 for the period. - I get 2GB free every month right? Or is that total? Although the first options seems to be logical, I cannot seem to find anything about it. Just a check. - How can I get better insight in my usage? How often are the reports updated? I just made some actions that should use some storage egress, but the report does not show anything for today. - When a user uploads an image, I already compress it quite a bit. Is there a blog post from Supabase how to best handle storage egress requests? Or maybe some best practices? I don't need you to copy the internet as I can, and already have, found quite some stuff myself. But again, I thought I was doing a good job but it seems that I am already encountering some overusage, even in the development phase. I am totally willing to pay for Supabase if the service and my usage requires it. But I am quite surprises that I am already using so much, that is why I ask those questions.
    g
    • 2
    • 2
  • download a file -- Flutter -- not working ??
    b

    boeledi

    01/11/2023, 9:23 AM
    Hello, I am trying to download a file that exists in the storage bucket (using: await Supabase.instance.client.storage.from(sourceBucketName).download(sourceFilename)) I receive an answer "StorageException(message: The resource was not found, statusCode: 404, error: Not found)" Having a look at the logs on Supabase, I see that the GET request includes an extra "/info/" Example: /object/info/translations/locale_en.json -- Similarly, when I try to get the list of files (using: await Supabase.instance.client.storage.from(sourceBucketName).list()), I also get the same error and the logs also contains the extra "/info/". -- However when I am invoking the getPublicUrl, it works: "await Supabase.instance.client.storage.from(sourceBucketName).getPublicUrl(sourceFilename)" -- Am I doing anything wrong?
    a
    • 2
    • 11
  • CMS - should I go from the ground?
    b

    brguy

    01/11/2023, 9:53 AM
    This is a business/software architecture question. I wanna build a techmeme clone (http://www.techmeme.com/), basically a simple cms with several links inside of it and the frontpage is a page like on a CMS. Plus some features like user authentication and profile page. What would be a nice way to approach this? Should I build it all on supabase? Or should I use a CMS on top of it? What would be an ideal DB architecture? What are good practices regarding supabase and CMS approach.
  • I'm trying to build a dashboard with live graphs
    a

    AbdallahZ

    01/11/2023, 10:02 AM
    Is there an example of supabase with live graphs I can check out?
    g
    j
    • 3
    • 4
  • Best approach for a booking system
    s

    ShaneJones

    01/11/2023, 11:04 AM
    I am currently building a basic booking system for one of my clients who is on GatsbyJS. I have the tables mostly set up and now I'm working on the availability check side of things which will query the Subabase tables to see if a specific date range is available and return a list of the rooms which are free between those dates. I was wondering if this check is best implemented as an edge function on the Supabase side or would this be something I'd create on the Netlify side. Or does it even matter where it lives?
    g
    a
    • 3
    • 2
  • Different User Roles
    e

    Esore

    01/11/2023, 1:18 PM
    Hello, I am trying to figure out a way to do the following. 1) The initial login makes a user an owner of an organization. 2) The owner of the organization can invite others into their organization that make them admins, but not owners. 3) The admin's access roles can change based on different levels. Is there any documentation or resources that can be shared to approach this?
    g
    • 2
    • 2
  • Best practices for storing images and retrieving them
    c

    cryptoneur

    01/11/2023, 3:24 PM
    I am having a table where I store some sort of profile picture and other info, e.g. - name: VARCHAR - logo: Relationship pointing to object ID in storage bucket I uploaded pictures to storage bucket and then inserted the ID Into the logo column. Now I am struggling using the JS SDK to retrieve it. What's the easiest way? Or should I store right away the URL in the column?
    g
    • 2
    • 9
  • Can anyone help me in enabling OAuth2 with KakaoTalk? (Korean Chat Service)
    e

    EvanJ

    01/11/2023, 4:00 PM
    I'm currently using wized and I'd like some help integrating KakaoTalk OAuth2
  • Nextjs server component setup need help
    s

    salzar

    01/11/2023, 4:16 PM
    Hi, im following this doc to get authentication setup with nextjs. https://supabase.com/docs/guides/auth/auth-helpers/nextjs-server-components Im having trouble figuring out where to put the code i screenshotted. Does that just go anywhere i want to valid the session, or should I create a new file?
    g
    • 2
    • 10
  • Limit storage upload file size
    h

    Huntedman

    01/11/2023, 4:19 PM
    Hey, Any ideas on how to limit file size when uploading files to storage? My initial idea was to use RLS on storage.objects insert, and parse the metadata jsonb ? Another option would be to use trigger on storage.objects before insert, to discard files that are too large? Any convenience methods that could help me out here?
    g
    • 2
    • 4
  • Getting user from supabase in Next.js API routes
    t

    TheOriginalDude

    01/11/2023, 5:22 PM
    Hey there, I'm building an App that requires the current logged in
    user
    from supabase, in the serverless API routes. I've noticed people use the
    supabase.auth.api
    API to set the cookie and get user by cookie, but it doesn't seem to work anymore. What's the workaround/fix to achieve so?
  • Error 500 when signup a new user. No confirmation email
    p

    petoma

    01/11/2023, 5:51 PM
    I am sorry if the question is not precise but as I don't know exactly where the error comes from, I am not able to specify more. I am having a 500 error when a new user signUp. Thing is that I have two projects, both of them use Supabase and I have almost identical code and auth components. One of them works perfectly fine and the other one is throwing me the 500 error. I have checked in Configuration in Supabase that I have things appropriately configured and it seems as they are. Then, in my code I have a Register page where the user provides the email and password to send to the auth helper but I don't get any data from Supabase, so no id to move on with the process. In the other project I do receive the user (not the session) and the confirmation email. Let me provide some code, but if you need any other piece of the code just let me know. This is what I have in providers.js:
    Copy code
    export const registerUserWithEmailPassword = async ({ email, password }) => {
    
        try {
            let { data, error } = await supabase.auth.signUp({ email, password })
            console.log( data )
    
            return {
                ok: true, data, error
            }
    
        } catch (error) {
            console.log(error);
            return { ok: false, errorMessage: error }
        }
    }
    This is what I have in thunks in my store:
    Copy code
    export const startLoginWithEmailPassword = ({ email, password }) => {
        return async( dispatch ) => {
    
            dispatch( checkingCredentials() );
    
            const { ok, data, error } = await loginWithEmailPassword({ email, password })
            
            if ( !ok ) return dispatch( logout( error.message ) );
    
            console.log(data)
            dispatch ( login( data ));
    
        }
    }
    And this is a hook that I have to listen for auth changes: Any guide will be appreciated. Thanks!
    g
    • 2
    • 11
  • Can't access auth.users.raw_app_meta_data in on_auth_user_created trigger
    c

    coker

    01/11/2023, 6:59 PM
    I've implemented this trigger (https://database.dev/handle-new-user) but have data that should not be stored in the
    user_metadata
    . Specifically, I have a
    client
    string value stored in the
    app_metadata
    , but when I use the following logic:
    Copy code
    pgsql
    begin
      insert into public.profiles (id, email, client)
      values (new.id, new.email, new.raw_app_meta_data->>'client');
      return new;
    end;
    the
    profiles.client
    column null for all rows. How can I retrieve this client value in my triggered function? Its worth noting that I tested this out, and instead stashed the
    client
    value in the
    raw_user_meta_data
    property, and was able to retrieve it just fine. I just don't want to store this value in the user's metadata.
    g
    u
    • 3
    • 16
  • Downloading or viewing an edge function that has been deployed
    l

    LarryPotato

    01/11/2023, 7:00 PM
    Hello, I'm an idiot 🙂 I accidentally removed my local code, before committing it to Git. Is there any way I can download/edit/view the contents of index.ts on an edge function, that I deployed earlier? Thank you in advance 🙂
    g
    • 2
    • 1
1...949596...230Latest