https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Supabase JS and chrome extension magic link authentication
    s

    s0lo1

    09/11/2022, 2:04 AM
    Checking to see if anyone has implemented magic link authentication from a chrome extension or how would someone do it.
    g
    • 2
    • 1
  • Supabase Database
    k

    KickSquare

    09/11/2022, 3:07 AM
    Hey, looking at supabase's pricing. The $25/month plan includes 8gb of database "space" and 100GB of database "storage". What is the difference between the two?
    g
    • 2
    • 6
  • Nextjs with google provider (protected routes)
    n

    NanoBit

    09/11/2022, 9:23 AM
    What are you using to protect your routes? There's no default built in to protect routes.
    s
    • 2
    • 1
  • I need help in creating a row level policy
    j

    JAGUAR

    09/11/2022, 11:25 AM
    I want to make a row level policy in my bucket
    avatars
    to allow users to INSERT and UPDATE a file named
    {id}.png
    where
    {id}
    is their user id. Example
    44451f44-bdc7-43ba-a6c2-f06495c99380.png
    should be able to be updated and inserted by a user with id
    44451f44-bdc7-43ba-a6c2-f06495c99380
    .
    s
    g
    • 3
    • 10
  • row level security stuck with recursive checking with SELECT
    e

    eunjae

    09/11/2022, 12:56 PM
    Hi all, I have`rooms` and
    participations
    tables. This
    participations
    has both
    room_id
    and
    user_id
    . When a user enters a room, a new row is added. You get the idea, right? I have this function:
    Copy code
    create or replace function is_participating(param_room_id uuid)
    returns boolean as $$
      select exists
        (
          select 1
          from participations
          where room_id = param_room_id
            and user_id = auth.uid()
            and (role = 'admin' or role = 'user')
            and status = 'granted'
        );
    $$ language sql;
    But when I use this function for
    Copy code
    create policy "Can view participations of rooms where they already participate." on participations for select using (is_participating(room_id));
    it falls into infinite recursive loop. What's the smart way to deal with this?
    g
    • 2
    • 4
  • Is RLS in Supabase is similar as Security rules in Firebase?
    d

    d33pu

    09/11/2022, 2:42 PM
    Hello, I am new to backend dev and also I am coming from firebase and I am trying to understand some features in Supabase. In Firebase, to ensure a user is accessing their own data there are security rules that can be added. In Supabase, I've found RLS when I've read it, it feels like it is similar as Security rules in Firebase but I am totally not sure? If they are not similar, how to make sure on Supabase is accessing their own data and not everyone's else. P.S: I am using authentication from some third party service.
    s
    a
    g
    • 4
    • 43
  • whats the difference supabase realtime vs websockets ?
    t

    Thoth Trismegistus

    09/11/2022, 3:40 PM
    I have an app that uses websocket to build a channel like room where users can join it and it has to send the websocket request to all the other users. It seems a bit slow (not noticeable) TLDR: I would like to know what's the difference b/w websockets vs supabase realtime? is realtime significantly faster than websockets?
    s
    • 2
    • 1
  • Querying foreign tables w SDK
    a

    aaron

    09/11/2022, 4:38 PM
    Lower importance question, but wondering if I can get a cleaner implementation. Per https://supabase.com/docs/reference/javascript/select#query-foreign-tables I am able to successfully access data across a join table by doing something like this as an example:
    Copy code
    const { data, error } = await supabase.from('countries').select(`
        name,
        country_capitals (
          city (
            name
          )
      `)
    However, the data returned is:
    Copy code
    {
      "name": "USA",
      "country_capitals": [
        {
          "city": {
            "name": "Chicago"
          }
        },
        {
          "city": {
            "name": "New York"
          }
        }
      ]
    }
    Is there a way to just return the data directly without the join table nesting? Like:
    Copy code
    "name": "USA",
      "capitals": ["Chicago", "New York"
    etc... I know I can do the transformation on the frontend, but seems cleaner if there is just a better way of requesting the data from the SDK
    g
    • 2
    • 3
  • SupabaseURL
    j

    JordanStafford

    09/11/2022, 6:10 PM
    Hello, I'm having trouble getting started linking the auth to my vue3 site. The browser says: Uncaught Error: supabaseUrl is required. at new SupabaseClient (SupabaseClient.ts:66:29) at createClient (index.ts:21:10) at supabase.js:6:25 but I have a .env file (I've tried changing it to .env.local also) linked to my supabase.js file with a Url and anon key (tried with both double and single quotes ('', "")).
    n
    • 2
    • 2
  • Update Flask Website on Database change
    p

    ProtoFeather

    09/11/2022, 6:10 PM
    Hi there! I'm starting a new project where I'd like to show the content of my database rows as seen here: a row contains the image, the number of downloads and the date it was created;

    https://i.imgur.com/IrFoSYp.png▾

    but I'd like the list of tiles to update whenever one row is added. I looked into maybe using RealTime? I read that I could use websockets to listen to postgresql notify but I'm not really sure which route to take. Has anyone had a project needing this type of setup? All advice would be amazing ❤️ Thanks!
  • Custom SMTP
    f

    FunHellion

    09/11/2022, 7:42 PM
    Hi there! I am trying to implement the custom SMTP but it does not seem to be sending messages. If I put these settings into MS Outlook it works. It might have something to do with encryption methods, but I can not seem to find a setting like that on the dashboard. Any ideas? Thanks in advance.
    s
    • 2
    • 3
  • Supabase Storage for Frontend
    n

    Ninjaa

    09/11/2022, 7:44 PM
    Can I host my react build artifacts (so HTML, CSS, JS) in Supabase storage for public consumption instead of having to use vercel or another web hosting provider?
    g
    h
    • 3
    • 2
  • Should I pass token from client to API (Which will use Supabase) via Query Parameters?
    s

    Shawn Conecone

    09/11/2022, 10:23 PM
    Hello, potential noob question here. I'm trying to use my API to query supabase. To do this, I need to pass the auth JWT token from the client to the API first. Upon researching the safety of this method, I came across this SO post: https://stackoverflow.com/questions/32722952/is-it-safe-to-put-a-jwt-into-the-url-as-a-query-parameter-of-a-get-request. The top answer mentions the conditions in which this method is safe to do. Does supabase implement these, subsequently making passing the token via query parameter ok? If this is not the correct method, how should this be done? If possible, via method that still involves the API, and not doing client-supabase query directly.
    h
    • 2
    • 2
  • Has my IP been blocked?
    d

    doctor_eval

    09/11/2022, 11:27 PM
    Hi! I'm new to supabase; but been a PostgreSQL user for 15+ years (!). Am enjoying Supabase and am building some apps with it. I'm a heavy user of many esoteric PG features and use psql a lot. However, after a couple of typos I've become unable to connect to port 5432 from my laptop. I can still connect to port 6543. I'm guessing my IP has been banned due to the auth errors. Can I reset this somehow? Or how long do I need to wait? I wouldn't be able to have something like this happen in a production environment.
    g
    • 2
    • 8
  • Storage service down
    v

    vjoohov

    09/12/2022, 2:20 AM
    My storage service is not working suddenly
    h
    m
    +3
    • 6
    • 33
  • RLS Serverside
    j

    jamalam

    09/12/2022, 6:52 AM
    Hiya, is there a way to execute an SQL query as a specific user Serverside? This is within a remix loader so doesn't run clientside. I want the query to still be subject to my RLS policies.
    n
    p
    +2
    • 5
    • 20
  • version control on supabase?
    t

    th0rin0

    09/12/2022, 7:58 AM
    was wondering if there's a way to do version control on Supabase, like liquibase does? not entirely sure if the database changes in the Realtime channel is the answer to what i am looking for
    t
    i
    • 3
    • 5
  • Auth - current password not required for password change?
    a

    arechsteiner

    09/12/2022, 10:46 AM
    I've implemented a password change form using
    await supabasePublic.auth.update({ password: data.password })
    on the front end. I noticed it is no way necessary to provide the old password on the api. Is there any setting to require this? I couldn't find anything. This seems like a common security feature.
    o
    • 2
    • 1
  • Supabase query
    m

    MrSARS

    09/12/2022, 11:34 AM
    Hi I would like to write this sql query in my api but im unsure as to how to convert it
    Copy code
    select categories.id, categories.category, categories.image_name, count(item.category_id)
    from categories
    left join item
    on categories.id = item.category_id
    group by item.category_id, categories.category , categories.image_name, categories.id
    order by categories.id asc
    g
    • 2
    • 1
  • Storage Upload Upsert (SET)
    w

    wei

    09/12/2022, 12:08 PM
    I am trying to upload a file to
    avatars/<user_id>
    with RLS
    select
    public read for anons,
    insert
    and
    update
    for authenticated if
    Copy code
    sql
    ((bucket_id = 'avatars'::text) AND ((uid())::text = storage.filename(name)))
    But update doesn't work. Upload works. TS code for upload (create) only is
    Copy code
    ts
    await supabase.storage
              .from('avatars')
              .upload(user.id, value.files[0]);
    Update with upsert via upload method option returns
    Copy code
    json
    {
        "statusCode": "42501",
        "error": "",
        "message": "new row violates row-level security policy for table \"objects\""
    }
    And update with or without upsert returns 404 Thank you!
    • 1
    • 1
  • Websocket fails to connect for replication
    p

    pek

    09/12/2022, 12:41 PM
    After coming back to an old project, when I turn on replication for my tables, starting the app fails to make a websocket connection. The following error gets repeatedly logged to the console:
    Copy code
    WebSocket connection to 'wss://<xxxx>.supabase.co/realtime/v1/websocket?apikey=<yyyyyy>=1.0.0' failed: 
    W3CWebSocket    @ browser.js?eccf:25
    connect            @ RealtimeClient.js?6b6d:104
    eval            @ RealtimeClient.js?6b6d:94
    fulfilled    @ RealtimeClient.js?6b6d:4
    g
    • 2
    • 4
  • Does magic link work with react-native?
    l

    Lukas V

    09/12/2022, 1:18 PM
    Hi, I just wanted to know if magic link authentication works with react native? If so, are there extra steps required to set it up compared to web app?
    o
    • 2
    • 1
  • How to wait on token refresh logic to finish from the client side?
    m

    Miguel Espinoza

    09/12/2022, 1:56 PM
    I have this supabase client setup:
    Copy code
    const supabase = createClient(supabaseUrl, supabaseKey, {
      autoRefreshToken: true,
      persistSession: true,
      localStorage: browserStorageInterface,
    });
    I'm depending on supabase to handle token refresh, but this conflicts with subsequent request to the database. While the token refreshes, a request to the database occurs, but the token is invalidated on request flight. One of these requests returns a 406 (which I believe is the wrong status code). So two things: - Is there a solution to wait for
    this._callRefreshToken()
    to complete before making subsequent request? - If token is invalid, shouldn't the status code be 401 instead? https://github.com/supabase/supabase/discussions/2284 It seems I'm getting a 406 because I'm using
    .single()
    . I still think an invalid token should override the error message
    g
    • 2
    • 14
  • how to pass Authorization Bearer when use pgsql-http extension
    a

    Ahmad Swultra

    09/12/2022, 2:37 PM
    I need to send a **POST **request to my api website and the api needs to pass Authorization Bearer token in the header, How can I do that with http extension ?
    Copy code
    select status
    from
      http_post(
        'https://website.com/api/users/1/',
         '{"status":"active"}',
        'application/json'
      )
    g
    d
    • 3
    • 6
  • Supplying child rows of deleted row to Database Webhook
    o

    OberstKlinck

    09/12/2022, 2:44 PM
    Hi, I have two tables:
    parents
    and
    children
    . One parent can have many children and each child is assigned to a parent through a
    parent_id
    column. I created a Database Webhook that triggers an HTTP request to a Supabase Edge Function whenever a DELETE query is run on
    parents
    . Through a cascading delete, this delete query also deletes all children of that parent. In my Supabase Edge Function though, I only see the now deleted
    parent
    row as the payload. Is there a way for me to supply not just the
    parent
    row but also its now-deleted children rows as well? So that the
    old_record
    supplied to my function would look something like this: { id: "123", children: [ { id: "234" }, { id: "345" }, { id: "456" } ] } ?
    g
    • 2
    • 2
  • Edge functions to serve Slack slash commands
    l

    loong

    09/12/2022, 2:53 PM
    I want to serve slash commands for a slackbot directly using edge functions. However, edge functions require authentication headers, which slack doesn't seem to support. Any quick work-arounds for this? I can only think of a proxy server relaying messages with auth tokens injected.
    g
    • 2
    • 2
  • How hard is it to migrate supabase users to another domain
    a

    anderjaska

    09/12/2022, 3:11 PM
    If we start on one domain for our app, and switch to another domain later, how hard is that migration? I can't find any direct answers. What happens with social accounts?
    o
    • 2
    • 2
  • Selecting symmetric rows in sql
    s

    STILLWATER;

    09/12/2022, 3:55 PM
    I want to make a SQL query to select symmetric rows for example we have two columns A and B, Select rows which have x,y and y,x existing in the table. A and B are of type uuid return x,y or y,x any
  • RLS Condition check
    r

    rlee128

    09/12/2022, 4:08 PM
    Is there a way to check that a function that returns a bool is false. The function is set to return true or false and I want to pair that with another function and insure the first one is false and the second is true. So that we grant insert access if the first function is false and the second is true.
    g
    • 2
    • 2
  • Using supabase in express not getting errors
    d

    Deleted User

    09/12/2022, 4:21 PM
    I am using supabase in a simple express api simply to learn express. I can't seem to throw an error.
    Copy code
    javascript
    app.get('/api/get-book-by-id/:id', cors(corsOptions), async (req, res) => {
      const {data, error} = await supabase
        .from('books-express')
        .select('*')
        .match({id: req.params.id})
    
      console.log(error)
      console.log(data)
    
      if (error)
        res
          .status(404)
          .send({message: `ERROR CODE: ${error.code}: ${error.message}`})
    
      // res.send(data)
    })
    I can return
    data
    with the correct book ID if present but if not I just get an empty array...but errror is
    null
    surely this should be throwing an error saying no id of x is present
    s
    s
    • 3
    • 2
1...202122...230Latest