https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Empty query back.
    d

    DevThoughts

    10/10/2022, 8:08 PM
    I am storing a user_id with column name auth0_id as a text type, but when i query by .eq('auth0_id', 'auth000000001232') I got back []. However if i hardcode values, things works fine.
    s
    • 2
    • 10
  • What library to use for direct connections via pooling?
    t

    thasmo

    10/10/2022, 9:20 PM
    Do I understand correctly that if I wanna use direct Postgres connections via connection pooling,
    supabase-js
    is not the right choice but using something like https://www.npmjs.com/package/pg-pool does the job? I need to connect and read data from within a serverless function; and I'd like to get the response as quick as possible. As far as I understand,
    supabase-js
    is "just" a client for the REST API.
    g
    • 2
    • 3
  • Hydration error on conditional rendering when with user.id
    k

    kvnfo

    10/10/2022, 10:07 PM
    Getting hydration errors when using the code below, my goal is to show an edit button to the user who created the post. Everything works, but dont know why im getting the hydration error. Any help or suggestions is appreciated!
    Copy code
    {events.user_id === user?.id && (
                    <div className="flex">
                      <svg
                        xmlns="http://www.w3.org/2000/svg"
                        fill="none"
                        viewBox="0 0 24 24"
                        strokeWidth={1.5}
                        stroke="currentColor"
                        className="w-4 h-4 cursor-pointer hover:opacity-80"
                        onClick={() => setIsOpen((prev) => !prev)}
                      >
                        <path
                          strokeLinecap="round"
                          strokeLinejoin="round"
                          d="M10.5 6h9.75M10.5 6a1.5 1.5 0 11-3 0m3 0a1.5 1.5 0 10-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-9.75 0h9.75"
                        />
                      </svg>
                    </div>
                  )}
    g
    • 2
    • 2
  • Using Views With Realtime
    r

    rlee128

    10/10/2022, 10:13 PM
    Is it possible to using views with realtime?
    g
    • 2
    • 2
  • Filter from JSON with CS (contains)
    j

    joshcowan25

    10/10/2022, 10:26 PM
    I'm trying to make a small search system for my website, where it would search in some columns depending on a choice. For example, the search can have this as parameters: search: [{f: 'titre', q: 'ilike'}, {f:'categories', q: 'contains'}], So, with that I would like to generate a OR() query to search in every column (f) with the specified method (q), For testing, I have a function like that in my code: type.search.forEach((f, i) => { if(i>0) rep += ',' if(f.q === 'ilike') rep += f.f + '.ilike.*' + searchString + '*' if(f.q === 'contains') rep += f.f + ".cs.{"+ searchString + "}" }) And this would output titre.ilike.inf,categories.cs.{inf} for example The problem is, when I use this output in .or() of my supabase query, I always have error with the CS (bas query token...) So, I don't get how I'm suppose to make it work. Categories is an array in that case
  • How to do Realtime Application State Tracking
    t

    Tom3

    10/11/2022, 1:10 AM
    Hi guys. I currently have an app that I built with Cloud Firestore and I'm seeing if its possible to convert it to Supabase, mostly so I can utilize the relational DB. However, the heart of my application requires that users are able to subscribe directly to the state of the database, which is kind of the main selling point of Firestore. To be clear, I want the equivalent of a cloud firestore subscription: - My server backend to update a database full of JSON objects - When a change is made to a JSON object, all clients who are subscribed to that object are notified - If possible I would like type safety (I have Prisma for all of my non-realtime database interactions) I'm not 100% sure how I would do this in Supabase. Presence looked like the right tool at first, but after playing with it a bit it looks like all the users get their own state within the channel. I also don't really want clients to be able to call
    track()
    and add to the state for security reasons. Does anyone have any suggestions? Thanks.
  • Enable realtime CDC in a migration?
    d

    DC

    10/11/2022, 3:28 AM
    How does one non-interactively enable realtime for tables? Ideally we'd like to configure these in a migration.
    o
    • 2
    • 2
  • Are Channels private? (to join 'new channel(guid)' a user would have to guess the guid)
    r

    runejeppesen

    10/11/2022, 6:24 AM
    I am hoping a 'listAllChannels' function exists so that I can make private channels
    s
    • 2
    • 3
  • On auth trigger only if email confirmed
    i

    in

    10/11/2022, 9:40 AM
    I currently have a trigger that inserts a new row in public.users when a user is created and it works great. However, I would like to insert in public.users if and only if email_confirmed_at is not null as follows:
    Copy code
    create function public.handle_new_user()
    returns trigger as
    $$
      begin
        -- if new.email_confirmed_at is not null then
          insert into public.users (...)
          values (...);
          return new;
        -- end if;
      end;
    $$
    language plpgsql security definer;
    
    create trigger on_auth_user_created
      after insert on auth.users
      for each row
        execute procedure public.handle_new_user();
    If you keep the condition commented out, the row will be inserted every time, even if just invited by email. If you add the condition, user invitation/creation doesn't work anymore and gives the following error:
    Copy code
    Failed to invite user: failed to make invite request: Database error saving new user
    The code is valid, but there is something in the "create user" function from the auth schema that is bothered by that condition. Btw, I wanted to have a look at that function in pgAdmin but all my Supabase servers were disconnected, impossible to reconnect (all my other non-Supabase servers work just fine). Is there currently a problem that is still not reported on status.supabase.com?
    s
    • 2
    • 3
  • SupabaseJS v2 Typescript
    d

    drewbie

    10/11/2022, 1:54 PM
    I am attempting to create a React Query provider that wraps the Supabase v2 JS client. I love the type improvements of the new version of the Supabase client so I definitely want to keep them in tact. However, by wrapping the client query in a react query function, I am having trouble typing how the return types of the client, or getting the client types inferred. Basically I am just looking to have this function use the same types as the client. The types in the v2 JS are a bit complex for me to try to duplicate as the return type of this function, so I wanted to see if anyone had any suggestions on how I may get this done.
    useReactQuery
    does take a generic which will be the return type of the fetched data. However, I'm a bit lost on what that return type should be as a lot of it looks like its inferred from the table name in the standalone v2 client.
    Copy code
    typescript
    type GeneratedQuery = PostgrestFilterBuilder<any, any> & { _table?: string };
    type QueryCreator = (supabase: SupabaseClient<Database>) => PostgrestFilterBuilder<any, any> & { _table?: string };
    
      function useQuery(queryCreator: QueryCreator, options?: UseQueryOptions & { queryKey?: string | unknown[] }) {
        const query = queryCreator(client);
    
        const execute = (query: GeneratedQuery) =>
          new Promise<any>(async (resolve, reject) => {
            const { data, error } = await query;
            if (data) {
              resolve(data);
            } else {
              reject(error);
            }
          });
    
        return useReactQuery(options?.queryKey ?? [query._table], () => execute(query), options);
      }
    When I call
    useQuery
    in a component (eg) Id like the return type of the client query to go to
    categories
    Copy code
    typescript
      const categories = useQuery((supabase) => supabase.from("categories" *this table name autocompleted fine).select("name, id"));
    
      categories.{no types on the return value of categories :/}
    This has sort of stretched my knowledge of Typescript thin and any help is appreciated!
    n
    n
    • 3
    • 9
  • how to check if user is signin in for the first time?
    l

    Lukas V

    10/11/2022, 1:58 PM
    Hi, I want to create onboarding process (fill in starter form) for all new users who are signing up. However, how can this be done for users who are signing in via magic link? The sign in function is the same as signing up? How can I detect users that have signed up for the first time(using magic link and google auth) and haven't completed the "starter form" ?
    g
    • 2
    • 3
  • Insert Row is not working with click event
    s

    Solemensis

    10/11/2022, 3:24 PM
    I can insert rows with this code, it works;
    Copy code
    const { data, error } = await supabase
      .from('myrow')
      .insert([
        { id: 11, desc: 'heyrow' },
      ])
    But it inserts only on page re-loads of course. When i try to wrap it in a async function;
    Copy code
    async function insert() {
     const { data, error } = await supabase
       .from('myrow')
      .insert([
        { id: 11, desc: 'heyrow' },
      ])
    }
    and put it on a click event; (vue/nuxt3)
    Copy code
    <button @click="insert()">click</button>
    Row insert is not working with click event. What am i doing wrong?
    s
    g
    • 3
    • 6
  • timeout when connecting with dbeaver
    i

    Iwan

    10/11/2022, 4:22 PM
    dear masters, Im getting timeout error when connecting through dbeaver with direct connection. Stackoverflow says it might be due to AWS rejecting the connection and I need to do something on the ec2 . additionally , I cant ping supabase host either. Is anyone have the same issue?
    • 1
    • 1
  • supabase.auth.setAuth(token) deprecated, docs deleted, no way to find alternative
    j

    James Perkins

    10/11/2022, 5:43 PM
    It seems you have deprecated
    supabase.auth.setAuth(token)
    and deleted all of the documentation that now just gives you a > Page Not Found > We could not find what you were looking for. > > Please contact the owner of the site that linked you to the original URL and let them know their link is broken. > It is impossible to find what the alternative of this is. So I am wondering if someone can help me.
    g
    • 2
    • 5
  • Nextjs Auth helper example does not run
    a

    Abnormal

    10/11/2022, 5:44 PM
    I have been trying to get the Auth Helper example to run in order to better understand how them in my Own next js project as the regular docs are not getting me anywhere. https://github.com/supabase/auth-helpers/tree/main/examples/nextjs when trying to run I am meet with the error "Unsupported URL Type "workspace:": workspace:*" when trying to use npm install to get the needed libraries. Any help is appreciated as searching the discord does not yield any results
    s
    • 2
    • 1
  • time_bucket does not exist
    v

    Vengeance

    10/11/2022, 5:50 PM
    TimeScaleDB is enabled in extensions, but when I try to use
    time_bucket
    I get
    Failed to run sql query: function time_bucket(unknown, timestamp with time zone) does not exist
    , any ideas? https://docs.timescale.com/api/latest/hyperfunctions/time_bucket
    g
    • 2
    • 19
  • migrations - schema and data best practise
    d

    DJPaul

    10/11/2022, 6:05 PM
    Hi everyone. I am new to both pgsql and supabase. I’ve been looking into the superbase cli migrations feature, and found out while it migrates schema, it doesn’t do the content - namely in a test database, it seemed to empty the whole table (I may have done it wrong and I will double check later but I believe this to be accurate). In the general world of pgsql, what’s the best set of tools to use for schema migrations that handle content (i.e adding a new column with a default value to an existing table - basic stuff)
    s
    • 2
    • 3
  • My migrated users from firebase are getting 'Email unconfirmed' when trying to sign in.
    l

    lewisd

    10/11/2022, 6:27 PM
    Hi guys, migrated my users from firebase using the guides. I've got a function setup that uses the firebase hash's to check if they are entering the right password etc. so all is working great. However, per supabase's auth structure, users must email confirm their email before they can sign in. I like this behaviour so I don't want to turn it off, however migrated users have no way of confirming their email? as there is no
    sendConfirmEmail()
    function (or something similarly named) The email im after is sent automatically when a user signs up which is great, but my migrated users are technically already signed up, so I need to send a confirmation email manually. One idea 💡: If I send a magic link/OTP and they sign in with that, does that also confirm the email? I suppose that could do if so.
    • 1
    • 1
  • Unable to access database from a Vercel hosted frontend
    t

    Theodore

    10/12/2022, 4:30 AM
    Hello everyone. I just hosted my CMS on Vercel. I believe I followed the instructions I was given properly. After the upload I am getting constant redirects with a 403 error. The site is trying to access [custom].supabase.co/admin/init. When I checked the API calls within supabase I can see all the errors with vercel.app/ as a referrer. (basically 401 for admin/project-type and admin/init). Am I missing something? Do I have to allow this connection somewhere within the supabase panel?
    s
    • 2
    • 4
  • Nothing related to DB, but front end. How did you manage to get this banner not poping up?
    s

    Sacha

    10/11/2022, 7:41 PM
    Hey! I was wondering. On https://www.moonpay.com/ or https://mobula.fi, if you get in for the first time, the top banner you see is "popping up" creating a little "lag" on the page at first load. On supabase landing page, not at all. How is that possible? Using NextJS for example, we need at least 1 rerender to access localstorage and update it in-app.
    s
    • 2
    • 3
  • Filter Posts based on Labels, but still receive all Labels (inner join)
    c

    ccssmnn

    10/11/2022, 8:16 PM
    I have a posts table and a labels table. One post can have many labels. In a query like this:
    supabase.from("posts").select("*, labels(*)")
    I receive all posts and all of their labels. Now, when I want to see posts with
    label 1
    , the query will look like this:
    supabase.from("posts").select("*, labels!inner(*)").eq("labels.id", 1)
    . But now I don't receive every label of each post anymore. I only get
    label 1
    , since the other labels don't pass the filter. Is there a way to get every post, that has
    label 1
    while still receiving every other label?
    g
    • 2
    • 2
  • Default policy
    l

    ledet

    10/11/2022, 8:33 PM
    Is it possible to enable RLS by default or set a policy for the anon key that would prevent it from accessing all new tables via API?
    g
    • 2
    • 1
  • I'm getting console error when signing in with my auth
    s

    Solemensis

    10/11/2022, 8:56 PM
    It was working. Today supabase-js library officially went from v1 to v2 i think, so this can be the problem maybe. You can see my auth code and console error below
    g
    s
    +4
    • 7
    • 14
  • getPublicUrl return 400 error
    m

    MrPreet

    10/11/2022, 9:04 PM
    Hi, I am trying to fetch image with getPublicUrl but it return 400 error, even I checked policies of my bucket. I am using Supabase with NextJS
    g
    • 2
    • 3
  • Since upgrading account, no connection through Supabase UI possible
    b

    bengra

    10/11/2022, 10:26 PM
    I upgraded to Pro about 8 hours ago and can't connect to my DB through the Supabase UI anymore. Connecting through my code works fine (CRUD operations etc. are working). Would just love to have the nice Supabase UI available again. I attached a photo of my DB's health
    g
    • 2
    • 4
  • 3rd Party needs to post to my database
    c

    cbunge3

    10/11/2022, 10:30 PM
    I have multiple third parties that need to post to my database. Currently with the REST API documentation I use my service role key/API key. Will this be the case for when I give out the parameters of my database API to these third parties or is there a way to have a temp key or a lower level key made for “their” POST requests
    o
    • 2
    • 1
  • Javascript auth.admin is undefined
    e

    ennio.exe

    10/11/2022, 11:04 PM
    I provided the service_role key instead of the anon key but its still not working
    g
    • 2
    • 2
  • db gone.. uuum why?
    u

    ((()))

    10/12/2022, 1:14 AM
    Did an upgrade to locally hosted supabase, now everything is gone. Why?
    d
    • 2
    • 3
  • Wrong query formation
    a

    Anshuman

    10/12/2022, 2:47 AM
    This is the failed query.
    db.from("workspaces").select().limit(1).eq("teamId", "<teamId>").single();
    Copy code
    I found this in the API logs in Supabase dashboard
    "search": "?select=*&teamId=eq.T034WB3JR27&limit=1&teamId=eq.T0431JUG2DB&teamId=eq.T0431JUG2DB&teamId=eq.T0431JUG2DB&teamId=eq.T0431JUG2DB&teamId=eq.T0431JUG2DB&teamId=eq.T0431JUG2DB",
    }
    I'm not sure why the` &teamId` query is repeated so much. The teamId are different.
    g
    s
    • 3
    • 31
  • Super Slow Loading times
    c

    czypnt

    10/12/2022, 2:50 AM
    Using supabase as a backend for a mobile app, and it is super slow loading images from storage, data and everything else. Takes almost 2-3 secs per page to load on mobile. Do I need to upgrade my servers? I am on the $25 plan with no upgrades
    g
    a
    j
    • 4
    • 16
1...424344...230Latest