https://supabase.com/ logo
Join Discord
Powered by
# javascript
  • r

    Roshan J.

    07/03/2022, 3:07 PM
    Realtime db update through Supabase React
  • m

    Murkrage

    07/03/2022, 3:27 PM
    When using
    auth.verifyOTP()
    in NextJS and subsequently redirecting to the page that you should now have access to, it unfortunately redirects the user straight back to login. Here's the code that I'm using:
    Copy code
    ts
      const verifyOTP = async () => {
        const { user, error } = await supabaseClient.auth.verifyOTP({
          email: getValues('email'),
          token: getValues('otp'),
          type: 'magiclink',
        });
    
        if (error) {
          console.log('Error while verifying OTP', error);
          return;
        }
    
        if (user) {
          console.log('Logged in');
          setTimeout(() => {
            console.log('redirecting to recipes');
            router.push('/recipes');
          }, 1500);
        }
      };
  • g

    garyaustin

    07/03/2022, 3:46 PM
    verifyOTP does a redirect back to the site URL (you can change it with redirectTo option and setting in server).
  • m

    Murkrage

    07/03/2022, 3:47 PM
    It doesn’t on my end, because then it would go to the page that requires logging in. It’s not redirecting anywhere atm
  • h

    hoesmean

    07/03/2022, 5:16 PM
    #869406062036529193 i got fetch before join table like this query but not i can't. I have tables listing, category and join table listing_category. I use to get data but now i got null. const fetchListing = async () => { let { data } = await supabase .from('listing') .select(
    Copy code
    id,
        name,
        telephone,
        isSponsored,
        img,
        category(id,name)
    ) setCard(data); console.log(data); }
    s
    • 2
    • 1
  • m

    Marcos Abreu

    07/03/2022, 5:20 PM
    Hi, friends! I am using Next.JS in Cloudflare Pages. I did only use the example repo and removed the SSR code. After sign in, I am receiving the following error message:
    Copy code
    XHR GET https://notas-sytech.pages.dev/api/getUser
    [HTTP/3 404 Not Found 93ms]
    What is my mess and how can I fix it?
  • j

    Juninhopo

    07/03/2022, 9:56 PM
    hello guys, i need help to add data in supabase.
    l
    • 2
    • 5
  • Supabase with Svelte
    s

    silentworks

    07/03/2022, 11:51 PM
    Can you share which part of your code you are getting this error from? also this starter is using Svelte and not SvelteKit.
  • s

    silentworks

    07/03/2022, 11:51 PM
    Supabase with Svelte
  • b

    bhaskar

    07/04/2022, 12:15 AM
    Hi, i am getting
    invalid input syntax for type integer: "-122.1200894"
    for rpc function call. lat and long are decimal on the function and it is number on the frontend as well.
    Copy code
    const { data, error } = await client
          .rpc('get_nearby', {
              page_count: propertyRequest.pageInfo.pageCount,
              page: propertyRequest.request.coordinates.lng,
              distance: 10000,
              lat: propertyRequest.request.coordinates.lat,
              long: propertyRequest.request.coordinates.lng,
            });
    need help here.
  • g

    garyaustin

    07/04/2022, 12:20 AM
    You probably need to show your actual function as that is where the error is.
  • b

    bhaskar

    07/04/2022, 12:24 AM
    Copy code
    create or replace function public.get_nearby
    (lat DECIMAL, long DECIMAL, distance DECIMAL, page_count INTEGER, page INTEGER ) 
    returns setof properties
    language sql
    as $$
      select * from 
      (select * from properties where 
        ST_DWithin(ST_Point(latitude, longitude)::geography, ST_Point( lat, long)::geography, distance)
        order by st_distance(ST_Point(latitude, longitude)::geography, ST_Point( lat, long)::geography), properties.id
      ) a
      
      LIMIT (page_count) offset page;
    $$;
    select * from get_nearby(47.68079669999999, -122.1200894, 10000, 2, 9)
  • b

    bhaskar

    07/04/2022, 12:29 AM
    @garyaustin
  • g

    garyaustin

    07/04/2022, 12:33 AM
    Does the Postgres select call error? Did you ever create the same named function with different input parameters.?
    b
    • 2
    • 10
  • b

    bhaskar

    07/04/2022, 12:36 AM
    yes
  • b

    bhaskar

    07/04/2022, 12:41 AM
    @garyaustin postgres select just works fine. rpc call fails
  • g

    garyaustin

    07/04/2022, 12:58 AM
    And you did not have different type parameters at some point?
  • b

    bhaskar

    07/04/2022, 12:59 AM
    yes
  • j

    jaitaiwan

    07/04/2022, 1:49 AM
    Hey guys did someone experienced an
  • b

    benten

    07/04/2022, 2:21 AM
    How do I property type a query builder that can handle both arrays and single responses?
  • b

    benten

    07/04/2022, 2:21 AM
    If I use this union
    PostgrestBuilder<T> | PromiseLike<PostgrestSingleResponse<T>>
    the return value either an array or an object which is obviously bad
  • b

    benten

    07/04/2022, 2:22 AM
    Why does using .single() change the type to PromiseLike<PostgrestSingleResponse>?
  • l

    LEGEND

    07/04/2022, 3:46 AM
    hello guys i need help to add data in
  • k

    kiwicrog

    07/04/2022, 3:55 AM
    Hello, I've struck a 500 error upon deploying a SvelteKit app to Cloudflare Pages that contains a Supabase subscription, detailed here: https://github.com/supabase/realtime-js/issues/165
  • s

    Steve

    07/04/2022, 6:34 PM
    From my JavaScript client some requests
  • s

    Steve

    07/04/2022, 6:38 PM
    javascript i got fetch before join table
  • b

    Brunowilliang

    07/04/2022, 10:48 PM
    hi guys, I have a supervisor table that is related to an order table, is there any way to delete all records that are related to supervisorId?
    s
    • 2
    • 1
  • s

    silentworks

    07/04/2022, 10:59 PM
    Delete Cascade
  • u

    7seas3c

    07/05/2022, 5:26 AM
    im using prisma client and now im trying to seed my database but it throws me
    segmentation fault
    . How do I solve it?
    o
    • 2
    • 17
  • r

    reblis

    07/05/2022, 8:57 PM
    I'm having an issue where my Next JS app is not receiving updates on a subscription. My table has realtime enabled (and the table has replication enabled for insert, update, delete, and truncate). For simplicity sake, I removed an unsubscribe logic just to be sure that wasn't the issue. Here's the code snippet I'm using (note that subscribe is definitely called as expected):
    Copy code
    useEffect(() => {
        if (isVisible && !_supabasePost) {
          const post = supabase
            .from("post:id=eq." + initialPost.id)
            .on("*", (payload) => {
              console.log(`Post updated`, payload);
              fetchPost(initialPost.id);
            })
            .subscribe();
    
          _setSupabasePost(post);
          const postComments = supabase
            .from("post:parent_id=eq." + initialPost.id)
            .on("*", (payload) => {
              console.log(`Comments updated`, payload);
              fetchPost(initialPost.id);
            })
            .subscribe();
    
          _setSupabasePostComments(postComments)
        }
      }, [isVisible]);
    Are there any other things I may be missing? I've also disabled RLS on the table
    g
    • 2
    • 1
1...676869...81Latest