https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Access is disabled for other schemas right?
    n

    nahtnam

    01/31/2023, 7:58 AM
    Hello, Just want to verify that if I have another schema (in the screenshot "external_integrations"), this data is not accessible by the supabase client and therefore RLS is not needed right?
    s
    • 2
    • 2
  • Cannot Create new User and Invite User
    u

    μ΅œμ§€μ—°

    01/31/2023, 9:10 AM
    hi! PlZ help me...😭 1. cannot invite user I just invite my account .. I got this error message 2. cannot create new user I just got 500 error What should I do? this is my test code.
    Copy code
    import { supabase } from '@lib/supabase/supabase';
    import { FormEvent, useState } from 'react';
    
    export default function Page() {
      const [datas, setDatas] = useState({
        email: '',
        password: '',
        athletic_experience: '',
      });
      async function handleSubmits(e: FormEvent) {
        e.preventDefault();
        try {
          const { data, error } = await supabase.auth.signUp({
            email: datas.email,
            password: datas.password,
            options: {
              data: {
                athletic_experience: datas.athletic_experience,
              },
            },
          });
        } catch (error) {
          console.log(error);
        }
      }
      console.log(datas);
      function onchange(event: { target: { name: string; value: string } }) {
        setDatas((prev) => {
          return {
            ...prev,
            [event.target.name]: event.target.value,
          };
        });
      }
      return (
        <form onSubmit={handleSubmits}>
          <input
            onChange={onchange}
            placeholder="μž…λ ₯ν•˜μ„Έμš”"
            name="email"
            type="text"
          />
          <input
            onChange={onchange}
            placeholder="μž…λ ₯ν•˜μ„Έμš”"
            name="password"
            type="text"
          />
          <input
            onChange={onchange}
            placeholder="μž…λ ₯ν•˜μ„Έμš”"
            name="athletic_experience"
            type="text"
          />
          <button type="submit">전솑</button>
        </form>
      );
    }
    s
    • 2
    • 2
  • Use query results in another query. Function? Join?
    s

    Solid Snake

    01/31/2023, 12:37 PM
    Hi guys, my goal is to query a table whose name is obtained by querying another table. I have three tables: profiles id, name, surname, category users1 profile_id, col1, col2... users2 profile_id, col1, col2... in users1 and users2 profile id has a foreign key relation with profiles.id I would like to do a select on the first table: select * from profiles where id = specific_id then another select with obtained category value: select * from category (category is either users1 or users2) where profile_id = specific_id I am currently using a JOIN, but I feel like too much data is being queried. I am aware that I could use two separate SELECT queries, but I would like to know if there is a cleaner way.
    Copy code
    let { data, error } = await supabase.from('profiles').select('
                           *,
                            users1 (
                                *
                            ),
                            users2 (
                                *
                            )
                        ').eq('id', session.user.id)
                    .limit(1)
                    .single()
    Thanks
  • Sveltekit Setup not working properly
    h

    Hugos

    01/31/2023, 1:14 PM
    I noticed on the sveltekit supabase docs you guys recommend doing: ``invalidate('supabase:auth');`` but that does actually not invalidate the page at all, What did work was ``await invalidateAll();``, Maybe this should be addressed for future sveltekit supabase users?
    s
    • 2
    • 25
  • RLS on views
    l

    lake_mattiato

    01/31/2023, 2:11 PM
    Hello, when querying views in WeWeb we've noticed that all data from the views gets exposed. Is there a way to enforce RLS on postgres views?
    g
    • 2
    • 1
  • An argument for 'defaultValue' was not provided.
    s

    salzar

    01/31/2023, 2:18 PM
    Hi, Im trying to follow a doc guide to get the Supabase on server and client side on next js 13 app folder. Only issue is i keep getting this issue that i put in the image attached. Im not sure what argument i should pass in there. I also attached a link to the docs. https://supabase.com/docs/guides/auth/auth-helpers/nextjs-server-components
    s
    l
    • 3
    • 7
  • Unable to import TSV file
    h

    Hugos

    01/31/2023, 2:22 PM
    I'm trying to import the IMBD (International Movie Data Base) from their downloaded TSV-file, but Supabase rejects it stating they only accept TSV or CSV files, see pictures:
    • 1
    • 1
  • Supabase self hosted gotrue tls
    a

    Anarki

    01/31/2023, 2:27 PM
    Is there a way to set the gotrue TLS options? Specifically I need to set rejectUnauthorized to false.
  • Supabase deeplink route fails in ios after successful redirection of Google Oauth
    i

    Imposer

    01/31/2023, 3:02 PM
    Supabase authentication by google Oauth works fine on android where after success, it comes back to the app and event is emitted after which it is redirected. But the same thing is failing in ios the deeplink is working on ios, that means the it is getting redirected back to the app but when it comes back, it fails since it is saying that there is not route found. Please help me. I have attached the logs for more information
  • Linking a file to a column
    r

    Romi

    01/31/2023, 3:46 PM
    I got a table with a field called "payslip" which is a file, should the data type be string? if so how do I sync that with the files uploaded and stored on supabase?
    g
    • 2
    • 8
  • Is it possible to run both AdminClient and UserClient to both run at single application,
    r

    rahul3v

    01/31/2023, 4:19 PM
    if yes , how Since I was trying to run few quires for createClient() with SUPABASE_ANON_KEY and few with SERVICE_ROLE_KEY as two different createClient() ; (just in development I mean ); but I can only able to use one; else it will break the things !!?
    g
    s
    • 3
    • 12
  • Does public storage work the same as buckets with policies
    g

    Guus Iwanow

    01/31/2023, 4:24 PM
    Hi Guys, I'm facing a problem, it's also possible that i am completely missing something, I just started working with Supabase couple of weeks ago. I try to get images from my storage. My structure is as follows: company-1 -> image_1.jpg splash-images (public bucket) ->splash-image.jpg this works with the policy in mind: _api.supabase.storage.from("company-1").download("image_1.jpg") This does not work (public bucket): _api.supabase.storage.from("splash-images").download("splash-image.jpg") Can i not use the .download() function for public buckets? Or should this work and am I missing something.
    g
    • 2
    • 1
  • Best practice for login home page
    r

    Romi

    01/31/2023, 5:26 PM
    So what would be the best way to structure login pages. Should the index of the app be on "/" and redirect to "/login" or should login be on "/" then after success full login redirect to "/dashboard"
    s
    • 2
    • 1
  • Table in public is not able to be read
    s

    snowgears

    01/31/2023, 5:43 PM
    Hello. I created a table in public and then setup my local environment for local development and deployed a function. In the function I call:
    Copy code
    js
    // Create a Supabase client with the Auth context of the logged in user.
        const supabaseClient = createClient(
          // Supabase API URL - env var exported by default.
          Deno.env.get('SUPABASE_URL') ?? '',
          // Supabase API ANON KEY - env var exported by default.
          Deno.env.get('SUPABASE_ANON_KEY') ?? '',
          // Create client with Auth context of the user that called the function.
          // This way your row-level-security (RLS) policies are applied.
          { global: { headers: { Authorization: req.headers.get('Authorization')! } } }
        )
        // Now we can get the session or user object
        const {
          data: { user },
        } = await supabaseClient.auth.getUser()
    
        const { error } = await supabaseClient
          .from('resource_purchase')
          .insert({ server_id : 868241175688151051, resource_id: 9628, price: 0.00, email: 'tanner_test@gmail.com' })
        if (error) throw error
    But it says relation public.resource_purchase does not exist. But it does exist. Am I missing something here?
    Copy code
    {
      "error": "relation \"public.resource_purchase\" does not exist"
    }
    g
    • 2
    • 22
  • Database ReadTimeout and Max Read
    l

    Lois

    01/31/2023, 5:50 PM
    Error Message:
    Copy code
    raise mapped_exc(message) from exc
    httpx.ReadTimeout: The read operation timed out
    I am using this in python:
    Copy code
    response = supabase.table("db").select("name").range(2000000,2999999).execute()
    Is there any way I can work around with this? I saw the documentation mention about
    alter role
    but not sure what next. Also the maximum read is 1000000 rows, is there way to increase this?
    g
    • 2
    • 3
  • function to insert data from one table to another based on bool
    m

    Martin Piliar

    01/31/2023, 6:17 PM
    Hello, I've got a table "question_types" that holds the information if the new question is made by community or by the developers of the app (that's defined by their "organization") - I want to add a question into the table with a trigger, the trigger itself is working alright, but I'm stuck in figuring out the organization part
    Copy code
    SQL
    create or replace function public.handle_new_category()
    returns trigger as $$
    begin
      insert into public.category_types (category_id,is_official)
      values (new.id, organization_can_publish(get_user_organization(???USERID???)));
      return new;
    end;
    $$ language plpgsql security definer;
    As you can see, I have a function that returns true or false depending on the fact if the organization has publishing access - and I have to get the organization with the user_id, but I'm not sure how to get the user ID as I'm not working with the users/profiles table (the ???USERID??? is the point I need help with)
    g
    • 2
    • 2
  • How can I avoid duplicate entry of data in supabase table?
    s

    shantanubharadwaj

    01/31/2023, 7:26 PM
    I want to avoid duplicate entry of same data in the table. I tried using upsert() but it is not working correctly.
    g
    • 2
    • 16
  • Full Text Search Library Recommendations for Supabase
    m

    maglev

    01/31/2023, 8:59 PM
    Hello, are there any full text search npm libraries recommended to be used with Supabase? Will need the standard case insensitive web and keyword search and some more specialized features such as if there are two columns first_name and last_name the search can interpret the input "Jane Doe" to search for results in a combined "first_name + last_name" field. Thanks.
  • Insert row works in UI but does not work when using JS client
    s

    snowgears

    01/31/2023, 11:02 PM
    Copy code
    js
    const { error } = await supabase
          .from('resource_purchase')
          .insert({ server_id : 868241175688151051, resource_id: 9628, price: 0.00, email: 'tanner_test@gmail.com' })
        if (error) throw error
    throws an error
    Copy code
    {
      "error": "insert or update on table \"resource_purchase\" violates foreign key constraint \"resource_purchase_ibfk_2\""
    }
    But when I use the SQL editor and do the same insert with:
    Copy code
    INSERT INTO resource_purchase (server_id, resource_id, price, email) VALUES (868241175688151051, 9628, 0.00, 'tanner_test@gmail.com');
    It inserts the row correctly. Are these not doing the exact same thing? For reference, the constraint is:
    Copy code
    CONSTRAINT resource_purchase_ibfk_2 FOREIGN KEY (server_id) REFERENCES discord_server (server_id)
    and the server_id I am inserting is in discord_server table as a row already so it should not be violated (and clearly it isn't when using the SQL Editor in the UI)
    g
    • 2
    • 2
  • I need help figuring out how to structure my tables/setup for a trivia app
    k

    kyds3k

    01/31/2023, 11:33 PM
    I'm rewriting a trivia app that I had set up previously using MongoDB. So far I have the setup for my presentation layer pretty set. Now I'm trying to figure out how I should set up users. I have it set up for ppl to login with Google, which gives them an entry in Authentication. My goals are: 1) User logs in with Google, creates a team name 2) User gets a code or something that is associated with the team for that "edition", in case that person has to leave, so someone else can take over 3) During the game, keeping track of the team's score, whether or not they have a "bantha" pass (free pass for 1/2 points), and their answer to each question 4) Ideally, I could have it set up so that I could go back to each edition and see which team answered what for each question (they are broken up into 3 rounds of 5 questions, with a bonus round after the 1st and 2nd rounds, and then a final round) I have this week to REALLY work on it (off on recovery from surgery), so I'm getting frustrated that I spent all Tuesday just trying to figure out how to implement this. Any help/suggestions are welcome!
  • Modifying Users Table
    n

    nateland

    02/01/2023, 2:07 AM
    Hey guys - what on earth does this mean Also, can one modify the users table? I wanna add first and last naems I had to create a new table, but maybe I don't have to...
    g
    • 2
    • 5
  • Dashboad down?
    u

    user8923

    02/01/2023, 3:18 AM
    Anyone noticed the dashboard was down? https://app.supabase.com/projects getting a Something went wrong error after a while.
    h
    b
    +2
    • 5
    • 10
  • match multiple filters
    a

    alana

    02/01/2023, 3:44 AM
    i see documentation for filtering to match at least one filter, but would like to filter to match two filters (e.g. AND not OR). specifically, i have a table of RSVPs with an attendee column and an event column and want to query for a particular attendee and particular event. is this possible and what's the syntax?
    g
    • 2
    • 30
  • Supabase Auth-Sessions not working
    u

    ${fence}

    02/01/2023, 4:59 AM
    Hi guys, I've followed all Supabase/Next.js/Typescript tutorials to setup Supabase auth and have even had Supabase working on a previous Next.js app but for some reason it just isn't work at all for me this time around... I can login, I am redirected to Discord (my provider) -> can login but when redirected to my home page I never have a session. I can see an account has been added to my auth users, but the session never sticks and isn't being added to my local storage. Any help would be appreciated. I've followed https://supabase.com/docs/guides/auth/auth-helpers/nextjs and the start of:

    https://www.youtube.com/watch?v=6dsLLp1_Ww8&ab_channel=CodingWithDawidβ–Ύ

    and numerous other tutorials..
  • Are triggers limited to same policies as the requesting user?
    j

    JamesB

    02/01/2023, 5:59 AM
    I want to add an audit log to monitor the actions a user is doing, I thought about using triggers for that. But, I don't want to grant inserts to any user, I only want the database itself to be able to insert those rows through triggers. So my question becomes, can I create a trigger that is allowed to insert data based on a user's action, whereas a user can do the action, but not directly write to the audit log table?
  • Next.js auth logs showing successful - no cookies saved
    u

    ${fence}

    02/01/2023, 6:53 AM
    Hi all, I've been having this problem for about a week now. One of my projects -> Following all Next.js tutorials in documentation and youtube.. Works totally fine, I can login via discord provider and get session in cookies. My new project -> Following next.js tutorials in documentation.. Doesn't work. I can see clearly in the supabase dashboard auth logs that it's making the connection fine. but it isnt saving the session in cookies. Can anyone help me? I'm pulling out my hair
    s
    • 2
    • 24
  • google o auth not working nextjs
    h

    Holland

    02/01/2023, 7:02 AM
    *Problem * When I sign in With Google, await supabaseClient.auth.getUser() does not return a user. Steps 1. Call signInWithOAuth
    Copy code
    const { data, error } = await supabaseClient.auth.signInWithOAuth({
      provider: 'google',
    })
    2. Attempt to get user
    Copy code
    const userInfo = await supabaseClient.auth.getUser()
    3. Get error message
    Copy code
    data: {user: null}
    error: AuthApiError: invalid claim: missing sub claim at eval (webpack-internal:///.
      name:"AuthApiError"
      status: 401
      __isAuthError: true
      message:"invalid claim: missing sub claim"
      stack: "AuthApiError: invalid claim: missing sub claim
        at eval (webpack-internal:///./node_modules/@supabase/gotrue-js/dist/module/lib/fetch.js:49:20)"
    What I am using I am using Next.js. I installed the following:
    Copy code
    @supabase/auth-helpers-nextjs
    @supabase/auth-helpers-react
    @supabase/auth-ui-react
    Note Logging in and signing up with email and password work fine for me. I call signUp to create a user with email and password and signInWithPassword to log them in with email and password. Calling supabaseClient.auth.getUser() after logging in with email and password returns a user for me. I am confused on how to actually impliment a signup with google. As I only see the function for signInWithGoogle(). How do I signin and signup with google? I click sign in with google. In the console the log quickly flashes a printout occuring after I await signInWithOAuth. Then I choose google account. Then it even redirects me to the / route. Then I try to getUser() and get same error. Then I try to getSession() which returns data:session = null. So no session. Logging in with email and password gives a session and user. My account I am using to log in with google is currently a user with Provider=Google in the app.supabase.com Authentication tab.
    j
    • 2
    • 2
  • Accessing private profile with getServerSideProps in NextJS
    t

    Tiago

    02/01/2023, 7:21 AM
    I am new to supabase, so probably I am doing something wrong. I am using the
    profiles
    table with the following RLS:
    Copy code
    create policy "Profiles are viewable by users who created them."
      on profiles for select
      using ( auth.uid() = id  );
    
    create policy "Users can insert their own profile."
      on profiles for insert
      with check ( auth.uid() = id );
    
    create policy "Users can update own profile."
      on profiles for update
      using ( auth.uid() = id );
    I am using NEXTJS and created a protected route
    /page/about/index.js
    where I am would like to get the user 's details. For that I was thinking getting it on
    getServerSideProps
    as follows:
    Copy code
    export const getServerSideProps = async () => {
      const { data } = await supabase.from("profiles").select("*");
    
      return {
        props: {
          data: data ?? [],
        },
      };
    };
    This however is getting me an empty array. Any idea how to access a private profile for the user that is authenticated? Thank you.
    g
    n
    j
    • 4
    • 12
  • Setup fulltext search index with json column value
    j

    jinsley8

    02/01/2023, 8:38 AM
    I'm trying to setup a searchable fts column as shown here: https://supabase.com/docs/guides/database/full-text-search#creating-indexes However, I want to use a key from a
    jsonb
    column. Something like below where I need
    name
    from the
    metadata
    column. Is this possible?
    Copy code
    sql
    ALTER TABLE public.items ADD COLUMN fts tsvector GENERATED ALWAYS AS (to_tsvector('english', token_id || ' ' || metadata->>name)) stored;
    
    CREATE INDEX item_fts ON public.items USING GIN (fts);
    g
    • 2
    • 2
  • issue with infinite recursion on policy.
    j

    JamesB

    02/01/2023, 8:56 AM
    Copy code
    sql
    create policy "User with X role can select role membership from other users"
    on role_members
    to authenticated
    using (
      auth.uid() <> user_id and
      auth.uid() in (
        select role_members.user_id
        from role_members
        where
          role_members.user_id = auth.uid() and
          role_members.role_id in (
            select roles.id
            from roles
            where
              name in (
                'admin',
                'profile_viewer',
                'profile_editor'
              )
          )
      )
    )
    I don't understand why this is marked as an infinite recursion. Somebody else here who sees the issue? And how I'd work around it? Thanks!
    • 1
    • 2
1...115116117...230Latest