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

    B0N3SY

    02/26/2022, 9:28 PM
    i didnt know if the db address should be posted so i was gonna dm the error, thank you though
  • d

    Darryl

    02/27/2022, 3:34 AM
    Has anyone ever added a header to the http_post method? I don't see anywhere in the documentation for this value https://github.com/pramsey/pgsql-http https://supabase.com/docs/guides/database/extensions/http
  • g

    garyaustin

    02/27/2022, 3:37 AM
    I've used headers in the http function like this: begin return ( select status FROM http(( 'DELETE', url, ARRAY[http_header('authorization','Bearer '||service_role_key)], NULL, NULL )::http_request) ); end;
  • d

    Darryl

    02/27/2022, 3:38 AM
    I have a body to send as well, which NULL should it go?
  • d

    Darryl

    02/27/2022, 3:43 AM
    Ahh nvm it's in this format. Appreciate you bro !
  • d

    DanMossa

    02/27/2022, 4:26 AM
    Need help regarding differences in the flutter guide vs what's in the example repo if anyone has a chance https://github.com/supabase-community/supabase-flutter-quickstart/issues/8
  • n

    nkeating

    02/27/2022, 4:50 AM
    What is the best way to track changes to schemas in supabase? We have a number of team members editing columns across large number of tables, and its tough to stay up with tall the changes...
    s
    s
    • 3
    • 3
  • s

    silentworks

    02/27/2022, 10:03 AM
    Keeping track of schema changes
  • s

    silentworks

    02/27/2022, 10:05 AM
    Aggregating data
  • e

    Erwin

    02/27/2022, 12:07 PM
    Is there a way to store / use secrets, like an API token, within a Postgres function? Use case: our users can upload and delete images. I need to check the authorizations of the user before deleting an image. Seems like the workflow that minimizes number of network calls would be: 1. Call Postgres function to check authorization 2. Delete in external storage using an HTTP call from the Postgres function 3. If successful, remove from the DB We're using an external storage provider (for now 😉 ), so the HTTP call requires an API access token we don't want to expose. I don't know enough about Postgres to know if I can just define it inline in the function (as long as I don't commit the code), if there is an extension to store secrets or if it's just not doable
    c
    • 2
    • 8
  • c

    chipilov

    02/27/2022, 12:57 PM
    Using secrets from Postgres functions
  • n

    noxy

    02/27/2022, 1:14 PM
    Hello, I've wanted to try self hosting supabase recently and encountered some problems. Selfhosting on my own pc was pretty easy, but when I tried doing that on remote device (raspberry pi in my case) i get "Error: [500] An error has occured: request to http://meta:8080/tables failed, reason: connect ECONNREFUSED 172.18.0.7:8080" on studio page. When i go into meta container logs there's just one error: standard_init_linux.go:228: exec user process caused: exec format error
  • n

    noxy

    02/27/2022, 1:14 PM
    Has anyone encountered it before?
  • n

    noxy

    02/27/2022, 1:16 PM
    I don't think that matters, but I'm using portainer to set up containers remotely
  • n

    noxy

    02/27/2022, 1:24 PM
    Okay i think it was pretty dumb mistake
  • n

    noxy

    02/27/2022, 1:24 PM
    somehow i assumed that it would work on raspberry architecture
  • n

    noxy

    02/27/2022, 1:24 PM
    im almost certain it's because supabase is not made for arm architecture
  • w

    Wlad Paiva

    02/27/2022, 1:33 PM
    Mock external resquests
  • j

    JeremiahP&P

    02/27/2022, 2:06 PM
    Hi good morning. I am in the process of creating an app for the first time. This app will allow user to take something from list a, add it something from list b, add something from list c, and have those three aforementioned thing equal something already in list d. IIm having trouble figuring out how to create the relationships between table items. Any idea where I can learn this? I know databse administration is a huge topic, Im just looking to learn a very simple part. Any ideas where i can find this info?
  • u

    5inful1

    02/27/2022, 2:30 PM
    Hello, could someone point me in the right direction. I'm using sveltekit with supabase where I'm using the onMount and onDestory to manage my subscription to data. I naively think it would be as easy as calling an unsubscribe funtion i have saved in another file.
    Copy code
    html
    <!--__layout.svelte-->
    <script>
        import { pts, loadPoints, unloadPoints } from '$lib/store/pointsStore.js';
        import { onMount, onDestroy } from 'svelte';
     
        onMount(async () => loadPoints());
      onDestroy(async () => unloadPoints());
    
      $:console.log($pts)
    </script>
    Copy code
    js
    //pointsStore.js
    import { supabase } from './supabase.js';
    import { writable } from 'svelte/store';
    export const pts = writable(false);
    let mySubscription;
    
    export const loadPoints = async () => {
        try {
            let { data, error } = await supabase.from('points').select('*');
            pts.set(data);
    
            mySubscription = supabase
                .from('points')
                .on('INSERT', (payload) => {
                    pts.set([...data, payload.new]);
                })
                .subscribe();
    
            if (error) throw error;
        } catch (err) {
            console.error('Error loading data: ', err.message);
        }
    };
    
    export const unloadPoints = async () => {
        console.log("what other subscriptions exist? : ", supabase.getSubscriptions());
        await supabase.removeSubscription(mySubscription);
    };
    what am I doing wrong?
  • u

    5inful1

    02/27/2022, 2:33 PM
    I'm getting this error if (!subscription.isClosed()) { ^ TypeError: Cannot read properties of undefined (reading 'isClosed')
  • u

    5inful1

    02/27/2022, 3:00 PM
    Copy code
    js
    //pointsStore.js
    import { supabase } from './supabase.js';
    import { writable, get } from 'svelte/store';
    
    export const pts = writable(false, (set) => {
       supabase
        .from('points')
        .select('*')
        .then(({data}) => set(data))
      
      const mySubscription = supabase
      .from('points')
      .on('INSERT', (payload) => set([...get(pts), payload.new]))
      .subscribe();
    
      return () => supabase.removeSubscription(mySubscription);
    });
    Ok I'm trying this way instead however I still don't know if this will generate errors.
    g
    • 2
    • 2
  • g

    garyaustin

    02/27/2022, 3:14 PM
    sveltekit and realtime subscription
  • d

    Darryl

    02/27/2022, 3:53 PM
    Does anyone know why I'm getting malformed array literal 'application/json' For this ?
    Copy code
    select content::json->>'data'
      into response
      from http((
        'POST'
        'https://api.producthunt.io/v2/api/graphql',
        ARRAY[http_header('Authorization', concat('Bearer ',access_token))],
        'application/json',
        '{
      "\"query\": \"query{ posts(featured: true, first:3, postedBefore: \\\"2022-02-24T19:16:24.318Z\\\", postedAfter: \\\"2022-02-23T19:16:24.318Z\\\"){edges{nodes {{id,name,url,tagline,reviewsCount,productLinks{url},thumbnail{url},topics{edges{node{name}}}}}}}}\"": null
    }'
      )::http_request);
  • g

    garyaustin

    02/27/2022, 4:06 PM
    you are missing a comma after 'POST'
  • c

    Cole

    02/27/2022, 4:19 PM
    I'm working on a project that needs to query the Spotify Web API. If I use Spotify as an authorization step, do I have to reauthorize them to get access tokens and whatnot? Or can I do that through what Supabase already has set up with Spotify Auth?
  • a

    ak4zh

    02/27/2022, 4:30 PM
    I have a table members where birthdate is stored as a
    DATE
    column. How to select all members born on a particular year with supabase.js SQL equivalent will be:
    Copy code
    sql
    SELECT birthdate
    FROM members
    WHERE EXTRACT(YEAR FROM birthdate) = 1990;
    Edit: Solved by adding a view:
    Copy code
    SELECT birthdate, EXTRACT(YEAR FROM birthdate) as birthyear
    FROM members;
  • u

    2old4this

    02/27/2022, 4:31 PM
    How do i get the email_change_token client side? been trying and failing for a while. to update the users email?
  • a

    ak4zh

    02/27/2022, 4:34 PM
    Probably
    auth.email_change_token_new
    or
    auth.email_change_token_current
  • u

    user

    02/27/2022, 4:35 PM
    Hey, I have in database saved peoples birthday as date type, how can I find people by year only? Does mean when user type e.g. 2010 I want take all users that was born in 2010 and it doesn't matter if the are from December or from January. Should i make rpc function? Or is there any option from code to get it?
1...231232233...316Latest