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

    Sophic

    12/14/2021, 5:28 AM
    Yea
  • t

    theboss

    12/14/2021, 8:37 AM
    did you solve the problem?, i have the same problem
  • t

    theboss

    12/14/2021, 8:45 AM
    Hello, Although realtime listener worked fine about 1 week ago, when I test again today it does not work, I am working with flutter. What could be the reason for this? Replication settings on help me with this
  • p

    Poypoypoy

    12/14/2021, 9:27 AM
    anyone encouter this?
  • s

    shivam51

    12/14/2021, 12:46 PM
    Copy code
    js
    
          let { data: todo, error } = await supabase
            .from('todos')
            .insert({ task, user_id: user.id })
            .single()
    What does data:todo mean here?
  • s

    shivam51

    12/14/2021, 12:47 PM
    I mean syntax wise won't
    let {todo, error}
    be enough?
  • c

    chipilov

    12/14/2021, 12:48 PM
    I think this means you want to rename the "data" property of the object returned from the supabase call to "todo". You cannot just say { todo, error } to start with because there is no "todo" property on the object returned from the supabase call
  • c

    chipilov

    12/14/2021, 12:48 PM
    You are basically saying "I want to take the "data" property from the returned object and from now on I want to refer to it by "todo"
  • s

    shivam51

    12/14/2021, 12:51 PM
    that makes sense. Thanks
  • s

    shivam51

    12/14/2021, 12:52 PM
    How do we know what the property is of the returned promise? Is it mentioned in the docs anywhere that it will be called
    data
    ?
  • c

    chipilov

    12/14/2021, 12:56 PM
    If you use TypeScript, you can just navigate to the definition of the method and see what it returns. If you use JavaScript, you would need to check the docs (https://supabase.com/docs/reference/javascript/select) - I personally use TypeScript so rarely look at the docs and I am not sure how complete they are
  • m

    Muphet

    12/14/2021, 1:23 PM
    anyone by any chance seen this and got a working solution (that doesn't require user to relogin)? https://github.com/supabase/supabase/discussions/2260
  • s

    shivam51

    12/14/2021, 1:39 PM
    follow up question, For typescript, how can I look at the definition of the function. Just by ctrl + click in vscode and keep going into the implementattions right? Just makingsure if there is a better way to do this.
  • k

    korayem

    12/14/2021, 1:55 PM
    I wanted to do something fairly simple: Whenever a table has an update, create, or delete, a trigger should fire on that table, calling a function that calls an API I was pulling my hair all day alternating between http and net_http but I finally made it work by creating this function
    Copy code
    DECLARE
            status_result integer;
        BEGIN
            SELECT status INTO status_result FROM
            net.http_post(
            url:='https://api.cloudflare.com/',
            body:='{"key":true}'::jsonb,
            headers:='{"Content-Type": "application/json","Authorization": "Bearer authkey"}'::jsonb
    );
            RETURN NULL;
        END;
    Just tie that function to a table trigger and you're good to go Just thought of sharing in case anyone is struggling the same
  • c

    chipilov

    12/14/2021, 2:05 PM
    yep, just like that
  • d

    dcuk89

    12/14/2021, 2:19 PM
    Thanks, I’ll give this a go. It’s not just local storage though, the cookie isn’t being removed either
  • t

    TimJMartin

    12/14/2021, 3:06 PM
    Hi, v new to Supabase but was looking to build an API from some geospatial data. I have enabled the PostGIS extension and then tried to restore my data from a compressed dump file using pg_restore -j 4 -U postgres -h my_superbase_host -p 5432 -d postgres -c -v -O filename.dump.gz But it looks like it cannot find the postgis tables like spatial_ref_sys and so I see the following error pg_restore: error: could not execute query: ERROR: type "public.geometry" does not exist Can anyone help? Maybe I need to update the search_path so it finds the postgis core tables and functions? Thanks
  • g

    garyaustin

    12/14/2021, 3:40 PM
    PostGis is installed in the extensions schema and you'll need that in the search path... https://github.com/supabase/supabase/discussions/4474
  • t

    TimJMartin

    12/14/2021, 4:33 PM
    Thanks for the link. I will try and update the search path to include the 'extensions' schema.
  • f

    Fabian B.

    12/14/2021, 5:02 PM
    Hello together! Hope this wasn't questioned here in any way, but I couldn't find something. I have some issues with the new Realtime on RLS Tables Feature. I setuped all the RLS stuff and it works perfectly on almost all my tables. With create, update, delete updates. But, for one table, which has a
    jsonb
    field in it, it just completely doesn't work and throws errors. It even kicks me off the websocket connection after the errors happen. I connect to the table like in the docs
    Copy code
    const mySubscription = supabase
      .from('notes')
      .on('*', payload => {
        console.log('Change received!', payload)
      })
      .subscribe()
    on the initial connection itsself, everything works. But as soon as the content changes, I get these errors in the JavaScript Console:
    Copy code
    Could not convert cell of type jsonb and value [object Object]
    This is the error: SyntaxError: Unexpected token o in JSON at position 1
    These errors are thrown from JS files provided by the supabase extension, so it's not my code throwing them. (
    transformers.ts
    and
    browser.js
    ) after this happens, the websocket connection just completely closes and the console shows:
    Copy code
    WebSocket connection to 'wss://uzmluoivxnndbkjoajhn.supabase.co/realtime/v1/websocket?apikey=MY_API_KEY_IS_HERE&vsn=1.0.0' failed:
    am I missing something? Is Realtime not working for
    jsonb
    fields yet? Or is this a known bug somehow. If not, I would create an issue in the supabase/realtime repo in GitHub. Thanks for your help in advance!
  • c

    codesalim

    12/14/2021, 5:44 PM
    Hello everyone, I get this error on the deployed version but it works on localhost. Thank you
  • m

    mohnish

    12/14/2021, 5:59 PM
    Hey all, simple question - I can’t figure out how to create a view in supabase. Would anyone know how that is done? I saved a custom query but don’t know where to go from there
  • f

    Fabian B.

    12/14/2021, 6:05 PM
    @User Did you read the article about views? https://supabase.com/blog/2020/11/18/postgresql-views you have to actually execute the
    CREATE VIEW ...
    sql code. after that, you can select the view like it's a table.
  • b

    bishop

    12/14/2021, 8:22 PM
    Hey guys, how do I integrate stripe or other payment providers to supabase? Are there any plugins ?
  • j

    jensen

    12/14/2021, 9:21 PM
    have you seen this? https://egghead.io/courses/build-a-saas-product-with-next-js-supabase-and-stripe-61f2bc20
  • j

    jordan801

    12/15/2021, 3:09 AM
    Does anyone know if there's a way to sign a JWT using RS256. I know it's kind of weird. I'm using the http extension to make a request that requires the self signed JWT using RS256. Or is this a don't do it, its not worth it situation?
  • k

    kathy

    12/15/2021, 5:53 AM
    can we make triggers to auto add metadata to auth.users on signup?
    s
    • 2
    • 3
  • j

    jensen

    12/15/2021, 5:58 AM
    I haven't tried it that way, although I don't know why not. I tend to create a
    profiles
    and
    private_profiles
    table. Then I make a trigger on
    auth.users
    to add records to those tables. The
    profiles
    are visible by
    auth.role() = 'authenticated'
    and the
    profiles_private
    are only visible by
    auth.role() = user_id
    . I have an example here https://github.com/jensen/chatatat/blob/main/src/services/schema/tables.sql at the top of the file. Although in this version I opened up the profiles to all users, but users can browse without auth, just can't post.. so in this case it is what I needed.
  • k

    kathy

    12/15/2021, 6:14 AM
    appreciate the help and example! definitely helpful and i see the problem that this solves. i was actually asking mainly because i'm trying to avoid querying 'profiles' and just store some frequently-accessed info in metadata lol
  • j

    jensen

    12/15/2021, 6:42 AM
    Yeah, that makes sense. Since I use React I just put the user info into a context. Which makes it just as easy to get it as calling supabase each time. Otherwise I can see why you want that data stored in the localStorage
1...159160161...316Latest