https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How to delete files in a bucket using SQL?
    b

    Baorong Huang

    04/29/2023, 2:58 AM
    I have a table called
    photos
    which has a column called
    photo
    that is the path in my bucket called
    photos-bucket
    . I created a trigger that will be executed after DELETE on the
    photos
    table, the privilege is set to invoker. The problem is that it returns me an error 'column "bucket_id" does not exist'
    Copy code
    sql
    
    CREATE OR REPLACE FUNCTION public.delete_photo_in_bucket()
     RETURNS trigger
     LANGUAGE plpgsql
    AS $function$
      begin
        DELETE FROM storage.buckets
        WHERE bucket_id = 'hao-duo-zhao-pian' AND name = OLD.photo;
        RETURN OLD;
      end;
    $function$

    https://cdn.discordapp.com/attachments/1101704023293304962/1101704023482060840/image.png▾

    g
    • 2
    • 13
  • uploadToSignedUrl with a regular fetch (post,put) request possible?
    m

    mtin79

    04/29/2023, 8:05 AM
    Hi supabasers, I was very happy to find out that supabase now supports signed urls for uploading and retrieving documents. My Question: After creating a signed url for upload via supabase server clients (using remix-auth-helpers), is it possible to use the url and token to upload the files content via fetch request or axios and not use the supabase client for that? as i don't necessarily need the auth here as the signed url is only send back if the client was authorized in the beginning. In general i still struggle a bit with the mental model what the supabase clients (on client and server) do differently compared to a prisma client in terms of connection pooling and if i can use them side by side if needed. For example the fetching and querying complex relationships with the supabase clients seems not that sophisticated as using the prisma query api. but maybe its just my knowledge about how to use it. thanks for any help or hints.
    g
    • 2
    • 1
  • getSession is not a function
    s

    silentworks

    04/30/2023, 2:02 AM
    I can't replicate this from following the guide. Can you create an example repo with your code where it can't find the
    getSession
    so I can take a look please?
  • Failed to run sql query: must be owner of event trigger pgsodium_trg_mask_update
    i

    imousart

    04/29/2023, 10:33 AM
    trying to add table and function
  • OAuth sign in does not work with Firefox
    u

    !Stan_---__-

    04/29/2023, 10:42 AM
    Hi there! My OAuth sign in (Google and Github) does not seem to work on Firefox. I have tested on Chrome, Opera and Edge, all of which work as intended. This issue also happens to my 2 other teammates therefore ruling out the possibility of it being a problem with my personal browser/pc. I can self-host and provide the link if anyone is interested and would like to test for themselves, just let me know. I notice that after the OAuth provide action button is clicked, the access token appears in the url fragment for a brief second, disappears as usual, but does not redirect me to my home page (which it should if there is a valid session, my middleware checks for this). Thanks in advance! (Working with Next.js, using the next and react auth helper libraries)
    j
    • 2
    • 2
  • Forgot Password in React Native CLI
    m

    Merovingian

    04/29/2023, 10:47 AM
    Hi, I want to create Forgot Password screen and Update Password screen in React Native CLI. After creating linking configuration ( because it must be with deeplinks). I have tried on my applications linking configuration. Smth. like this:
    Copy code
    export default {
      prefixes: ['myapp://'],
      config: {
        screens: {
          AuthStack: {
            screens: {
              Login: 'login',
              Register: 'register',
              ForgotPassword: 'forgot-password',
              UpdatePassword: 'update-password',
            },
          },
        },
      },
    };
    then i am trying to see uri-scheme is okay? And I am running this command on terminal:
    Copy code
    npx uri-scheme open "myapp://forgot-password" --ios 
    npx uri-scheme open "myapp://forgot-password" --android 
     npx uri-scheme open "myapp://update-password" --ios  
    npx uri-scheme open "myapp://update-password" --android
    yes, I can navigate in that screens when i call these commands. There is the problem: When i trying to use after initialized. I am writing my email on my forgot password screen. Then i push the button. It showes me an alert which is related success. Then I go to the mail, I can see like that URL:
    Copy code
    projectURL.supabase.co/auth/v1/verify?token={token}&type=recovery&redirect_to=myapp://update-password
    Here it comes: When i push that button, Safari says, Do you want to open "myapp" , after click yes button, every time showes me login screen. I can't handle it. It makes me feel fool. Please help me. This is my forgot-password & update password codes. I also write my url configurations on supabase . You can look comments for codes.
    s
    • 2
    • 14
  • Check if user can insert into table when user_id is array (using Clerk Auth)
    o

    O.Little

    04/29/2023, 11:16 AM
    I've followed this tutorial: https://clerk.com/blog/nextjs-supabase-todos-with-multifactor-authentication I have a column with an array of user_ids, and I'm using `requesting_user_id()`to set default value when inserting. But when I try to create a policy using
    (requesting_user_id() = ANY(user_ids))
    I get an error that the insert request violates RLS policy. Whats the correct way to write this policy?
    g
    • 2
    • 2
  • Valid JWT token in GoTrue signInWithIdToken returns invalid request
    c

    cuca

    04/29/2023, 12:01 PM
    Hi! I'm trying to authenticate through signInWithIdToken (GoTrue) with a valid JWT that I've got from apple sign in. However the response is invalid request, id_token required. However I do have a valid JWT token. I suspect this is a configuration issue on supabase or apple developer account.

    https://cdn.discordapp.com/attachments/1101840666100772945/1101840909961789510/Screenshot_2023-04-29_at_13.02.04.png▾

    j
    m
    • 3
    • 8
  • Querying a column JSONB
    s

    SunTzu

    04/29/2023, 12:22 PM
    Copy code
    code
    : 
    "42883"
    details
    : 
    null
    hint
    : 
    "No operator matches the given name and argument types. You might need to add explicit type casts."
    message
    : 
    "operator does not exist: jsonb ~~ unknown"
    Im receiving the above error when I try to do what I think is a simple query? ``const checkDocs = await supabase .from("embeddings_tensorflow") .select("*") .like("metadata", { id: "doc20" });``
    g
    • 2
    • 3
  • Add custom domain from CloudFlare
    v

    VuNguyen

    04/29/2023, 12:40 PM
    I'm trying to add a custom domain to Supabase, but when it comes to adding CNAME to the domain, cloudflare keep removing the dot in the end of the original URL, which probably make it doesn't work.

    https://cdn.discordapp.com/attachments/1101850580164558958/1101850580462338079/image.png▾

    • 1
    • 5
  • Having an error when trying to commit remote database migrations
    k

    Kyle Parkin

    04/29/2023, 1:48 PM
    I am getting the following error when running supabase db remote commit command: Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? in github.com/supabase/cli/internal/utils.AssertDockerIsRunning:48 in github.com/supabase/cli/internal/db/remote/commit.Run:24 Try rerunning the command with --debug to troubleshoot the error. Any ideas on how to fix this?
    g
    n
    • 3
    • 10
  • Not able to send password recovery email
    v

    ven

    04/29/2023, 2:09 PM
    Have attached the error log. fyi, I just migrated to AWS SES and updated the SMTP settings. Does it take some time to update the settings? but the error says something about an unverified email. so not sure.

    https://cdn.discordapp.com/attachments/1101872915391189072/1101872915626074132/not_able_to_send_password_recovery_email.png▾

    s
    d
    • 3
    • 42
  • Can Admin Access Users' (potentially private) Files?
    h

    heedongcho-xyz

    04/29/2023, 3:27 PM
    Since Supabase's storage allows the admin to view and download files, I was concerned as to how that would work with user-uploaded files that need to be kept private and only accessible by the user.
    g
    • 2
    • 4
  • Matchmaking System with Supabase
    c

    CryPax

    04/29/2023, 3:34 PM
    Hey everyone, I am currently working on implementing a matchmaking queue system with supabase. My Current concept is: Whenever a user presses a button to Queue up, he inserts himself into a table named Matchmaking where he has a game_session_id field that is defaulted to "waiting". Next he subscribes to updates specifically made to this row. I added a webhook, that triggers a supabase edge function whenever an insert into the Matchmaking table is made. The supbase edge function then takes the userid (from the user who was inserted) from the request and then gets all users from the Matchmaking table who are waiting and selects a second player. It then creates a new game_session_id and updates the field of the two users in the Matchmaking table to that id. Both users then have a session id. I just want some feedback to my concept, since I am new to supabase. There is probably an easier way to implement this, so if you have some ideas, I would be thankful.
  • Query returning wrong data
    p

    petoma

    04/29/2023, 3:39 PM
    I began with a much more complicated query but I was obtaining confusing data so I have been simplifying until I have found that a query is returning what I believe is a wrong output or maybe I need to use different filters. I have the table "asignaturas" (subjects), table "cursos" (courses) and the table "grupos_especialidades" (specialties_group). Then I have a join table to include the three of them. Here you have a screenshot of one of the subjects linked to two different courses and a different group of instruments in each course: When I do this query:
    Copy code
    let query = supabase
          .from("asignaturas")
          .select(`*,
            curso: cursos!inner ( id ),
            grupos_especialidades!inner ( id )
          `)
          .eq("curso.id", 5)
          .eq("grupos_especialidades.id", 1);
        
        const { data, error } = await query;
    
        return { data, error };
    I shouldn't receive any output because with the course_id: 5 and group_id: 1 there is no row that has both conditions. However I am obtaining the asignatura_id: 7 that you see in the screenshot. What am I doing wrong?

    https://cdn.discordapp.com/attachments/1101895613228003461/1101895613408350218/Captura_de_pantalla_2023-04-29_a_las_17.31.42.png▾

    g
    • 2
    • 3
  • 403 Error with resumable uploads
    s

    salzar

    04/29/2023, 3:54 PM
    Hi, I'm getting a 403 error with resumable uploads after getting access to it. I configured my RLS for the buckets, and I'm still getting the error below. Is there some other table I have to setup RLS for resumable uploads specifically? Thanks in advance!
    Copy code
    tus: unexpected response while creating upload, originated from request (method: POST, url: https://wmsccjgcrykictvgimtt.supabase.co/storage/v1/upload/resumable, response code: 403, response text: new row violates row-level security policy, request id: n/a)
    g
    • 2
    • 5
  • Potential issue having a service-role client & user authenticated client in memory at same time?
    e

    Epailes

    04/29/2023, 4:44 PM
    I could swear there was a github issue around this to do with the supabase-client having some shared memory behind the scenes causing issues? But I can't find it so not sure if my memory is tricking me or if there's something to be careful of here? Eg a user sends a request to server endpoint, I create a
    user-client
    (supabase-js client using users jwt), and also create another
    admin-client
    (supabase-js client using the service role), is there any issues of the
    user-client
    potentially having admin rights on requests it generates? Or
    admin-client
    performing requests scoped to the users access? I don't think this can happen, but it's bugging me I can't find that github thread so would appreciate someone confirming here 🙂
    g
    • 2
    • 4
  • How free is realtime?
    r

    Rabeeh

    04/29/2023, 5:28 PM
    What does concurrent peak connection really mean? let's say I have two rows in a table called User. user1 and user2. I need to listen to changes in both rows. Can a maximum of 200 clients listen to these changes on both rows in the free plan? 200 clients on user1 and another 200 on user2?
    g
    • 2
    • 1
  • Is Supabase auth not compatible with react 18?
    d

    deathless

    04/29/2023, 5:34 PM
    Getting these errors when installing while tring to follow examples: Could not resolve dependency: npm ERR! peer react@"^16.13.1 || ^17.0.1" from @supabase/ui@0.36.5 npm ERR! node_modules/@supabase/ui npm ERR! @supabase/ui@"^0.36.5" from the root project npm ERR! npm ERR! Conflicting peer dependency: react@17.0.2 npm ERR! node_modules/react npm ERR! peer react@"^16.13.1 || ^17.0.1" from @supabase/ui@0.36.5 npm ERR! node_modules/@supabase/ui npm ERR! @supabase/ui@"^0.36.5" from the root project
    s
    • 2
    • 7
  • Updating match_documents query vector
    s

    SunTzu

    04/29/2023, 6:19 PM
    Hi! I'm following this tutorial: https://supabase.com/blog/openai-embeddings-postgres-vector Is there anyway to make it so the match_document query takes in a paramater that allows me to filter the results by category within the metadata? So Instead of getting all of the indexes there, only the ones of say "Category: Book" etc?
  • How does one cascade an update in NextJS?
    n

    nateland

    04/29/2023, 7:48 PM
    I have the following code
    Copy code
    updateUser: async (
          email: string,
          name: string,
          lastName: string,
          newEmail?: string
        ) => {
          const { data, error } = await supabase
            .from("user")
            .update({
              name: name,
              last_name: lastName,
              newEmail: newEmail ? newEmail : email,
            })
            .eq("email", email);
          if (error) {
            console.log("error", error);
            return error;
          }
          return data;
        },
    however, there are other tables that havea a foreign key on the email. So, how can I cascade the change to the other tables?
    n
    r
    +2
    • 5
    • 15
  • How to link oauth accounts to existing email accounts
    e

    Entropy

    04/29/2023, 9:13 PM
    Hello, currently I am using Supabase for my website email login system. I want to be able to have users link their other social accounts to their email account, so I can make authenticated requests to display things like there currently playing Spotify song. If anyone could give me insight on how I could that I would appreciate it!
    u
    • 2
    • 8
  • Views inheriting RLS from tables
    u

    5h1rU

    04/29/2023, 10:22 PM
    👋 I've been playing around with Supabase, and I noticed that it can be challenging to maintain the RLS when it comes from tables used in Views. For example, I have this View
    Copy code
    SQL
    create view
      public.organization_membership as
    select
      o.id,
      o.name,
      o.created_at,
      m.access
    from
      organizations o
      join memberships m on o.id = m.organization_id;
    The problem is that if I use it as it is, I can access to the data without any restriction. While I was searching for a solution, I came across an answer on stackoverflow that seems to work. Link: https://stackoverflow.com/questions/33858030/why-isnt-row-level-security-enabled-for-postgres-views The line added was.
    Copy code
    SQL
    ALTER VIEW view_name SET (security_invoker = on);
    I'm a bit uncertain about whether it's a good idea to apply that flag, and even if it is, the UI doesn't seem to make it clear that using it will actually alter the view. Additionally, even after running it from the SQL console, there is no indication about any change. It's all a bit confusing to me.
    g
    • 2
    • 2
  • realtime filter problem
    u

    3IMAD

    04/29/2023, 10:53 PM
    hey i created some tmp tables to test supabase realtime but i keep getting changes on DELETE even if i've deleted other user_id row (insert works fine) for example if i deleted the last row which user_id = 4c6ed4d5-746c-4124-9d3e-b32e5f769476 i will get an update on subcribtion
    Copy code
    const user_id = "ee111686-d4a9-4263-9735-445b60d53c8d"
     supabase.channel('MyList')
      .on(
        'postgres_changes',
        { event: '*', schema: 'public', table: 'MyList',filter: `user_id=eq.${user_id}` },
        (payload) => {
          console.log('Change received!', payload)
        }
      )
      .subscribe()
  • Realtime filter problem
    u

    3IMAD

    04/29/2023, 11:06 PM
    hey i created some tmp tables to test supabase realtime but i keep getting changes on DELETE even if i've deleted other user_id row (insert works fine) for example if i deleted the last row which user_id = 4c6ed4d5-746c-4124-9d3e-b32e5f769476 i will get an update on subcribtion

    https://cdn.discordapp.com/attachments/1102007911263256607/1102007911921745950/image.png▾

    https://cdn.discordapp.com/attachments/1102007911263256607/1102007912227946676/image.png▾

    g
    • 2
    • 3
  • SQL Functions with HTTP blocking database?
    m

    Mondmann

    04/29/2023, 11:16 PM
    Hi all, i was wondering when i'm using the http extension in my sql functions, will they block the database from further getting read by other calls? i checked the github of the extension (https://github.com/pramsey/pgsql-http) and it just says: "What happens if the web page takes a long time to return?" Your SQL call will just wait there until it does. Make sure your web service fails fast. this does not sound to me like it will block the database but then again i'm wondering why there is a extension called pg_net for Async Networking. what my function will essentially do is call an api to get a json back, which includes an array of objects and i will iterate through those objects to add new rows to my table. if anyone can clarify this for me, would be great. Thanks in advance! Cheers Mond
    g
    • 2
    • 2
  • List files in bucket returns empty array
    z

    zach

    04/29/2023, 11:33 PM
    Goal: I'm trying to list the filenames of 2 files in my tracks bucket. Each are stored in a folder with a userId. I've passed userId into the request as a prop (and you can see its included in the payload as a string). Can someone explain to me why my fetchTrackNames()'s function is returning an empty array? See attached for the storage buckets structure in supabase, as well as the API request payload, and response.

    https://cdn.discordapp.com/attachments/1102014750503739484/1102014750994477096/Screenshot_2023-04-29_at_7.29.13_PM.png▾

    https://cdn.discordapp.com/attachments/1102014750503739484/1102014751296458842/Screenshot_2023-04-29_at_7.28.39_PM.png▾

    https://cdn.discordapp.com/attachments/1102014750503739484/1102014751602647130/Screenshot_2023-04-29_at_7.28.19_PM.png▾

    https://cdn.discordapp.com/attachments/1102014750503739484/1102014751917215755/Screenshot_2023-04-29_at_7.28.07_PM.png▾

    https://cdn.discordapp.com/attachments/1102014750503739484/1102014752395370666/Screenshot_2023-04-29_at_7.24.49_PM.png▾

    g
    • 2
    • 8
  • Can I download multiple files from a bucket at once?
    h

    Hugos

    04/29/2023, 11:50 PM
    Lets say I have a product and the product on my website has multiple images, now I store these images inside a bucket where the folder path corresponds to the product id (/[id]/1.png) but for every product I can have multiple pictures, is there a way to download all files from 1 directory using the javascript supabase client?
    g
    • 2
    • 5
  • Add invalid HTML intentionally to Email Templates?
    d

    dave

    04/30/2023, 1:16 AM
    I'm trying to add a
    ses:no-track
    tag to the email templates, but it disappears as soon as I click save. e.g. if I enter this:
    Copy code
    html
    <p><a ses:no-track href="{{ .ConfirmationURL }}">Log In</a></p>
    It still saves as:
    Copy code
    html
    <p><a href="{{ .ConfirmationURL }}">Log In</a></p>
    Any ideas on how I can add invalid HTML and save it?
    • 1
    • 1
  • Is there a way to make a table realtime programmatically other than toggling it?
    n

    neosavvy

    04/30/2023, 1:22 AM
    I would like to be able to programmatically make tables "realtime" when deploying to new environments. All I see is the mechanism for selecting "realtime" on each table in the UI. This seems like a bad way to move from Dev->QA->Staging->Prod etc. Any advice or documentation on this?
    g
    • 2
    • 4
1...196197198...230Latest