https://supabase.com/ logo
Join DiscordCommunities
Powered by
# javascript
  • j

    jaitaiwan

    05/12/2022, 1:51 AM
    @edgaras I think this might fit your needs: https://www.prisma.io/docs/guides/database/advanced-database-tasks/data-validation/postgresql
  • e

    edgaras

    05/12/2022, 1:58 AM
    Nice, this is exactly what I need:) Btw, what's your opinion in general, keeping more business logic code in database or rather server (NodeJS etc.)? It seems with something powerful as PG, the server code could be very slim. Mainly DB and front-end then.
  • j

    jaitaiwan

    05/12/2022, 2:09 AM
    @edgaras Postgres is somewhat new to me as well. I am not really aware of the trade offs of this sort of approach but I imagine the use case for actually having a backend would be if there’s complicated logic I expect to have to make updates to very regularly. Making DB changes and it not being version controlled is probably a huge con.
  • j

    jaitaiwan

    05/12/2022, 2:10 AM
    I would maybe separate it out into data integrity and permissions in the db and then complex calculations elsewhere
  • e

    edgaras

    05/12/2022, 2:10 AM
    Good points.
  • e

    edgaras

    05/12/2022, 2:45 AM
    Another con could be - the database cannot send back proper and specific error messages I suppose.
  • j

    jaitaiwan

    05/12/2022, 3:11 AM
    That's a really great thought! Although with some functions you can return certain values based on the response so you could have the front-end check the results and see if it's an error
  • j

    jaitaiwan

    05/12/2022, 3:12 AM
    Like adding a pseudo error column with boolean true/false to the result
  • d

    dipesh

    05/12/2022, 6:20 AM
    Hello, I recently found out that
    onAuthStateChange
    function is triggered when I change tabs. For example, If I have my supabase application open in TAB1 and facebook app open in TAB2. When I visit facebook in TAB2 and come back to my supabase application on TAB1,
    onAuthStateChange
    function gets triggered. How do I turn this off?
    j
    • 2
    • 3
  • s

    Sanctus

    05/12/2022, 6:47 AM
    Hi here, junior webdev, building a web app with Sveltekit and Supabase. I'm having a hardtime getting getUserByCookie to work, and all the documention is giving me is: "For server-side management, you can get a user through auth.api.getUserByCookie()" Help would be appreciated 🙂
    g
    • 2
    • 1
  • j

    jaitaiwan

    05/12/2022, 6:59 AM
    onAuthStateChange and multiple tabs
  • m

    Mac

    05/12/2022, 6:29 PM
    Hey folks! In my Supabase project I've got two tables called
    snapshots
    and
    tracks
    . They're connected in a many-to-many relationship via a join table called
    snapshots_tracks
    . Apart from containing proper foreign keys, it has two extra columns named
    added_at
    and
    position
    . Now, I'm using the JavaScript SDK to find a
    snapshot
    with an id equal to given
    snapshotId
    , but I'd like my response to include a
    tracks
    array with each track containing the aforementioned properites as well as all the other `tracks`' columns. While I'm aware that PostgREST is capable of detecting M-M relationships, I couldn't quite figure out how to craft a query described above. Here's what I have so far:
    Copy code
    ts
    const { data } = await supabase
      .from<Snapshot>('snapshots')
      .select(
        `
        id,
        captured_at,
        description,
        num_followers,
        tracks(*)
      `
      )
      .throwOnError(true)
      .eq('id', snapshotId)
      .limit(1)
      .single();
    b
    • 2
    • 12
  • g

    garyaustin

    05/12/2022, 9:25 PM
    Sveltekit and cookies
  • f

    F0rce

    05/13/2022, 3:57 PM
    Order by 2 fields from a foreign table not working as expected
    • 1
    • 2
  • k

    konga

    05/13/2022, 10:25 PM
    What is the best way to manage migrations? I am trying to use Prisma. Love it except for the fact that I can't do Row Level Security. I tried to enable RLS by manually creating a migration but I ran into a problem with it not recognizing "auth". Here is the error
    ERROR: schema "auth" does not exist
  • k

    konga

    05/13/2022, 10:27 PM
    This is my database url.
    postgresql://postgres:postgres@localhost:54322/postgres
    I was reading somewhere about different params you can add to the url, but I didn't understand.
  • k

    konga

    05/13/2022, 10:28 PM
    npx prisma migrate dev
    this is the command that I ran
  • k

    konga

    05/13/2022, 11:24 PM
    I have a table called BetaWaitlistForm
  • i

    its-pablo

    05/14/2022, 1:53 AM
    For on().subscribe(), what is the payload parameter? Where can I find documentation for this?
    f
    b
    j
    • 4
    • 6
  • j

    jaitaiwan

    05/14/2022, 11:37 PM
    @konga Supabase recommends schema diffing instead of migrations
  • k

    konga

    05/14/2022, 11:38 PM
    Could you send me a link to that so I can learn more?
    j
    • 2
    • 4
  • h

    hoesmean

    05/15/2022, 8:33 PM
    Hi there i send data with card to card details, i want to fetch details data with .eq('id', data.id') but it didnt work, can someone help me?
  • l

    laznic

    05/15/2022, 8:44 PM
    Based on that screenshot,
    listing
    is undefined. You probably want to use the
    id
    you've destructed from
    route.params
    instead of
    listing.id
    since it seems that
    listing
    should contain the data you have fetched from Supabase
  • x

    Xzeta

    05/17/2022, 3:51 AM
    What type do you use for error?
    Copy code
    const fetchProfile = async () => {
        try {
          const { data, error } = await client
            .from<ProfileType>("profiles")
            .select("*")
            .eq("username", username)
            .single();
          if (error) throw error;
          setProfile(data);
        } catch (error) {
          setError(error);
        }
      };
    Argument of type 'unknown' is not assignable to parameter of type 'SetStateAction<Error | null>'
  • b

    bjorgen

    05/18/2022, 12:13 AM
    Hi all new here using Supabase with
  • k

    konga

    05/20/2022, 6:43 PM
    I am using Nextjs and I am trying to hit the supabase auth endpoint by calling the function
    Copy code
    const { user, session, error } = await supabase.auth.signUp({
      email: 'example@email.com',
      password: 'example-password',
    })
    I have set the anon and supabase url and it works because I can hit the regular rest api. When I use the the auth function, it calls the wrong endpoint.
    Copy code
    http://localhost:3000/undefined/auth/v1/signup
    It should be calling the supabase url and instead of
    Copy code
    http://locahost:3000/undefined
    g
    • 2
    • 3
  • k

    konga

    05/20/2022, 9:48 PM
    I am using Nextjs and I am trying to hit
  • c

    chrisb2244

    05/21/2022, 2:20 AM
    If I'm writing a nextjs API route and want to check if some email addresses are already registered, and if not, send an email, which methods are most suitable? I see there's a listUsers method on auth.api, which looks promising maybe? If I use generateLink or inviteUserByEmail, do I (can I?) receive their (new) user ID immediately?
    g
    • 2
    • 1
  • g

    garyaustin

    05/21/2022, 2:46 AM
    check for email exits
  • k

    kavla

    05/21/2022, 9:24 PM
    Got a very weird one... working with realtime and react native/expo. Realtime calls work fine in the dev client version of the app on iOS and Android and on iOS on prod builds but not android. Anyone seen anything similar? I'm a bit at a loss on how to chase it down
    • 1
    • 2
1...616263...81Latest