https://supabase.com/ logo
Join Discord
Powered by
# help
  • w

    wiesson

    11/25/2021, 10:12 PM
    Does anyone know how I insert a many-to-many relation? I have
    Copy code
    images_image (id, url)
    itinerary_image (id, itinerary_id (fk), image_id (fk)) 
    bookings_itinerary (id, ...)
    I guess, I could fill the mapping table manually, but is there a helper?
  • m

    Mihai

    11/25/2021, 10:59 PM
    If I find a bug, where should I report it ?
  • n

    Neucoas

    11/26/2021, 12:17 AM
    Is there a fix for the
    401 JWT Expired
    errors? The problem is that when someone leaves the site open on a background tab and comes later, the supabase-js client fails to refresh the JWT; so it makes api requests with tokens that are expired. This means that all requests will fail until either the user refreshes the tab or logs out.
    • 1
    • 1
  • m

    Milou

    11/26/2021, 1:51 AM
    if i want one of my tables to be realtime enabled, do i have to create them in the pre-defined realtime database?
  • m

    Milou

    11/26/2021, 1:51 AM
    i.e here?
  • a

    anothercoder

    11/26/2021, 2:21 AM
    Database > Replication > Source button
  • m

    Milou

    11/26/2021, 2:21 AM
    thx!
  • m

    Milou

    11/26/2021, 2:22 AM
    also, another question, how can i add one to many relations? supabase doesnt seem to recognize that i want to have a foreign key relation on an array.
  • a

    anothercoder

    11/26/2021, 2:25 AM
    Either in Table or Database on the left sidebar, u can edit the table or edit a col. Look for the foreign key or chain icon.
  • m

    Milou

    11/26/2021, 2:26 AM
    this works for one to one relations, but not one to many it seems. i.e. it will look like it applies the one to many relation, but afterwards its nowhere to be found and apparently hasnt been applied
  • a

    anothercoder

    11/26/2021, 2:29 AM
    One way to check is to download postgresql-13 on your computer and connect to the postgresql db directly on port 5432. Then use the pgadmin or pg_dump to view the table details.
  • a

    anothercoder

    11/26/2021, 8:58 AM
    I subscribed to Realtime on web client and keep receiving this error in console until I remove the subscription. I also didnt receive any change update. I have added the table to Replication>Source. Using google chrome browser and there is no "failed" reason. Anyone knows why? Thanks. Seems that using the user's jwt is the reason for the failure. Using anon or service key works. Maybe this will change in the future when RLS is implemented for Realtime? The user's jwt should work then instead of the anon key.
    Copy code
    WebSocket connection to 'wss://myproj.supabase.co/realtime/v1/websocket?apikey=XXXXX&vsn=1.0.0' failed:
  • s

    supa

    11/26/2021, 3:37 PM
    Does anyone know where I could learn the idiomatic way to handle postgres database in production, I don't feel really confident when making changes to the database?
  • m

    morenoto

    11/26/2021, 4:07 PM
    Hey! I'm trying to encrypt passwords by using a trigger function that stores the user metadata to a table called Users, but the following fails. Am I missing something?
    Copy code
    begin
    
      insert into public."Users" (id, email , name, phone_1, phone_2, id_condo, address, birthday, password  )
      values (
      new.id, 
      new.email, 
      new.raw_user_meta_data->>'name', 
      new.raw_user_meta_data->>'phone_1', 
      new.raw_user_meta_data->>'phone_2',
      (new.raw_user_meta_data->>'id_condo'::text)::uuid,
       new.raw_user_meta_data->'address',
        CAST (new.raw_user_meta_data->>'birthday' as DATE),
        crypt(new.password, gen_salt('bf'))
    
      );
      return new;
    end;
    • 1
    • 3
  • m

    morenoto

    11/26/2021, 4:08 PM
    in theory, crypt is available by default but it's failing here.
  • m

    morenoto

    11/26/2021, 4:09 PM
    I will try to create a separate function as workaround
  • k

    Khan W

    11/26/2021, 5:45 PM
    I just deleted a testing project in hopes of replacing it with a new one, but Supabase won't let me because I've created my max project amount even though I only have two projects (and one of them is paused). Is this the intended functionality?
  • k

    Khan W

    11/26/2021, 5:45 PM
    well would you look at that, right after I asked its now letting me make a new one. Lol sorry for being impatient
  • r

    ralanyo

    11/26/2021, 9:52 PM
    is there a way to pull the first result in a query so i don't have to iterate? Example, in laravel it would look like this...
    Copy code
    $flight = Flight::where('active', 1)->first();
  • p

    pedrodiaz

    11/26/2021, 10:18 PM
    How about slicing?
  • r

    ralanyo

    11/26/2021, 10:27 PM
    you mean js slicing?
  • j

    Jaeden

    11/26/2021, 10:40 PM
    Does anyone know what this error means? I subscribed to a table: This is how I get the data on page load.
    Copy code
    export const getListById = async (id) => {
      return await supabase
        .from('lists')
        .select('*, items:list_items(*), creator:profiles(*)')
        .eq('id', id)
        .single()
    }
    Afterwards, I subscribe to this table like so:
    Copy code
    supabase
            .from(`lists:id=eq.${id}`)
            .on('*', (payload) => {
              switch (payload.eventType) {
                case 'INSERT':
                  console.log(payload.new)
                  break
                case 'UPDATE':
                  console.log(payload.new) // <--- error below occurs here
                  return
                case 'DELETE':
                  this.$nuxt.error({ statusCode: 404, message: 'Page not found' })
                  break
              }
            })
            .subscribe()
    I get the following error on
    UPDATE
    Copy code
    Uncaught tried to push 'access_token' to 'realtime:public:profiles' before joining. Use channel.subscribe() before pushing events
    `
  • u

    user

    11/27/2021, 6:29 PM
    hi! Is there any way we can identify how many auth confirmation emails are being sent out? We'd like to have visibility so we know when we need to upgrade plans. Thanks!
  • m

    Maz

    11/27/2021, 10:57 PM
    I've got a query where I'm getting two different results based on whether I run the query on the server or the client (using Next.js getServerSideProps). I'm guessing there's some difference in the auth uid value that is causing my row level security policy to not apply. Is there anything special I need to do on the server to make sure it has the right auth context set before making queries? I am using setAuthCookie after login
  • t

    tourdownunder

    11/27/2021, 11:23 PM
    Are you using
    security definer
    as that will run the function with the user permissions of the function owner / superuser.
  • c

    cookie mob

    11/28/2021, 12:57 AM
    Hi, quick question... does supabase support live chat apps with free or paid version?
  • n

    nomac-

    11/28/2021, 2:41 AM
    Is anyone having any issues try to update their Auth Settings? No matter what I try to update in there, I get the following error message
  • m

    Maz

    11/28/2021, 2:45 AM
    Not that I'm aware of, I did not use anything beyond
    create policy
    for some basic select/insert/update restrictions that are basically just
    (uid() = user_id)
    . Will server side database calls always run as superuser? Curious how the library knows whether it's running server side or client side?
  • m

    Maz

    11/28/2021, 2:55 AM
    Ah it would obviously know because I'm using the
    createClient
    result, which is using the anon key. So maybe my solution here is to just use a different client with the service key.
  • m

    Maz

    11/28/2021, 3:13 AM
    Looks like this is exactly what I'm trying to do, hopefully something workable in here: https://github.com/supabase/supabase/discussions/1094
1...143144145...316Latest