https://supabase.com/ logo
Join Discord
Powered by
# javascript
  • n

    nickbrinser

    08/05/2022, 11:42 PM
    I’m using the auth-helpers for nextjs and I’ve run into two things today. 1. When using
    withPageAuth
    should I expect
    InferGetServerSideProps
    to work properly? 2. `getUser()`'s return type is resolving user and error as
    any
    . Anyone else seeing this?
  • n

    neupaneanish

    08/06/2022, 8:35 AM
    How to use supabase auth with Prisma and nextjs ?
  • b

    bh

    08/06/2022, 9:41 AM
    How do we use import maps in edge functions? (as in https://deno.land/manual/node/import_maps )
    o
    • 2
    • 1
  • i

    imousart

    08/06/2022, 1:07 PM
    select data with un exist row id return 'No properties' .. how i can return error not exist?
  • g

    garyaustin

    08/06/2022, 2:31 PM
    You could use .single() if you are expecting only one row back. Otherwise you can check for empty array and generate an error. Assuming I'm understanding your question correctly.
  • i

    imousart

    08/06/2022, 2:33 PM
    Actually yes.. I tried single() and get error like i want 👍🏼
  • o

    Olyno

    08/06/2022, 2:38 PM
    Deno - Use maps in edge functions
  • j

    joshcowan25

    08/07/2022, 4:51 AM
    When using Supabase Sveltekit Auth Helpers, I get an error with my post Request: __vite_ssr_import_0__.supabaseServerClient.from is not a function I import supabaseServerClient in my API endpoint (import { supabaseServerClient, withApiAuth } from "@supabase/auth-helpers-sveltekit";), I have this error. I
    s
    s
    • 3
    • 8
  • j

    joshcowan25

    08/07/2022, 4:51 AM
    The API endpoint look like that
  • j

    joshcowan25

    08/07/2022, 4:52 AM
    In my browser console, I get: Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
  • s

    silentworks

    08/07/2022, 8:59 AM
    When using Supabase Sveltekit Auth
  • j

    Jer

    08/07/2022, 11:24 PM
    Hi all, i’m writing a React Native app. I’m currently trying to redirect email verification into an expo app deep link and I have two questions about the email verification flow: 1. Is it possible to make the verification redirectUrl use a query param (?) instead of a hash (#) before the access token and refresh token? 2. Will supabase automatically handle it if it’s in the URL? If not do i have to parse those values and call a supabase function?
  • g

    garyaustin

    08/07/2022, 11:47 PM
    1 No. If you searched hash in the upper right, you would find this discussion from 3 days ago: https://discord.com/channels/839993398554656828/1004846008309661726/1004951985402949652
  • j

    Jer

    08/08/2022, 12:03 AM
    Ahh, thanks. Sorry for not searching.
  • g

    garyaustin

    08/08/2022, 12:05 AM
    No worries, it is not just you. I'm going to start pointing it out more for easy searches (not all are) in general as it saves everyone time (waiting and responding).
  • Olyno (2022-08-08)
    n

    Needle

    08/08/2022, 12:20 PM
    Thread automatically created by @Olyno in #869406062036529193.
    • 1
    • 1
  • a

    apollo79

    08/08/2022, 12:59 PM
    Hi, I want to write a web-chat-app and I think of using supabase. However, some of the features, e.g. "who-is-online", are, afaik, not possible only using supabase. My question is, if supabase is a good choice for my usecase and how to use it: 1. If I have a websocket connection to my server, should I make all requests through this connection or should I send requests via the API from the client? 2. I would like to use the supabase auth, because it seems pretty good. Is that a good idea if I have my own server?
    n
    s
    • 3
    • 16
  • k

    Kellen Mace

    08/08/2022, 2:06 PM
    Hi all! Quick question on best practices for deleting DB data. In my app, when a user deletes a Rule from the
    rules
    table, I need to also delete the rows in the
    checks
    and
    mentions
    tables that are related to that rule. Per my RLS policies, users can delete rows from
    rules
    if they created them, but can not delete anything from
    checks
    and
    mentions
    – those tables are used for internal purposes. What's the best way to delete this data? Here are two options I came up with: * Option 1: Create a postgres function that accepts a Rule ID and deletes the rows in
    checks
    and
    mentions
    that are related to that rule. Set up a trigger so that when a Rule is deleted, that function executes. * Option 2: Create a postgres function that is responsible for deleting the data from all three of those tables (using the Service role to delete the data in
    checks
    and
    mentions
    ), and call that postgres function from my frontend app using the JavaScript RPC API I think #1 is probably the cleaner approach. I'd love to get some feedback on it, though! Which do you think is best? Is there a third option I haven't considered?
    n
    p
    • 3
    • 8
  • c

    chano08

    08/08/2022, 2:24 PM
    hi all!, how to rename field in js..
    supabase.from('table1').select('id as _id')
    ?
    n
    g
    g
    • 4
    • 20
  • u

    unknown1337

    08/08/2022, 3:04 PM
    Hi All, supabase has a nice JS library and can support graphQL as well. I've a DB scheme with multiple related tables (user->profile->company->workspaces->workspaces_devices->devices ,...). I'm started with the supabase JS library + a pinia store for every DB table. The further I get with my application the more I get the feeling that a non ORM store was the wrong choice. What's your opinion & do you have tips/ drawbacks on the idea to 1. switch my store to an ORM store (Vuex ORM vs piniaORM)? 2. is there a drawback of using the vuex ORM + graphql library s.t. I do not have to write any 'supabase queries' ?
    n
    • 2
    • 1
  • m

    mikewilliams

    08/08/2022, 8:44 PM
    Does anyone know if table size affects performance of a realtime listener? Even if you're just listening to a small or even single set of records? I know in Firebase collection size could cause issues with this, but would think SQL is different. We're starting to have issues with a firebase snapshot listener and might want to switch it over. In some cases we would just want to listen for updates on a single record.
    n
    • 2
    • 1
  • d

    Dex_Vinyl

    08/08/2022, 9:17 PM
    hey folks, I'm sure i'm being a dumbass with this, and am missing something crazy obvious, but, so far tonight it's escaped me.
    Copy code
    const {reasonData, reasonError } = await supabase
            .from('libraryUnavailableReasons')
            .select("*")
            //.eq('unavailablereason',arrayToWrite.uarid)
    
        console.log("Reason: "+reasonData)
    returns :
    undefined
    but if I change
    reasonData
    to
    data
    it works to a point ... I still can't access the data in the objects that are returned, all I get is either
    0
    or
    1
    , I don't like using such generic variables, though, can anyone advise on either of these issues?
    n
    s
    g
    • 4
    • 23
  • s

    srgg

    08/08/2022, 9:31 PM
    Hey folks. New here; very basic question. I wanted to try out the magic auth from supabase and downloaded one of the prebuilt projects. The authentication worked once, but I had the auth redirect pointed to my vercel endpoint - which hosts the same application that I run locally. Upon changing the auth redirect to
    localhost:3000
    I was met with what looked like failed redirects or dead links. I believe they're a malformed URL, but cannot tell if it's something I've done (modified the repo very little). To clarify: Any magic auth login sends the appropriate email and registers a user, except when set to localhost:3000, I get
    {"message":"No API key found in request"}
    - despite seeing the api key in the returned header. If anyones had a similar issue with magic auth providing dead redirects, could you help point me in the right direction? Happy to share the repo or provide any clarification. Thank you.
    n
    s
    • 3
    • 5
  • h

    hexcowboy

    08/09/2022, 8:59 AM
    how do i use the supabase client on my backend to insert sql data as an admin on a RLS table? as in i want to run:
    Copy code
    js
      const { data, error } = await supabase.from("my_table").insert(
        [
          {
            id: randomUUID(),
          },
        ]
      );
    as an admin (no auth) and bypass the rls protection
    n
    e
    a
    • 4
    • 5
  • r

    React noob

    08/09/2022, 9:10 PM
    Copy code
    ts
        useEffect(() => {
            loadProfile()
        }, [])
    
        useEffect(() => {
            downloadImage()
        }, [])
        // Function 
        async function loadProfile() {
            const { data, error } = await supabase.from('profiles').select('*').eq('id', user?.id).single()
            if (error) console.log(error)
            else setProfile(data)
        }
    
        async function downloadImage() {
            await supabase.storage.from('avatars').download(avatar_url)
            if (responseBlob) {
                const blob = new Blob([responseBlob], { type: 'image/*' })
                const imgUrl = window.URL.createObjectURL(blob);
                if (imgUrl) {
                    setSrc(imgUrl)
                }
            }
    i don't understand why but i always got a 404 error not found. but the url i provided is correct
    n
    • 2
    • 1
  • g

    GuySake

    08/10/2022, 9:00 AM
    Hello ! I'm trying to subscribe to updates on a list of IDs like so:
    Copy code
    js
    supabase.from(`projects:id=in.(${projectsIds})`)
      .on('UPDATE', (payload) => {
        console.log('Change received in projects list', payload)
      }).subscribe()
    My guess was that it would work like in the doc with
    id=eq.200'
    . So my question is, is the
    in.(${arr})
    available ? Or is it only
    eg.${val}
    ?
    n
    g
    p
    • 4
    • 9
  • u

    unalive8

    08/10/2022, 1:15 PM
    Helo, does the wildcard selector for site url not work with supabase js?
    n
    s
    • 3
    • 2
  • h

    hexcowboy

    08/11/2022, 3:24 AM
    is there a way to create a regular SQL query without having to define a postgres function and call it over rpc? from the javascript client
    n
    • 2
    • 2
  • p

    PoisnFang

    08/11/2022, 5:24 AM
    I want to know if it is possible to use the SupabaseClient in js to execute a query like this:
    Copy code
    sql
    select *
    from my_tableas f 
    where f.this_column = f.another_column
    n
    t
    • 3
    • 2
  • o

    Olyno

    08/11/2022, 1:14 PM
    ============================= Channel locked. Please ask in #1006358244786196510. =============================