https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Welcome to the new help forum channel
    o

    Olyno

    08/11/2022, 1:03 PM
    Welcome to the new help forum channel, please follow the guidelines outlined when creating posts and choose the appropriate tag that matches the question you are asking.
    ј
    h
    +32
    • 35
    • 85
  • how do I add permission scopes to my discord auth callback?
    t

    TheOnlyTails

    08/11/2022, 1:56 PM
    I see that by default supabase adds the
    identify
    and
    email
    scopes, but i need the
    guilds
    scope as well. doing this doesn't seem to work:
    Copy code
    ts
    await supabase?.auth?.signIn(
        { provider: "discord" },
        {
            queryParams: {
                scope: "guilds identify email",
            },
        }
    )
    I'm using the SvelteKit auth helper.
    e
    s
    +3
    • 6
    • 36
  • Insert method, can't insert data
    ј

    Језда

    08/11/2022, 2:00 PM
    Hey devs, I have a quick question about the insert method 🙂 await supabase.from('table_name').insert([{month: custom_data}]) Is this possible to do? the month is a dynamic string, it can be any month, but when ever I send req it said can't find the month inside table? 🙂
    g
    • 2
    • 4
  • Can not update record using plv8
    m

    Maxim Ens

    08/11/2022, 2:43 PM
    Hey devs, I'm using plv8 functions and getting error on
    plv8.execute('UPDATE...'
    saying
    cannot execute UPDATE in a read-only transaction, code: 25006
    • 1
    • 2
  • RLS Error Handling
    d

    drewbie

    08/11/2022, 3:23 PM
    I have a policy that uses a function for the USING and its working as intended, however the response from the policy is a 404 since technically it doesnt find a matching record in the function. How do I get the RLS error to bubble up to the database query instead of just returning a 404?
    Copy code
    create policy "Products can only be updated by a shop admin or moderator"
      ON public.products for UPDATE
      USING (
        user_belongs_to_shop(auth.uid(), shop_id)
        AND
        (
          shop_user_has_role(auth.uid(), 'ADMIN'::user_shops_roles, id) 
          OR
          shop_user_has_role(auth.uid(), 'MODERATOR'::user_shops_roles, id) 
        )
      );
    When I try to make an update that'll return false for the USING I get the following -->
    {"body": null, "count": null, "data": null, "error": [], "status": 404, "statusText": "Not Found"}
    Im pretty sure its due to the function logic itself - which looks like this
    Copy code
    RETURN EXISTS(SELECT 1 FROM public.user_shops  
        WHERE user_id = $1
        AND shop_id = $3
        AND role = $2);
    I was assuming that RLS checks returning a boolean would fail/succeed the RLS policy and return a policy error vs a 404. Appreciate anyone's help on this!
    g
    • 2
    • 10
  • Invoking Edge Function from Browser
    h

    hko

    08/11/2022, 3:31 PM
    I am building an OAuth flow using edge functions. I want to use a Supabase function for the redirect URL, however, when the redirect happens, the endpoint returns
    Only POST and OPTIONS requests are supported
    . Obviously, the browser is invoking the function with a GET request. Are there any workarounds that could make those possible?
    g
    • 2
    • 4
  • Structure-slash-design question re. onboarding
    i

    InASunshineState

    08/11/2022, 4:17 PM
    If I am using Next.js with Supabase and want my users to be forced to always be stuck to one page to fill out a form until it's completed (and then have access to the other logged in areas afterwards) does it make sense to put a boolean kind of toggle for the user profile, basically like a "yes they're activated" once the form is submitted...and then, separately, to guard each relevant page to redirect to the onboarding form if it sees there's a user but they haven't filled it out yet? I feel like there's gotta be something smarter or more elegant but I can't seem to arrive at what it is. Especially the idea of checking all the time for an event that's only meant to happen once.
    s
    • 2
    • 2
  • How to prevent multiple users signed in on same account?
    h

    HEAVYPOLY

    08/11/2022, 5:04 PM
    Is there a way to check how many users are concurrently signed in on the same account? For a multi seat license account for example
    g
    • 2
    • 1
  • Unable to set secrets via CLI
    j

    jordan801

    08/11/2022, 6:29 PM
    Im getting an error when I try to set secrets via CLI.
    supabase secrets set test=test
    Returns Error: Unexpected error setting project secrets: Temporary outage perhaps?
    g
    • 2
    • 2
  • Exchanging provider token for Supabase token
    t

    thread carer

    08/11/2022, 7:26 PM
    I need to authorize Retool users, that authenticate through Google OAuth2 on Supabase. Is there any way to exchange a Google
    access_token
    and
    refresh_token
    for the respective Supabase tokens?
    o
    • 2
    • 5
  • How to disable all Supabase emails?
    k

    Kellen Mace

    08/11/2022, 8:01 PM
    I have migrated my production DB over to another Supabase project that I plan to use as a staging environment. I want to ensure no emails are sent from staging, even if someone were to accidentally click "Send password recovery" or "Send magic link" in the Supabase admin, for example. How can I disable all emails?
    g
    p
    • 3
    • 2
  • Supabase in deno
    b

    Bloxs

    08/11/2022, 8:06 PM
    Is there any wrappers for supabase with deno that are currently supported? As I've seen a few wrappers but they seem fairly outdated
    o
    • 2
    • 3
  • syntax error at or near boolean
    k

    Kasper

    08/12/2022, 12:17 AM
    I'm trying to make a boolean column NOT NULL, but for some reason this is failing. any ideas why?
    Copy code
    ALTER TABLE public.pages
    ALTER COLUMN branding boolean NOT NULL;
    Result:
    Copy code
    syntax error at or near "boolean"
    s
    • 2
    • 7
  • Can't sign in to the web console with github
    j

    jocarrito

    08/12/2022, 2:08 AM
    Hello, I've never had this issue, but I can't login as always with GitHub, I'm receiving these errors when I click on "Sign in with Github"
    g
    • 2
    • 3
  • How I can add localization to the error messages related to the auth functions?
    k

    Kno Raziel

    08/12/2022, 4:29 AM
    Hi folks, I'm working on a small app, the application use English and Spanish languages, and I'm interested to localize the error messages that could appear using the different auth functions like signIn. For example trying to signin with the wrong password return the following error:
    Copy code
    {
      "error": "invalid_grant",
      "error_description": "Invalid login credentials"
    }
    So when the user set the app to Spanish, I would like to display on the app "Creadenciales de acceso invalidos" instead of "Invalid login credentials", I have tried looking in the Supabase documentation and github repository for a documentation like this appendix from PostrgreSQL https://www.postgresql.org/docs/current/errcodes-appendix.html , so I could be able to use custom error messages depending on the error code but didn't find anything.
  • Retrieve the supabase project id and name in SQL
    r

    RootKernel

    08/12/2022, 9:27 AM
    Hi, I'd like to do a query like the following and get back
    projectname
    and
    bxhpalafcjvdrroyyver
    Copy code
    sql
    SELECT id, name FROM supabase.project;
    c
    g
    r
    • 4
    • 8
  • Reduce related column select
    r

    rickysullivan

    08/12/2022, 10:03 AM
    How can I reduce the result of fetching a related table's column down?
    Copy code
    ts
    supabase
          .from<Subscription>('subscriptions')
          .select(
            '*, prices(*, products(*)), postcodes:postcodes_subscription!postcodes_subscription_subscription_id_fkey(post_codes)'
          )
          .in('status', ['active']);
    Results in:
    Copy code
    js
      ...
      "postcodes": [
                {
                    "post_codes": "1234, 4567"
                }
            ]
      ...
    I really just want:
    Copy code
    js
      ...
      "postcodes": "1234, 4567"
      ...
    g
    • 2
    • 3
  • Delete field from raw_user_meta_data
    u

    49Ryann

    08/12/2022, 11:23 AM
    I'm sending a value form the client in 'organisation_id' & reading it in a function, once I have read it I'm saving it using a custom claim package but how do i then delete that value after I have done that? I read it like this inside my trigger function, how would I delete it here too ?: new.raw_user_meta_data->>'organisation_id'
    g
    • 2
    • 2
  • Converting `INNER JOIN` and `GROUP BY` to JS SDK
    v

    vasek

    08/12/2022, 11:53 AM
    Hi, I'm trying to convert the following SQL query to the JS SDK equivalent but having very hard time
    Copy code
    SELECT
      code_snippet_embed_telemetry.code_snippet_id cs_id,
      code_snippet_embed_telemetry.type action_type,
      COUNT(*) AS total
    FROM code_snippet_embed_telemetry
    INNER JOIN code_snippets on code_snippets.id = code_snippet_embed_telemetry.code_snippet_id
    WHERE code_snippets.creator_id = 'string-that-will-be-passed-in-function'
    GROUP BY cs_id, action_type;
    Especially the INNER JOIN and GROUP BY part. Can anyone give me some hints?
    g
    • 2
    • 1
  • storgae.from.list returning all files, but without path
    r

    rankala

    08/12/2022, 12:01 PM
    hi, i upload my files with a path like this: const filePath =
    ${date.getFullYear()}/${date.getMonth()}/${uuid()}.${file.fileObj.name.split('.').pop()}
    in another part, i want a list of all files of path's in a bucket. my guess, I need to do this:
    const {data: files, error} = await supabase.storage.from('bucketid').list();
    But here, i only get an id and a name, but not the full path. i am missing the year and month. So this list is kinda useless, because i cant resolve the year and month. How ca i get the path, without sending a request for each image to the database, after I recived the list? Here is a sample result:
    Copy code
    json
    [{
        "name": "Screenshot 2022-06-29 at 11.50.50.png",
        "id": "d1f3bc38-6416-45a0-94cf-9d1a66116562",
        "updated_at": "2022-08-09T21:13:31.048644+00:00",
        "created_at": "2022-08-09T21:13:31.048644+00:00",
        "last_accessed_at": "2022-08-09T21:13:31.048644+00:00",
        "metadata": {
            "size": 39662,
            "mimetype": "image/png",
            "cacheControl": "max-age=3600"
        }
    }]
    g
    • 2
    • 1
  • Protected columns?
    p

    Pierre_

    08/12/2022, 12:09 PM
    Hey, I'm new to Supabase and postgresql in general, and I am trying to secure a
    public.profiles
    table in the database:
    Copy code
    sql
    create table public.profiles (
      id uuid references auth.users not null,
      username text unique not null,
      email text unique not null,
      created_at timestamp with time zone,
      updated_at timestamp with time zone,
      avatar_url text,
    
      primary key (id),
      unique(username),
      constraint username_length check (char_length(username) >= 3)
    );
    I therefore implemented RLS so that users are only allowed to edit their own profile:
    Copy code
    sql
    -- ...
    create policy "Users can update their own profile." on public.profiles
      for update using (auth.uid() = id);
    -- ...
    But, if I haven't missed anything, I guess users would be able to edit any column in their profile, including
    id
    ,
    email
    ,
    created_at
    and
    updated_at
    in this case. So what can I do to prevent that? Thanks in advance for the help!
    g
    d
    • 3
    • 3
  • clone project
    z

    zegoverno

    08/12/2022, 3:52 PM
    Can I clone my project? I want to create a new blank instance but preserver all schemas, triggers and functions from the previous project
    o
    s
    • 3
    • 3
  • How to make new role?
    g

    Gruce

    08/12/2022, 4:16 PM
    Hello, I would like to make new roles for users. Wondering how do that? Thank you.
    g
    • 2
    • 4
  • Reset database from Project web GUI
    n

    n-glaz

    08/12/2022, 5:54 PM
    How can I reset a Postgres DB from my Project web GUI? #postgresql
    g
    • 2
    • 9
  • Supabase Auth Helpers type is incompatible with supabase-js types
    m

    mathewcst

    08/12/2022, 9:19 PM
    Trying to use Realtime and Typescript, but when I import the type for "RealtimeSubscription" I get this error
    Copy code
    js
    Type 'import("@supabase/auth-helpers-svelte/node_modules/@supabase/realtime-js/dist/module/RealtimeSubscription").default' is not assignable to type 'import("@supabase/realtime-js/dist/module/RealtimeSubscription").default'.
      The types of 'socket.channels' are incompatible between these types.
    p
    • 2
    • 6
  • Get user from auth.api
    d

    daviscup

    08/13/2022, 2:33 AM
    For my administrator page, I want to get a single user from the auth table (regardless if logged in or not). I am currently using
    await supabase.auth.api.listUsers()
    to get all users but I want to query only one specific user with their uid or email address. In the docs, I've found only
    user()
    and
    getUser()
    which both seem to only get the user data of a currently logged in user.
    g
    • 2
    • 4
  • How do I reorder a table?
    o

    oofdere

    08/13/2022, 6:58 AM
    Say I have a list of to-do items and want my user to be able to reorder them as they please. Could I change the order of items without adding 1 to the sort column of every item that comes afterwards every time they do an operation?
    g
    • 2
    • 3
  • Having to constantly restart
    l

    lennard.

    08/13/2022, 8:27 AM
    Hello. I have been using Supabase for a while now, and keep getting the same error. I need to restart the server every hour or so. Is there any reason why this might happen?
    g
    s
    • 3
    • 5
  • Can't query compare to another field as RPC
    a

    Azura

    08/13/2022, 8:28 AM
    I'm having the same exact problem, yet cannot reproduce the solution as proposed by steve-chavez on Github. Any ideas?
    g
    s
    • 3
    • 9
  • How to select multiple columns?
    ј

    Језда

    08/13/2022, 9:32 AM
    I tried: await supabase.from("table_name").select('col-1', 'col-2'); but this return the error message: Type '"col-2"' has no properties in common with type '{ head?: boolean; count?: "exact" | "planned" | "estimated"; }'.
    n
    • 2
    • 2
12345...230Latest