https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How to delete using .match ?
    v

    vexkiddy

    09/19/2022, 7:36 PM
    consider this code
    Copy code
    const { data, error } = await supabase
    .from('attendance')
    .delete()
    .match([{address: $userAccount.address, id: id}])
    The actual table has another column, which is a UUID. Do I also need that to be present in the
    .match
    method for it to delete ? currently i get an error when trying the above 😦
    g
    • 2
    • 2
  • Youtube recommendations for adding users
    j

    JuicyBenjamin

    09/19/2022, 7:39 PM
    Hi there, I'm very new to this whole backend side of the stack but thought it be fun to try with supabase. I'm having a hard time finding resources, specifically videos, explaining and walking through how to setup users, authentication and all that jazz. Most videos I find are like full on projects that takes 40+ minutes, and while I don't mind watching that long if it's good, I don't want to spend that much time just to figure out if it's useful to me or not. So I was hoping that maybe someone out there has been in a similar situation and found some good videos on the topic. Hope to hear from you guys 😄
    n
    s
    • 3
    • 3
  • How to prevent unauthenticated user from going to page?
    a

    AnimeDev

    09/19/2022, 7:57 PM
    Hello, I use next.js and I want to prevent unauthenticated users from going to page (dashboard). How can I implement that?
    m
    n
    • 3
    • 5
  • Query table from edge function
    a

    Adam Ambrosius

    09/19/2022, 8:20 PM
    I am new to Supabase and love it so far but think I'm making a dumb mistake. I created tables then an edge function.
    Copy code
    js
    const supabaseClient = createClient(
      // Supabase API URL - env var exported by default when deployed.
      Deno.env.get("SUPABASE_URL") ?? "",
      // Supabase API ANON KEY - env var exported by default when deployed.
      Deno.env.get("SUPABASE_ANON_KEY") ?? ""
    );
    
    const { data, error } = await supabaseClient
        .from("table_name")
        .select("*");
    
      console.log({ data, error });
    I am getting an error
    Copy code
    json
    {
      data: null,
      error: {
        code: "42P01",
        details: null,
        hint: null,
        message: 'relation "public.table_name" does not exist'
      }
    }
    Do I need to do something else to link up my tables to my edge functions? Thanks in advance for the help
    m
    g
    • 3
    • 21
  • How can I inform the Web App that supabase_admin now has a password?
    j

    justifi

    09/19/2022, 9:56 PM
    Supabase Studio is very cool, but I also use PGAdmin - logged in as
    postgres
    . Having been told one too many times that I could not alter a table because it had been created by
    supabase_admin
    , I decided to assign
    supabase_admin
    a password and login as it w/ PGAdmin. After doing so, Studio web app stopped cooperating. It no longer can do its thing as
    supabase_admin
    because that user now has a password. Is it possible to
    unset
    this change, or, ideally, inform the webapp about the change to its user? Or should I just
    pg_dump
    the instance, delete it, and start fresh? note: I know that this is not the proper solution - I'd just like to undo it.
    n
    g
    • 3
    • 2
  • Database webhook overwritten by trigger
    t

    Tony_n

    09/19/2022, 10:27 PM
    I had a working webhook that called an edge function. I then put a trigger through the sql terminal on the same terminal and the webhook stopped running. This has happened on two different tables. IS there a reason for this? How can I solve it?
    g
    • 2
    • 7
  • NextJS getServerSideProps capture Google login callback
    n

    noahflk

    09/19/2022, 10:37 PM
    I use Next.js with
    @supabase#0835/auth-helpers-nextjs
    with Google Auth. This is the flow that's happening after a user logs in with Google: - I get a callback request from Google that contains the access token - gSSP in Next sees that we’re not yet authenticated (because I have a check for protected pages) - This check redirects to login page - Client side Supabase sees access token and authenticates us - Manual reload required to get away from login page to dashboard The problem I see is that the Supabase client side JS deals with the callback coming from Google. That way the
    getUser
    in my gSSP still thinks I'm unauthenticated. What's the most elegant way to immediately be let through to my protected page on the Google callback? For example, is there a
    onAuthenticated
    callback in the Supabase JS client I can use to redirect on client after Supabase has parsed the token?
  • Need help sending id of row into variable in database function
    s

    stevharve

    09/20/2022, 12:44 AM
    I haven't implemented the logic for creating the member row but that won't change the fact that teamId is always null. team_code is a parameter passed to the rpc function and I have already confirmed that team_code is a valid code. Basically why is happening is it's always raising the exception that the code is invalid.
    Copy code
    sql
    DECLARE teamId public.teams.id%TYPE;
    
    BEGIN
      SELECT id
      INTO teamId
      FROM public.teams
      WHERE code IS NOT DISTINCT FROM team_code;
      IF teamId ISNULL THEN
        RAISE EXCEPTION 'Invalid code.';
      END IF;
      IF EXISTS
        (SELECT
        FROM public.members
        WHERE user_id = auth.uid()
        AND team_id = teamId)
      THEN
        RAISE EXCEPTION 'You are already a member.';
      END IF;
    END;
    • 1
    • 1
  • Is this a valid structure for tables?
    u

    ((()))

    09/20/2022, 1:23 AM
    Each municipality has an admin that has full control Each municipality has an office Each municipality has users that can belong to an office I am getting a strange error when I am trying to set a relationship between Municipalities and Muni_admins by muni_id as shown in 2nd image. what am I doing wrong, please HALP
    g
    • 2
    • 5
  • Multitenant Auth?
    l

    leviwhalen

    09/20/2022, 2:21 AM
    Hello! My application allows users to create their own no-code applications on top of my platform. I’m struggling to see how I can use Supabase’s built in auth capabilities for such a use case. Should I programmatically create new supabase instances on my customer’s behalf? That feels heavy handed but I’m not sure how else to handle user auth and the possibility that someone could have accounts with many different single applications on my platform. Thanks for any insight!
    g
    h
    • 3
    • 3
  • What happened to Workflows
    s

    SimonP

    09/20/2022, 5:16 AM
    I was reading this blog post and I wonder what happened with this really great looking feature 🤔 https://supabase.com/blog/supabase-workflows
    c
    • 2
    • 3
  • invalid peer certificate UnsupportedCertVersion
    r

    Rano

    09/20/2022, 8:12 AM
    I am trying to connect to the database using sqlx(rust) and I keep getting this error when I use TLS: "invalid peer certificate UnsupportedCertVersion" It does however connect using psql, any idea why this is happening?
    d
    • 2
    • 11
  • Hi, I have a 90k db in xml. How do I add it to supabase?
    k

    Karunesh K

    09/20/2022, 8:54 AM
    My db has 90k items with 16 columns in xml format. (xsd) I have tried converting it to sql table format using online tools, but when I add those in sql editor in supabase, the query fails saying too big to execute. Please guide. sample xsd is attached.
  • How can I select the latest message that's linked to my conversation table?
    l

    lewisd

    09/20/2022, 9:31 AM
    Aplogies for using
    camalCase
    I need to select a few fields, in total I want: -
    createdAt
    (when the conversation was created) -
    id
    (of the conversation) -
    membersData
    (username, avatar and id from all users involved in this conversation) -
    latestMessage
    (The latest message... struggling with this part) My query so far:
    Copy code
    select 
      conversations."createdAt",
      conversations.id,
      array_agg(json_build_object('id', "conversationMembers"."userId", 'avatar', "userData".avatar, 'username', "userData".username)) as "membersData"
    from 
      conversations
    join 
      "conversationMembers" on "conversationMembers"."conversationId" = conversations.id
    join 
      "userData" on "conversationMembers"."userId" = "userData".id
    group by 
      conversations.id
    order by 
      conversations."createdAt" desc
    • 1
    • 1
  • How to link a supabase project?
    s

    Solomon Lijo

    09/20/2022, 9:47 AM
    Hello! I tried linking my supabase project like this -
    supabase link uuyujtlklufbbccytnis
    but it still says that my project reference ID isn't there So, how exactly do I link my supabase project?
  • How to ban users when using supabase for auth?
    r

    rishav

    09/20/2022, 10:23 AM
    If I am using supabase and supabase auth uses jwt, how can I do operations like banning users?
    n
    • 2
    • 1
  • Date interval?
    a

    Amr

    09/20/2022, 11:50 AM
    I want to set a column to accept an interval, like Thursdays, Fridays. This is for a bus ticketing app. What should I do?
    n
    s
    • 3
    • 10
  • Stream on delete doesnt work
    c

    Craonnne

    09/20/2022, 12:38 PM
    Hello, I currently have a issue on my Flutter application using supabase, none of the streams on the delete action are called, I already tested the alter table replica SQL line. Do you have any idea why it happens? Thank you!
  • Download select parts of a file
    k

    KasperLund

    09/20/2022, 3:02 PM
    Is it possible to download a section of a file using the Storage APIs? I am interested in resuming a transfer that got interrupted by a lost connection.
    g
    h
    • 3
    • 5
  • GCP OAuth Google Sign-In
    r

    realvarx

    09/20/2022, 3:14 PM
    I've seen that Supabase includes Google among Auth Providers. But to use it, it is necessary to set up GCP OAuth, and connect the GCP project to Supabase. GCP OAuth service has a price: https://cloud.google.com/identity-platform/pricing Does that mean that I will have to pay to Google (through GCP) for every Google Sign-in which happens in my app, apart from the Supabase cost itself?
  • Array Of extensions
    r

    rlee128

    09/20/2022, 3:19 PM
    Can you use an array of extension for a RLS policy for a storage bucket?
    g
    • 2
    • 2
  • Is it possible to execute Functions on a schedule?
    s

    SimonP

    09/20/2022, 4:03 PM
    I have a use-case where I have to fetch data from an external data source periodically and I do not know if it possible to trigger a function based on a cron job for example. 🤔
    g
    h
    u
    • 4
    • 12
  • How to implement Push notifications with Supabase ?
    v

    VWL Tobias Hassebrock

    09/20/2022, 11:36 PM
    What is the best approach, strategy or best practise to implement a push notifications feature (e.g. user can receive notifications if PWA is closed) with Supabase? So far I build a notification table and a table to store the Push Subscription Object. 1. Shall I use an edge function to react/trigger on the new insert to the notifications table or a different functionality? What is the best supabase solution here? 2. Do I need an external library like WebPush (https://github.com/web-push-libs/web-push ), OneSignal or Firebase Cloud Messaging? 3. In case I need an external library: Do I have to develop implementations for each browser/client or is there one for all browsers supporting WebPushAPI? Does anyone have any insights , would like to share their approach or share helpful ressources?
    m
    • 2
    • 1
  • Configure Storage download caching time
    j

    Julien

    09/21/2022, 2:08 AM
    I'm not sure how that works but is there any way to configure/delete the caching time of the storage API? I'm using Tanstack query to cache the data I get from Supabase and I would like to do the same for images that I get from the Storage API. That would be very convenient for me to be able to delete the caching that the storage API uses. I would want to rely only on Tanstack query for the caching of my data, since this allows me to control their display precisely (show a loader when I'm loading them, show another small loader in the top right of my app when I'm refetching them while still displaying the current image etc). Currently that works perfectly for text data, but for images, Tanstack think that I'm refetching them whereas ``.download()`` only give them back from the disk cache (in case they are in the cache ofc).
    s
    g
    • 3
    • 8
  • How to redirect to a particular route?
    d

    daksh

    09/21/2022, 4:09 AM
    I'm trying to use supabase auth to redirect to a domain using the
    redirectTo
    prop, but it's getting redirected to the homepage of that domain for some reason. That domain is added separately in the allowed domains but the same code works fine for the primary domain
    n
    • 2
    • 4
  • Filter inner joins
    j

    jbergius

    09/21/2022, 6:57 AM
    Hey guys! I have a select that looks like this:
    Copy code
    supabase
          .from('subscriptions')
          .select('*, prices(*, products(*))')
          .in('status', ['trialing', 'active']);
    But what I would like to do is to make an inner join filter on the products table. I would like to get all subscriptions that dosen't match a specific product. Something like:
    Copy code
    supabase
          .from('subscriptions')
          .select('*, prices(*, products!inner(*))')
          .neq('products.id', 'prod_MSjuJNMlVA1zBF')
          .in('status', ['trialing', 'active']);
    Is that possible?
    g
    m
    s
    • 4
    • 6
  • SQL Syntax Error - error at or near end
    s

    Solomon Lijo

    09/21/2022, 9:06 AM
    Can someone help me find the error? I am a little confused -
    Copy code
    CREATE TYPE expires AS ENUM (
        'never',
        '1h',
        '2h',
        '10h',
        '1d',
        '2d',
        '1w',
        '1m',
        '1y'
    );
    CREATE TABLE snips (
        id varchar(255) PRIMARY KEY,
        code TEXT NOT NULL,
        password TEXT,
        language TEXT,
        expires_in expires,
        created_at TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
        user_id UUID,
        CONSTRAINT user FOREIGN KEY(user_id) REFERENCES user(id)
    )
    By running it, it's showing up an error as
    Failed to validate sql query: syntax error at or near "user"
    Can someone help me resolve this issue?
    n
    g
    • 3
    • 22
  • Some naive questions?
    a

    Amr

    09/21/2022, 10:41 AM
    Hi there, I'm totally new to supabase, and I'm using it with sveltekit. I'm making a bus ticketing web application, where there are two parts: 1- Public website, this allows visitors to fill a form where they choose the trip start , return .. etc 2- Admin dashboard: this allow authorized user to view reservations, control trips .. etc I went with the server side approach to handle requests, authenticate admins, validate visitors reservation data .. etc For the first part, I'm having some troubles with authentication. I made a user on supabase with my own email. and verified it. on the client side, I made a function on the page that admins are redirected to after verifying their email... this function takes the
    #hash
    from URL and sends it to a different endpoint to verify the JWT before setting a cookie. But I don't know how to verify the incoming JWT with the secret key from supabase, using
    jose
    ! Overall I may be making hard work to re-invent the wheel , but the main issue that I'm wondering if I could just use supabase on client side to handle authentication and such ... while allowing visitors to make reservation without authenticating ? please note it's just a form that the company wants to collect those data and contact those possible clients... so they don't want their clients to signup for the website. Please help me with this
    n
    s
    • 3
    • 24
  • Issues with docker running Supabase locally
    c

    Chensokheng

    02/09/2023, 5:15 PM
    I am facing this issue while run supabase locally
    Copy code
    2023/02/10 00:14:01 Connect Error: tcp [::1]:54322 dial tcp [::1]:54322: connect: connection refused
    Error: failed to connect to `host=localhost user=postgres database=postgres`: dial error (dial tcp [::1]:54322: connect: connection refused)
    • 1
    • 2
  • Relating Storage Objects to Public Schema Tables
    d

    drewbie

    09/21/2022, 1:53 PM
    I am looking to set up a relation between a table in my public schema with objects in a bucket within Supabase storage. I found some folks asking about this here https://github.com/supabase/supabase/discussions/3541 but wanted to see if anyone had any new insights into this. I have a products table that I wanted to have a has many relation with images to, which would allow me to join products with the product_images (or whatever associated table is set up). The unknown part for me is how can I have a true association where added and deleted storage objects are reflected in the association with their product? I know that I can just store the image path(s) on the product row itself but I'm looking for a set up that has a little more reliability on if the images actually exist. Otherwise it becomes a game of making sure that I set up another product table operation after each storage object insert/delete. Anyone's insight into how they might solve this is much appreciated. I'd really just like to keep this association as simple and reliable as possible. Thanks!
1...272829...230Latest