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

    e0

    08/15/2021, 4:36 PM
    @User Thanks for responding. How come you doubt it would work? Here are the relevant docs and implementation. https://supabase.io/docs/postgrest/client/rpc#with-count-option https://github.com/supabase/postgrest-js/blob/master/src/lib/PostgrestRpcBuilder.ts#L23
    b
    • 2
    • 10
  • e

    e0

    08/15/2021, 4:47 PM
    rpc bug?
  • a

    Adamo

    08/15/2021, 8:51 PM
    is that for nextjs apps as well?
  • f

    florian-lefebvre

    08/15/2021, 8:54 PM
    Yes. Basically, to get env variables that are not the default ones (I mean NODE_ENV for example), you need this package
  • a

    Adamo

    08/15/2021, 9:10 PM
    hmm. why am I able to console.log the values though?
  • a

    Adamo

    08/15/2021, 9:10 PM
    without dotenv
  • a

    Adamo

    08/15/2021, 9:10 PM
    and I don't see any mention of it on the nextjs website
  • a

    Adamo

    08/15/2021, 9:12 PM
    Oh .. I have to expose them to the client with
    NEXT_PUBLIC_
  • f

    florian-lefebvre

    08/15/2021, 9:32 PM
    I don't use nextsjs but that's the way it generally works with node apps so yeah, frameworks might have their own way of handling env variables
  • d

    DyingAlbatross

    08/16/2021, 5:51 PM
    If I'm using supabase on the server, and the client is passing in their jwt, how do I go about invalidating that jwt if they log out? Right now when they logout I'm passing along their token to
    supabase.auth.api.signout()
    , but it seems like if they make another call with the same token
    auth.api.getUser(token)
    is still giving me the user
  • d

    DyingAlbatross

    08/16/2021, 6:31 PM
    I see now that it revokes the refresh tokens, and maybe that's good enough
  • m

    Mihai Andrei

    08/16/2021, 7:48 PM
    Ye. It will revoke the refresh token. But the access token once it is created, it will work until expiration
  • m

    Mihai Andrei

    08/16/2021, 7:49 PM
    I think you can change the token lifetime from Dashboard
  • d

    DyingAlbatross

    08/16/2021, 8:09 PM
    thanks!
  • s

    swiss

    08/17/2021, 1:24 AM
    I keep getting the following error while trying to insert data into a table
    Copy code
    {
      hint: null,
      details: null,
      code: '42703',
      message: 'column "0" of relation "intervals" does not exist'
    }
    Couldn't find anything on this, and I even temporarily removed my relation keys from the tables to just see if plain inserting something would work but I'm still getting the error. Any ideas why this is happening? If it helps, here's my next.js api route code
    Copy code
    // req.body is an object containing the fields I want the row to have
      console.log("REQ: ", req.body)
      const { data, error } = await supabase
        .from("intervals")
        .insert([req.body])
      if (error) {
        console.log(error)
        res.status(404)
      }
      console.log("NICE: ", data)
      res.status(200).json(data)
    s
    • 2
    • 3
  • s

    silentworks

    08/17/2021, 2:56 PM
    Getting error while inserting data into table
  • t

    tricked

    08/18/2021, 5:31 PM
    How would i go about serving a image in supabase storage to a api?
  • t

    tricked

    08/18/2021, 5:32 PM
    i currently have this
    Copy code
    js
    const img = await supa.storage.from("images").download(`image.png`);
    return Buffer.from(await img.data.text(), "binary");
    ( using fastify if that matters )
  • u

    unix17

    08/18/2021, 10:22 PM
    Hi there, have a question about auth.signIn({phone}) and auth.session() not working but with auth.signIn({email, password}) work fine
  • u

    unix17

    08/18/2021, 10:25 PM
    Maybe someone use auth with phone and have some examples
  • c

    claud9

    08/19/2021, 7:32 PM
    Does anyone have any good examples of how they encrypt data?
  • s

    swiss

    08/19/2021, 10:41 PM
    Can someone help me out? Still can't get relationships to work and it's gonna be a dealbreaker if I can't. I can get one way relationships working (eg table 2 stores foreign key of id from table 1), but once I try to connect table 1 over to table 2 I get this error
  • s

    swiss

    08/19/2021, 10:44 PM
    For more context, I have a table called
    actions
    . It has columns
    id: int8
    (autogenerated),
    name: varchar
    ,
    status: varchar
    . I also have a table called
    logs
    with the columns
    id: int8
    ,
    start: timestamp
    ,
    stop: timestamp
    ,
    action: foreign key relation(id on actions)
    . That all works, but when I try to add another column on
    actions
    called
    logs
    and make that a foreign key it doesn't work. I've tried it as an array as well cause that's what I prefer, but that doesn't work. Essentially, one action can have many logs, but one log can only have one action. What am i doing wrong?
  • j

    jason-lynx

    08/20/2021, 3:50 AM
    if 'one action can have many logs, but one log can only have one action' (one-to-many), then you only need a foreign key on the logs table
  • j

    jason-lynx

    08/20/2021, 3:51 AM
    and any time you need any information, joining on this foreign key should give all you need?
  • j

    jason-lynx

    08/20/2021, 3:55 AM
    > one way relationships working (eg table 2 stores foreign key of id from table 1) because this is already a 2-way relationship
  • s

    swiss

    08/20/2021, 1:02 PM
    Thanks for the response. What do you mean joining on this key? I've heard of the term joins in SQL, but how does that look in supabase?
  • s

    soedirgo

    08/20/2021, 5:28 PM
    What jason meant is you don't need the
    logs
    column on the
    actions
    table. You should be able to query
    logs
    through
    actions
    as per https://supabase.io/docs/reference/javascript/select#query-foreign-tables and it should just work.
  • j

    jcald

    08/20/2021, 5:42 PM
    https://developer.mozilla.org/en-US/docs/Web/API/console#usage esta divertido, comenten en que navegadores les funciona, lo hice en node, me funciona console.table, y no el "%c", no sabia que console tenia formato.
  • s

    swiss

    08/20/2021, 7:51 PM
    Ah I see, thanks!
1...101112...81Latest