https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Does Superbase's PostgreSQL support PLPERL extension?
    s

    skyinteractive

    10/05/2022, 4:54 AM
    There is no explicit mention that PLPERL extension is supported https://supabase.com/docs/guides/database/extensions, could someone confirm this please?
    s
    • 2
    • 1
  • example of upload with progress indicator (with streams)
    t

    Thoth Trismegistus

    10/05/2022, 6:20 AM
    How do i upload a file from client or server with progress data so the users know how long they have to wait?
  • Increment Not Working
    t

    tsnakejake

    10/05/2022, 6:21 AM
    Hello there! I am having a problem doing a basic task in supabase. I am trying to increment a number in a column but it doesn't seem to be working. I am very new to backend and a total beginner to SQL, so I may be doing something silly πŸ˜…
    g
    • 2
    • 50
  • New to supabase, how do I populate my db when I upload a file ?
    z

    zisvh

    10/05/2022, 7:20 AM
    Hey everyone, I'm new to supabase and I would like to add a row in a table for each file I upload (having name, size, date, type and jsonb data for example) Thanks for reading !
    t
    • 2
    • 21
  • Export Postgress table,config,event,trigger to sql command
    t

    tonyhart

    10/05/2022, 7:43 AM
    title
    s
    g
    • 3
    • 4
  • Acceptable method to insert multiple rows
    f

    FrancoT

    10/05/2022, 8:43 AM
    I'm trying to create (x) number of rows in one table and for each of the created rows I want to create (x) number of rows in a different table. Currently I am doing a bulk insert of the first table and then mapping over the returned data and doing a bulk insert for each iteration on the map. To me this feels like there should be a better way to accomplish this. Especially when it comes to having to do any updates.
    Copy code
    const blockObject = blockArray.map((index) => ({
        name: `Training block ${index + 1}`,
        program_id: programId,
        user_id: currentUser?.id,
        state: 1,
        index: index + 1,
      }));
    
    const createBlocks = async () => {
        const { data, error } = await supabase
          .from('blocks')
          .insert([...blockObject]);
    
        createDaysPerBlock(data);
    
        return data;
      };
    
    const createDaysPerBlock = async (trainingBlocks) => {
        const days = trainingBlocks.map(async (block) => {
          const dayObject = dayArray.map((index) => ({
            name: `Day ${index + 1}`,
            block_id: block.block_id,
            index: index + 1,
            program_id: programId,
          }));
    
          const { data, error } = await supabase
            .from('block_day')
            .insert([...dayObject]);
    
          return data;
        });
    
        const result = await Promise.all(days);
        return result;
      };
  • Supabase API query join on multiple fields
    a

    avalanche

    10/05/2022, 8:52 AM
    Let's say I want to join profile on sender_id and receiver_id. Is this a valid syntax? PS: It errors with 'couldn't find relationship between tables'
    Copy code
    dart
        return _client
            .from(_conversationTable) //
            .select('''
                id,
                sender:profile(*)&profile.user_id=sender_id,
                receiver:profile(*)&profile.user_id=receiver_id,
                item:item_id(*),
                created_at
              ''')
            .eq('id', conversationId)
            .limit(1)
            .single()
            .execute()
    g
    • 2
    • 6
  • Quick Question about Supabase Auth emails limitations on pricing page
    e

    Excitor

    10/05/2022, 9:18 AM
    Hello friends πŸ‘‹ I’m creating an app, and to authenticate my users, I send them a magic link. Every time users want to sign up or sign in, they can do so using the link. Do the limits for supabase auth emails on the pricing page (30 or 100 on the pro tier) mean that only 30 or 100 users (on the pro tier) / hour can log in to the app using the magic link?
    s
    • 2
    • 3
  • how to make proper protected routes with Supabase in next JS
    b

    BartWestenenk

    10/05/2022, 10:11 AM
    Hi all, I wanted to make some code that checks server side if the user is allowed to access the route. I don’t really have a clue how to realize this as there is, as far as I could find, no way to get the user data based on the server side. Only client side.
    n
    g
    • 3
    • 21
  • Error Handling Authentication
    c

    cuca

    10/05/2022, 10:16 AM
    Hi guys! I'm trying out the supabase authentication and it's working really good! Congratz on the project. I have an issue that is currently whenever a user tries to authenticate with wrong password the server gives 400 status code instead of 401. Is this intended? Is that possible to change in the project?
    j
    • 2
    • 3
  • Use RLS with raw SQL from an edge function
    a

    Alex CC

    10/05/2022, 10:35 AM
    Hello All, I am working on a project which requires multiple database manipulations to run in a single transaction, and I have this working from an edge function, using the Deno Postgres package and connection pooling. Is there a way to pass on the user parameters from a request within the SQL which would then be used by the RLS function
    auth.uid()
    ? Many thanks
    g
    • 2
    • 3
  • Can I access JSON data of a storage.objects uploaded file ?
    z

    zisvh

    10/05/2022, 11:14 AM
    Title is pretty self explanatory, thanks for your help !
    g
    • 2
    • 19
  • Persisting sessions in an ionic app
    k

    Kedge

    10/05/2022, 2:42 PM
    Hi all, I'm building an ionic app and am using supabase auth for the authentication flow. I have followed the tutorial on the docs site and can log into my app OK, and it appears to be storing the session information into localstorage, so when I restart the app it loads in OK. However when I release a new version of the app to my iPhone this process clears out the localstorage, so I have to anthenticate again. Is there a way that I can get the session stored somewhere more persistent so that app updates don't clear out the session? thanks Rich
    g
    • 2
    • 7
  • Any Example of Supabase based newsletter form?
    h

    heysagnik

    10/05/2022, 3:29 PM
    Hello, I wanna add a newsletter to my blog which uses the Supabase database. Can anyone help me by showing an example?
  • RLS - Help with Insert Policy
    m

    merlo

    10/05/2022, 6:54 PM
    My objective: only an admin can insert an amenity, and it must match the id of the condo the admin already belongs too. I'm trying:
    Copy code
    exists (
      select 1
      from condos
      where auth.uid() = condos.admin_id
    )
    But I'm getting new row violates row-level security policy for table \"amenities\ What am I doing wrong?
    g
    • 2
    • 11
  • Azure with Microsoft Graph example
    m

    Marcus Arnfast

    10/05/2022, 10:15 PM
    Have anyone an example with getting profile pictures and such from the MS Graph provider with Supabase oAuth. https://developer.microsoft.com/en-us/graph/graph-explorer I have no clue on how to get this to work 😦
    k
    • 2
    • 1
  • Local build supabase-postgres docker image stuck in error loop
    m

    Milou

    10/05/2022, 11:04 PM
    Hi, I compiled the supabase/postgres container today according to the info in the wiki, but when I try to start supabase via the docker-compose file in the repo, substituting the default supabase/docker image with my own, the supabase-db container is stuck printing the following: https://pastebin.com/1NGp1pFh
    • 1
    • 5
  • what's a better way to fetch a single user
    k

    KTibow

    10/05/2022, 11:45 PM
    right now if i want to fetch a single user i have to use code like this
    Copy code
    js
      const { data, error } = await schoologyUsers.select().eq("email", email);
      if (!data) throw error;
      const user = data[0];
    however this has some problems - boilerplatey - declares
    data
    and
    error
    so i can't use them again what's a better way to do this? (and yes thankfully this is inside of another reusable function, but i've had to do something like this a couple times)
    g
    • 2
    • 5
  • Device Authentication
    d

    deX

    10/06/2022, 12:23 AM
    Wondering what would be the best way to go about creating device authentication. I'm thinking generate a random user and use that on the endpoint, but wondering how to separate those users from the normal users. Is there a way to add to the roles perhaps? So can separate the real users from the devices. Thanks in advance
    k
    g
    • 3
    • 19
  • Get content range via supabase-js API
    h

    hongymagic

    10/06/2022, 2:11 AM
    Is there a way to specify a range (like S3 SDK) when downloading object from Supabase via JS SDK?
    j
    g
    • 3
    • 3
  • code '42501', details null, hint null, message 'permission denied for schema ' error. what do i do?
    v

    ven

    10/06/2022, 2:48 AM
    Copy code
    // console.log("client", client);
        // get users
        client
            .from("User")
            .select("*")
            .then(({ data, error }) => {
                console.log("data", data);
                console.log("error", error);
            });
    g
    n
    • 3
    • 15
  • How to customize error message from trigger on signup?
    m

    Matt

    10/06/2022, 3:08 AM
    I made a simple trigger that creates a user profile on signup, it correctly stops them from signing up, but the error msg it gets back is empty. Can one be added in the trigger itself? top image is signing up with a username that is already taken, returns error 500
  • How do I create a custom refresh token
    a

    arnu515

    10/06/2022, 6:07 AM
    I know that I can create custom access tokens using the JWT Secret provided by supabase, but I want to create a custom refresh token as well for use with
    supabase.auth.setSession
    . The refresh token doesn't look like a JWT token, but some kind of custom string. I found some code to create it in
    supabase/gotrue
    (https://github.com/supabase/gotrue/blob/master/models/refresh_token.go#L101), but I can't seem to understand it. Please can someone help me?
    g
    • 2
    • 1
  • Creation of FTS column which combines data from two different tables inside VIEW
    d

    dmytro.eth

    10/06/2022, 8:56 AM
    I want to create fts column for the full text search combining the data from two different tables which have relationship between:
    Copy code
    create table countries {
    id: uuid();
    name: string;
    }
    Copy code
    create table cities {
    id: uuid();
    name: string;
    counry_id: uuid references countries(id)
    }
    Copy code
    CREATE VIEW cities_fts
    SELECT 
    cities.id as city_id,
    cities.country_id as county_id, to_tsvector('english', concat_ws(' ', cities.name, country.name )) AS fts
    FROM countries, cities
    WHERE (cities.country_id = countries.id);
    If I query
    .from('custom_view').select(*, counties(*))
    I will get a response with country object included. But if I query
    .from('custom_view').select(*, cities(*))
    I'll get an error about no relationship between
    custom_view
    view and
    cities
    This is because I create a view with
    cities.id
    which is just a id and not a foreign key and
    cities.county_id
    which is a foreign key, right? How can I go around it?
    j
    • 2
    • 3
  • How do I query JSON ?
    z

    zisvh

    10/06/2022, 9:58 AM
    When I guery a JSON filled column, I get the object like on top of the screen. What I would like is the same as at the bottom (a real json object). My function:
    Copy code
    js
        const fetchPlayers = async () => {
          const { data, error } = await supabase
          .from('export')
          .select('data')
          .limit(1)
          .order('inserted_at', { ascending: false })
    
          if (error) {
            setFetchError('Could not fetch')
            setPlayers(null)
            console.log(error)
          }
          if (data) {
            console.log(data)
            console.log(jsonB)
            setPlayers(data)
            setFetchError(null)
          }
        }
    s
    • 2
    • 2
  • FrontEnd requests to backEnd api are loosing the cookie with the authentication.
    f

    franfernandez

    10/06/2022, 11:42 AM
    I'm only able to reproduce at vercel deployment. When I come to the page after some time all the petitions have not the cookie with the token. In which moment of the process is actuating this feature to put there the cookie and there is some way of restore it if this happens ?? Thank you a lot πŸ™‚
  • Postgres data inaccessible - self-hosted
    p

    pemontto

    10/06/2022, 2:22 PM
    Hi there, I'm trying to persist data with the default docker-compose setup. I un-commented
    - ./volumes/db/data:/var/lib/postgresql/data
    . However when I down/up the project
    supabase-db
    refuses to start with
    2022-10-06 12:19:52.986 UTC [1] FATAL:  data directory "/var/lib/postgresql/data" has wrong ownership
    ...
    The server must be started by the user that owns the data directory.
    However I'm not sure what UID the container is using. As a last resort I tried
    chmod -R 777 docker/volumes/db/data
    to no avail
    • 1
    • 5
  • Possible to import users with hashed passwords from e.g. Discourse?
    t

    tkrunning

    10/06/2022, 2:31 PM
    I've been running a community on an instance of Discourse, and would like to migrate to using Supabase for auth. Ideally I would like our members to be able to log in via Supabase using their current email/password credentials without needing to do a reset. Discourse has an explanation for how to export the hashed passwords in a PHC format for importing into other systems (e.g. Auth0 seems to support this): https://meta.discourse.org/t/export-password-hashes-in-the-phc-format/133805/1 Is this something that's possible to import into Supabase as well? Or do you have any other strategies for migrating our members to Supabase Auth without causing any disruption (requiring password resets, etc)?
    o
    • 2
    • 4
  • new.raw_user_meta_data
    r

    Reuben

    10/06/2022, 2:43 PM
    How do I get access to name information when a user is signup with Facebook and Google? ``new.raw_user_meta_data->>'full_name'`` or similar. Tried some combinations.
    g
    • 2
    • 11
  • Custom Project Domain
    p

    PatD

    10/06/2022, 2:53 PM
    Hi, I was wondering if it was possible to use a Custom Domain name for the project rather than using the one provided by supabase? Thanks
    g
    p
    • 3
    • 3
1...383940...230Latest