https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Possible to query foreign table rows?
    c

    Cheqo

    05/15/2023, 2:47 PM
    Hey, I'm not sure if thats the term, but as an example let's say I have 2 tables. recipes_full table have columns: id, recipe_name, created_at, etc. recipes_macros have these columns:** id, recipe_id, carbs, fats, protein.** I want to query recipe_macros table, I add filters for carbs, fats, protein, BUT I also want to query for recipe_name, however it doesn't exist in recipe_macros table, but it exists in recipes_full table, so if I join recipe_id column can I query recipe_name as well?
    g
    • 2
    • 9
  • [SOLVED] Retrace RLS Setup Steps
    j

    Johnny Robert

    05/15/2023, 2:55 PM
    I have a tabled called "UserProfile" which has 4 policies and some triggers as far as I remember (been awhile since I've set-it up). The issue is I am moving my app to another Supabase project and so I need to re-apply the same configuration I have on the current table on that new table, however I forgot how I did it the first time and failed to write down notes about the process so I'm trying to get some help with replicating the triggers and the policy creation. I'll post some screenshots as well.

    https://cdn.discordapp.com/attachments/1107682620004909146/1107682620218814594/Screenshot_at_May_15_17-52-30.png▾

    v
    v
    g
    • 4
    • 63
  • Is there a way to call a function in the flutter select ?
    p

    Philipp_Nut

    05/15/2023, 3:45 PM
    await supabase .from('products') .select( '*, functionName(currentRowId)');
    g
    • 2
    • 9
  • Sessions don’t appear to expire… ever
    j

    joshuabaker

    05/15/2023, 4:47 PM
    I have the JWT expiry set to 3,600, which I believe is the default, however, it doesn’t appear that the session expires even after over a week of inactivity. Is there something that I’m supposed to do manually that perhaps I’m not?
    g
    • 2
    • 20
  • Why does my local instance have a supabase_functions schema but I don't see that schema in remote?
    v

    ven

    05/15/2023, 5:19 PM
    see attached pics. Just curious. especially since my functions are deployed in prod.

    https://cdn.discordapp.com/attachments/1107718871512785058/1107718871949004961/supabase_local_instance.png▾

    https://cdn.discordapp.com/attachments/1107718871512785058/1107718872536195162/supabase_remote_instance.png▾

    g
    • 2
    • 3
  • Get email address from `SupabaseClient` without a remote call?
    d

    dave

    05/15/2023, 5:54 PM
    If I already have an existing
    SupabaseClient
    instance (TypeScript), can I get the email address without needing to do a fetch?
    getUser
    causes a GET request, which I want to avoid.
    g
    j
    s
    • 4
    • 8
  • FlutterFlow with Supabase realtime DB
    m

    mohonish

    05/15/2023, 6:24 PM
    Hello, I'm building an app using FlutterFlow and using supabase DB. It seems like real-time is not supported? I have a table with realtime enabled, and on a page in my FF app, I am querying the information on a specific row. But when I update the same row (from supabase console) the changes are not reflected in my FF app, until the page is loaded again. Is realtime functionality not supported yet?
    m
    • 2
    • 1
  • Self-hosted Supabase on AWS EC2 - How to get it running public?
    g

    georgeg3g3g3

    05/15/2023, 6:34 PM
    I have successfully self-hosted Supabase on EC2 isntance locally on port 3000 but once trying to add keys for making it public, I am getting a lot of authentication errors. Anyone that succeeded running it public? HELP!!!
  • Whats the best way to store this data?
    d

    DannyDanDan

    05/15/2023, 7:55 PM
    Hi, im migrating a site from json db to supabase and am thinking about how to store the last updated text, its just a string that gets displayed and can be edited by admin. Making a table with just 1 entry with content seems a bit... overkill? whats the best way to do this?

    https://cdn.discordapp.com/attachments/1107758122514256035/1107758122682036354/image.png▾

    v
    • 2
    • 1
  • supabase its not deleting sb-cookies
    f

    formigueiro

    05/15/2023, 8:49 PM
    On logout supabase its not deleting this cookies. Im using nuxt
    Copy code
    js
    const logout = async () => {
      await supabase.auth.signOut()
    
      router.push('/login')
    }

    https://cdn.discordapp.com/attachments/1107771875960045570/1107771876446576690/image.png▾

    g
    • 2
    • 4
  • signInWithOtp "Database error finding user" for new user with create_user: true
    u

    user8923

    05/15/2023, 9:41 PM
    I'm using supabase.auth.signInWithOtp() to sign in/create a user (using email). With a brand-new database and the user NOT present in the database, I sometimes (it's intermittent) get the following error (this is a copy and paste from the request/response in browser: Request:
    Copy code
    json
    {"email":"user@example.com","data":{},"create_user":true,"gotrue_meta_security":{},"code_challenge":null,"code_challenge_method":null}
    Response:
    Copy code
    json
    {
        "code": 500,
        "msg": "Database error finding user",
        "error_id": "d8899365-2eea-46ce-a1ec-561724b7e743"
    }
    Is I hit my GUI button one more time to trigger signInWithOtp() again, it works, the user gets created in the DB and everything is dandy. Please note that this is using a local development Supabase environment as provided by supabase-cli. I have not been able to test on my remote servers yet. I'm not sure where to start troubleshooting this. I think gotrue runs in the Kong container. The logs tab for Kong in Docker Desktop has nothing worthwhile, just the HTTP log.
    g
    • 2
    • 2
  • Get user info from google auth
    z

    zerosodium

    05/15/2023, 10:55 PM
    Hi, Looking to get the name of my user when signing them in. right now I have
    Copy code
    js
    const { data, error } = await supabase.auth.signInWithOAuth({
          provider: "google",
        });
    is there a user key value pair in addition to data and error? ts is complaining it doesn't exist
    g
    • 2
    • 21
  • External API keys in database functions
    a

    AlanK

    05/15/2023, 11:16 PM
    I have a function using the pg_http extension that calls an external API. I want this to be called by a trigger when a new user's email is confirmed. Is it considered 'safe' to have the API keys in the function definition?
    i
    g
    • 3
    • 4
  • Function to send realtime messages from postgres?
    i

    imagio

    05/15/2023, 11:42 PM
    Is there a postgres function that can be called to send a realtime message to users? I don't see it in the docs anywhere. I've got a use case where I'd like to send some ephemeral realtime messages to clients directly from postgres. I suppose I could hack it together with a table + postgres changes + rls, but I'm hoping there's a better way.
    g
    • 2
    • 1
  • Proper way to handle signing a user in and getting their information
    a

    Actual Left Shark

    05/16/2023, 12:11 AM
    Using NextJs 13 with App router My goal is once a user signs in, they get redirected to the dashboard page (haven't even gotten here yet), but what I am trying to do with just this example, is sign a user in and query my
    profiles
    table to show things like "posts", "username" etc... but having trouble with the logic. I have the following code in my
    <Navbar />
    and looks like this
    Copy code
    "use client"
    import { useState, useEffect } from "react";
    import { useSupabase } from './supabase-provider'
    
    export default function Navbar () {
    
      const { supabase  } = useSupabase()
      const [user,setUser] = useState(null)
      const [profileData, setprofileData] = useState(null)
    
      useEffect(() => {
    
        supabase.auth.onAuthStateChange(async (event, session) => {
          setUser(session?.user ?? null); <<<--- this works for setting the user state and things
          if(session.user){ <<<<----- issue here
            fetchData()
          }
        });
    
         async function fetchData() { <<<------- issue here as well
          const { data } = await supabase.from('profile').select('*').match({ id: user.id})
          setprofileData(data)
        }
    
      }, [supabase.auth,supabase]);
    
      console.log("user data", profileData)
      console.log("user info log", user)
    
      const signIn = () => {
        supabase.auth.signInWithPassword({
          email: "email@email.com",
          password: "password123",
        })
      }
    
      const signOut = () => {
        supabase.auth.signOut()
        // setUser('')
      }
    
      return (
        <div>
           <button className="m-3" onClick={signIn}>Sign In</button>
              <button className="m-3" onClick={signUp}>Sign Up</button>
              <button className="m-3" onClick={signOut}>Sign Out</button>
              {/* This is what I am struggling with */}
              {user ? <p>Welcome {user.email}</p> : <><p>No One here</p></>}
        </div>
      )
    };
    any help would be great!
    g
    n
    • 3
    • 3
  • auto increment
    f

    formigueiro

    05/16/2023, 1:05 AM
    i have this two tables url_data
    Copy code
    sql
    create table
      public.url_data (
        id uuid not null default gen_random_uuid (),
        slug text null,
        long_url character varying(255) null,
        total_clicks bigint null,
        created_at timestamp without time zone not null default now(),
        updated_at timestamp without time zone not null default now(),
        user_id uuid null,
        constraint url_data_pkey primary key (id),
        constraint url_data_shortened_key unique (long_url),
        constraint url_data_slug_key unique (slug),
        constraint url_data_user_id_fkey foreign key (user_id) references auth.users (id) on delete cascade
      ) tablespace pg_default;
    clicks
    Copy code
    sql
    create table
      public.clicks (
        id bigint generated by default as identity not null,
        created_at timestamp with time zone null default now(),
        ip character varying null,
        country character varying null,
        city character varying null,
        user_agent text null,
        url_id uuid null,
        constraint clicks_pkey primary key (id),
        constraint clicks_url_id_fkey foreign key (url_id) references url_data (id)
      ) tablespace pg_default;
    
    create trigger increment_total_clicks_trigger
    after insert on clicks for each row
    execute function increment_total_clicks_on_url_data ();
    and im creating a function to trigger when click is inserted
    Copy code
    sql
    begin
      update public.url_data
      set total_clicks = total_clicks + 1
      where id = new.url_id;
      return new;
    end
    but its not updating total_clicks from url_data
    g
    • 2
    • 15
  • Data Recover
    n

    Negative

    05/16/2023, 2:04 AM
    Hello, is it at all possible to recover deleted data? I would pay whatever fee necessary to get some data back that I deleted about an hour ago. Immediately after deleting it, I upgraded to PIT recovery as last hope... But I see that it only begins after purchase.
    g
    • 2
    • 2
  • is the service down, i am not able to login...
    e

    esque

    05/16/2023, 3:04 AM
    it's also not sending me the reset password link...
    g
    • 2
    • 19
  • Handling Asynchronous Processing with Queues using Supabase?
    j

    Johnny008

    05/16/2023, 6:06 AM
    Hi all, My use case is that I am fetching some data from the google calendar api, and then storing it in a table. However, I need to enrich each row I get from the calendar api (which basically just returns an email address and a date) - I need to then fetch things like name and avatar from a paid data api. I will then store this extra data in a different table like paid_data or similar. This needs to all happen as quickly as possible as my application is returning all this to a user as they login - so the approach needs to be as fast as possible but also robust and handle failed or empty responses from the calls. I'm just wondering what the best way to handle this in Supabase is? Can it be handled entirely with Supabase? Or will I need to also use something like like AWS SQS & Event Bridge? Thanks a bunch for any guidance!
    o
    • 2
    • 1
  • short question how to do a query
    z

    Zyrano

    05/16/2023, 7:15 AM
    i have three tables - Question - QuestionCategory - Category Our Program is in C# and we use the Supabase-csharp Nugget Pack My question now is how to do a propper query that i get all questions with the correct Categorys? I need only a list of steps what to do normaly and maybe a example query i think i can do the rest myself. I found only a way with a 1:n reference but not if we have a n:n and use a junction table
    g
    • 2
    • 1
  • .eq() with uuid.
    m

    MATTI

    05/16/2023, 9:13 AM
    If i have a select query with the .eq() filter, and pass a partial UUID to the .eq() i get an error, because the passed value is not a "full" UUID. Is it possible to use .eq() to search for a UUID type, even though a full UUID is not passed?
    f
    s
    • 3
    • 6
  • Supabase returning an empty list for the foreign key relation
    f

    FezVrasta

    05/16/2023, 9:41 AM
    I have two tables, users (id, name), and services (id, user_id, name). The
    services.user_id
    column is set with a foreign key relation to
    users.id
    . In Supabase studio I see the relation working, if I click the right arrow next to a
    user_id
    it brings me to the correct
    user
    entry. I need to query a user and all its related services from Supabase JS now, and I'm using:
    Copy code
    js
      const { data, error } = await supabase
        .from('users')
        .select('*, services(*)')
        .eq('id', id)
        .single();
    The problem is that this returns me the correct user object, but with an empty array as `services`:
    Copy code
    { id: 0, name: 'Foobar', services: [] }
    These are my table definitions:
    Copy code
    sql
    create table
      public.services (
        id uuid not null,
        created_at timestamp with time zone null default now(),
        constraint users_id_pkey primary key (id)
      ) tablespace pg_default;
    
    create table
      public.services (
        id uuid not null,
        user_id uuid not null,
        created_at timestamp with time zone not null default now(),
        name text not null,
        constraint services_pkey primary key (id),
        constraint services_user_id_fkey foreign key (user_id) references users (id) on delete cascade
      ) tablespace pg_default;
    What am I doing wrong? I have data in the database that should be returned.
    g
    • 2
    • 2
  • Local Development well-structured migration files
    a

    andy.nguyen

    05/16/2023, 9:45 AM
    As we could not edit the migration files which have been deployed already, we will need to create new migration files once we want to add more functions, tables or edit anything. A foreseen problem is that there will be a ton of migration files spreading in the migrations folder. Is there any way to group or structure files well like group by purpose, functionality?
    s
    • 2
    • 1
  • cant run locallly - getting supabase key is required
    p

    Paul AKA TDI

    05/16/2023, 10:01 AM
    details here https://stackoverflow.com/questions/76242406/setting-up-supabase-locally-issue-with-supabase-key-in-svelte
    n
    v
    • 3
    • 75
  • Any reason why `updateMetadata()` has been commented out for this long?
    k

    KBar

    05/16/2023, 10:48 AM
    I found that this method could help my case but I was disappointed to see it's commented out in the source code. Is there any particular reason it was done? Does the
    /metadata
    endpoint even exist?
    g
    • 2
    • 1
  • How to update postgres version
    t

    Tairosonloa

    05/16/2023, 10:52 AM
    Currently, my postgres is v12. How do I update it to v15?
    v
    • 2
    • 4
  • Send Email template on button press
    b

    benemanu

    05/16/2023, 11:51 AM
    Hello dear Supabase-Community. At the moment, im facing the problem that i want to send my users an email-template to change their email-adress. My idea was to let them change the email on a page, and on button press to send them an email to their new email adress, so they can't use dead/not available email-adresses and to keep them "verified". Im writing in flutter, any help is appreciated, I just dont know how to send the template from my Supabase-templates.
    g
    • 2
    • 2
  • Confirmation email simple questions
    e

    enti

    05/16/2023, 12:22 PM
    A user has signed up a new account but didn't receive the confirmation email even though he typed the right address (nothing in spam folder). - Is there a way to check for an eventual bounce from an email server in the supabase dashboard? - How can I confirm a user manually?
    b
    r
    g
    • 4
    • 9
  • DB local development and migration merging/resolving
    b

    bombillazo

    05/16/2023, 12:24 PM
    I was wondering if anyone had a recommended method or strategy when doing local DB development and schema changes. Take the following scenario: We have dev A and dev B who are working on DB changes, both starting from project branch
    dev
    . Both devs pull the branch, and run
    supabase start
    locally to do their development on a local db. They each make independent changes to the database locally and generate a migration file (using
    supabase db diff
    ) called
    m_A
    and
    m_B
    respectively. Dev A's changes are reviewed, merged and deployed to remote successfully in branch
    dev
    . Now, what is the best way for dev B to pull those migration changes (
    m_A
    ) into his local dev environment without losing his own development changes (
    m_B
    )? I'm sure dev B would need to recreate the migration file but they should do so based on the newest deployed state.
  • Remix Auth
    j

    jacobart

    05/16/2023, 1:13 PM
    I’m new to supabase and have been having trouble reading the remix auth docs. I think they are missing some key insights to the file placements and such. I love the product and would like to use it for auth, does anyone have any good resources for it?
1...215216217...230Latest