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

    Milou

    02/18/2022, 10:58 PM
    How can I turn a call to the supabase service into an Observable?
  • m

    Milou

    02/18/2022, 10:59 PM
    Copy code
    ts
      getQuestion(id : string) : Observable<question> {
        const question = from(this.supabase.from('question').select('*').eq('id', id).single())
        return question as unknown as Observable<question>
    
      }
  • m

    Milou

    02/18/2022, 10:59 PM
    is this correct? this feels very wrong.
  • f

    ferpintado

    02/19/2022, 2:18 AM
    does anyone know the default password for the studio running
    supabase cli
    ? I am trying to connect pgadmin but I can't find the server user's password
  • a

    Ash

    02/19/2022, 3:13 AM
    Hello! I'm developing a web app that purposefully doesn't have any javascript in the frontend. A problem I am running into is that the password reset link uses fragment identifiers so my server doesn't receive any information about the access token. I see in https://discord.com/channels/839993398554656828/843999948717555735/936343291685900399 the suggested solution was to convert the "#" to "?" using javascript in the frontend, but since that is not possible for me, anyone have any creative solutions to work around the restriction?
  • s

    silentworks

    02/19/2022, 4:39 PM
    Flattening the returned JSON object
  • p

    phil

    02/19/2022, 5:28 PM
    Completly new to supabase but when i run
    npm i @supabase/supabase-js
    i dont see it in packages.json This is the output:
    Copy code
    ├── @supabase/supabase-js@1.30.3  extraneous
    ├── UNMET PEER DEPENDENCY fibers@>= 3.1.0
    ├── UNMET PEER DEPENDENCY node-sass@^4.0.0 || ^5.0.0 || ^6.0.0
    └── UNMET PEER DEPENDENCY typescript@>=3.3.1
    However I see it in node_modules. How come its not in packages.json?
  • p

    PixelPage ᶠᵒˡᶤᶻᶻᵃ

    02/19/2022, 7:43 PM
    Hello, I use supabase in deno ( https://deno.land/ ) and if i run
    Copy code
    ts
    import { createClient } from "https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm"
    
    
    const supabase = createClient('---', '---', {})
    let table = supabase.from("guild_settings")
    let tableselect = table.select()
    console.log(tableselect)
    i get this back
    Copy code
    ts
    h {
      shouldThrowOnError: false,
      fetch: <ref *1> [Function: A] {
        ponyfill: true,
        default: [Circular *1],
        fetch: [Circular *1],
        Headers: [Function: p],
        Request: [Function: v],
        Response: [Function: E] { error: [Function], redirect: [Function] }
      },
      url: URL {
      href: "---",
      origin: "---",
      protocol: "https:",
      username: "",
      password: "",
      host: "---",
      hostname: "---",
      port: "",
      pathname: "/rest/v1/guild_settings",
      hash: "",
      search: "?select=*"
    },
      headers: {
        "X-Client-Info": "supabase-js/1.30.3",
        apikey: "---",
        Authorization: "---"
      },
      schema: "public",
      _subscription: null,
      _realtime: k {
        accessToken: null,
        channels: [],
        endPoint: "---",
        headers: { "X-Client-Info": "supabase-js/1.30.3" },
        params: {
          apikey: "---"
        },
        timeout: 10000,
        transport: [Function: r],
        heartbeatIntervalMs: 30000,
        longpollerTimeout: 20000,
        heartbeatTimer: undefined,
        pendingHeartbeatRef: null,
        ref: 0,
        logger: [Function: T],
        conn: null,
        sendBuffer: [],
        serializer: j { HEADER_LENGTH: 1 },
        stateChangeCallbacks: { open: [], close: [], error: [], message: [] },
        reconnectAfterMs: [Function],
        encode: [Function],
        decode: [Function: bound decode],
        reconnectTimer: g { callback: [Function], timerCalc: [Function], timer: undefined, tries: 0 }
      },
    ( a lot more but no actual data )
  • c

    chipilov

    02/19/2022, 7:59 PM
    select() returns a promise-like object, so you you are printing the promise-like object, NOT the data that will be returned after the promise resolves. If you want to print the data you should do something like this:
    Copy code
    let tableselect = (await table.select()).data
    console.log(data)
  • c

    chipilov

    02/20/2022, 6:32 PM
    not sure what to tell you - I guess either the JS code you fetch from jsdeliver is an older version of the JS client or the Deno runtime imposes some restrictions on what you can call with await
    p
    • 2
    • 3
  • p

    PixelPage ᶠᵒˡᶤᶻᶻᵃ

    02/19/2022, 8:11 PM
    when i await it
  • r

    realjesset

    02/19/2022, 8:16 PM
    I am trying to create a policy where if the user has the role of "administrator" it allows it to do CRUD. I have a
    profile_roles
    table with
    id
    referred to
    user.id
    from supabase and it also has
    role
    which is my own custom values. so a policy for a different table I tried doing:
    Copy code
    sql
    SELECT CASE WHEN EXISTS (
    SELECT id, role 
      FROM public.profile_roles 
        WHERE id = auth.uid() 
           AND role = "administrator"
    ) 
    THEN CAST(1 AS BIT)
    ELSE CAST(0 AS BIT) END
    basically what I am trying to do is select from
    profile_roles
    and see if the
    auth.id
    from supabase and
    role
    is of admin. if so, pass, if not, fail. however I get an error message saying
    policy syntax error on/near SELECT
    any help is appreciated, thanks!
    s
    • 2
    • 4
  • j

    jjj.westra

    02/19/2022, 9:43 PM
    Hi there, Anyone who knows the answer to this? : My users are logged in and they want to login to an additional device without typing their password, I have a way of securely getting the JWT token to the other device. Can I authorise in supabase with just the JWT token?
  • j

    jjj.westra

    02/19/2022, 10:02 PM
    For now i will get the entire object from the localstorage
  • p

    phil

    02/20/2022, 3:02 AM
    Settings
  • m

    MrBaconDev

    02/20/2022, 3:36 AM
    Hi everyone. Is it possible to query the users table to get a list of all users? I cannot see any documentation to fetch all users. A blog post I read suggested creating another table to store an identical copy. Any thoughts on this? TY!
  • a

    and3rsonsousa

    02/20/2022, 3:37 AM
    I guess not. Users are private.
  • a

    and3rsonsousa

    02/20/2022, 3:38 AM
    You can create a profiles table and link them to users and then select the profiles
  • m

    MrBaconDev

    02/20/2022, 3:55 AM
    Ok, thanks!
  • p

    phil

    02/20/2022, 4:08 AM
    On the same topic, i was looking at creating a function that adds a role to a table when a new user signs up. So basically adds a user to profiles and sets the id and username. What does this mean:
    values (new.id, new.raw_user_meta_data ->> 'username');
    Where does it get the username from? Like can i pass it to this from the form when i create the user?
  • p

    phil

    02/20/2022, 4:25 AM
    Basically I have a form with 3 fields: username, email, password. Now after I cann signUp it triggers an insert into a table called profiles. But how do I get the username from the form into that triggered function? Or do I have to manually insert the row into profiles with username?
  • a

    and3rsonsousa

    02/20/2022, 4:37 AM
    I made it manually right after the user signup. But you can create a Postgres function and trigger it right after the user signup. If I'm not mistaken, there is a tutorial on the youtube channel about it.
  • n

    nsadeh

    02/20/2022, 4:53 AM
    Hello, how do I revoke a token on Supabase?
  • j

    jon.m

    02/20/2022, 6:10 AM
    how would you select from the bottom of a table, in other words, the most recently added rows?
  • p

    phil

    02/20/2022, 6:11 AM
    maybe this works:
    Copy code
    select * from my_table
      order by id desc
      limit 1
  • j

    jon.m

    02/20/2022, 6:12 AM
    Ah, that does seem logical. Thank you. I'm using the supabase front end client though
  • w

    warlic

    02/20/2022, 6:12 AM
    Hi I am trying to self host supabase
  • w

    warlic

    02/20/2022, 6:12 AM
    i installed on my mac with docker desktop
  • w

    warlic

    02/20/2022, 6:12 AM
    but the API section seems to be not working
  • p

    phil

    02/20/2022, 6:13 AM
    @User then something like:
    Copy code
    onst { data, error } = await supabase
      .from('my_table')
      .select('*')
      .order('id', { ascending: false })
1...224225226...316Latest