https://supabase.com/ logo
Join DiscordCommunities
Powered by
# javascript
  • c

    codesalim

    11/20/2021, 6:05 PM
    hello everyone, I'm getting this error when trying to login
  • m

    Mihai

    11/20/2021, 7:32 PM
    Hello ! I'm trying to query foreign keys from a different table using the following example :
    • 1
    • 5
  • m

    magicbyt3

    11/21/2021, 10:38 AM
    Hi all! I am trying to get rangeAdjacent to work but it bites me. I have a table "scores" which contains a scorevalue column as int8 and an reference to the user, now I am trying to figure out a way to display the users own score +/- 100 adjacent players with their scores, basically a ranking of players. However trying to use rangeAdjacent I get an error:
    Copy code
    js
    hint    "No operator matches the given name and argument types. You might need to add explicit type casts."
    message    "operator does not exist: bigint -|- unknown"
    code    "42883"
    details    null
    Anyone has an idea how I could work that out so the user can see his own standing? Edit: or is there any way to get "my own score" + 100 players ahead?
  • s

    Scott P

    11/21/2021, 7:07 PM
    rangeAdjacent
  • m

    mikewilliams

    11/22/2021, 7:54 PM
    This is more of a general question on conventions: We do a lot of firebase stuff and are moving some stuff to supabase. For an app where you don't have public registrations (and just use the 'Invite user') button, how do you have the supabase email direct them to the reset password page? Currently it just logs them in with a token and redirects them, but the user will have no idea what their password is. Just curious as to what the convention is here or if there's a way I can handle this with supabase that I'm missing. It also seems like the 'reset password' link doesn't really work when I trigger it from the dash. It just redirects and logs into the app
  • k

    kavla

    11/23/2021, 3:55 PM
    Hey y'all! I've got an app that is using passwordless phone auth with twilio. When I call refreshToken it's sending a new OTP, that seems wrong. Perhaps I'm not getting it. I'd expect, perhaps incorrectly, the refreshToken to give me a new valid auth token transparently as long as the refresh token hasn't expired and the user's access hasn't been revoked. Can someone with a better handle on the supabase JWT lend some expertise? If it's a bug I'm happy to chase it but I don't want to be PRing stuff because I'm holding it wrong.
  • k

    kavla

    11/23/2021, 3:57 PM
    Hey y'all! I've got an app that is using passwordless phone auth with twilio. When I call refreshToken it's sending a new OTP, that seems wrong. Perhaps I'm not getting it. I'd expect, perhaps incorrectly, the refreshToken to give me a new valid auth token transparently as long as the refresh token hasn't expired and the user's access hasn't been revoked. Can someone with a better handle on the supabase JWT lend some expertise? If it's a bug I'm happy to chase it but I don't want to be PRing stuff because I'm holding it wrong.
  • i

    InRed

    11/24/2021, 12:12 AM
    In the NextJS SSR Auth example how does the cookie get refreshed before the access token expires? Does
    onAuthStateChange
    fire an event when a new access token is requested/received? https://github.com/supabase/supabase/tree/master/examples/nextjs-with-supabase-auth
  • p

    Pragy

    11/24/2021, 6:22 PM
    How do I resolve the following typescript error? Context: I'm using supabase along with React Query
    Copy code
    ts
    import { useQuery, UseQueryResult } from 'react-query';
    import PostgrestFilterBuilder from '@supabase/postgrest-js/src/lib/PostgrestFilterBuilder';
    
    async function resolve<T>(query: PostgrestFilterBuilder<T>): Promise<T[]> {
      const { data, error } = await query;
      if (error) throw new Error(`${error.message}: ${error.details}`);
      if (!data) throw new Error('Data 404');
      return data;
    }
    
    export function useAPI<T>(
      query: PostgrestFilterBuilder<T>,
    ): UseQueryResult<T, Error> {
      const params = [...query.url.searchParams.values()].slice(1);
      const queryKey = [query.url.pathname, ...params];
      return useQuery(queryKey, () => resolve(query));
    }
    Using the above defined
    useAPI
    hook allows me to simply pass the supabase query and get strictly typed results back. Example usage
    Copy code
    ts
    const result = useAPI(
      supabase.from<definitions['profiles']>('profiles').select(),
    );
    This however gives me a type error saying
    Copy code
    ts
    TS2345: Argument of type 'PostgrestFilterBuilder.default<{ id: string; username: string;}>' is not assignable to parameter of type 'PostgrestFilterBuilder.default<{ id: string; username: string;}>'.
    
    Property 'method' is protected but type 'PostgrestBuilder<T>' is not a class derived from 'PostgrestBuilder<T>'.
  • b

    bent

    11/26/2021, 12:50 AM
    Hi, so I'm kinda struggling: I have a single storage bucket called
    images
    containing three jpegs. I applied those default policies with public access to jpegs, public read access and also made the bucket public. At some point
    supabase.storage.from("images").list()
    worked. Now only
    supabase.storage.getBucket("images")
    or
    .listBuckets()
    etc. works and I don't know what I changed.
  • b

    bent

    11/26/2021, 12:51 AM
    Is there a way to use curl to test the PostgREST api for storage?
  • b

    bent

    11/26/2021, 12:52 AM
    \** doesn't work means in this case, I get
    Copy code
    JSON
    {
      data: [],
      error: null
    }
  • b

    bent

    11/26/2021, 1:41 AM
    i can even upload files to the bucket via the client; only listing doesn't seem to work :/
  • j

    jonny

    11/26/2021, 10:53 AM
    Any chance you generated a new JWT token?
  • b

    bent

    11/26/2021, 12:29 PM
    i don't think so, but what would the consequences be?
  • b

    bent

    11/26/2021, 12:32 PM
    as in - what would I have to change - there doesn't seem to be a way to get a new public anon key? but honestly I don't think it's Auth, because then, I think, I'd be getting an error message. Plus getting bucket meta data and a list of buckets works and uploading new data into the bucket works too
  • b

    bent

    11/26/2021, 12:33 PM
    Maybe I can circumvent it by using the database type APIs instead of the storage APIs for listing? But I really don't get why it worked at some point and then just stopped working
  • u

    user

    11/26/2021, 4:05 PM
    Hey guys, I have a quick question regarding the storage. What my end goal is to be able to delete the previous image on a new image upload from the storage bucket. Currently, I am trying the
    from('test').remove(['folder/test.png'])
    and it is not removing the previous image from the storage bucket. I checked the network request and all it returns is an empty array. Any help would be appreciated.
  • a

    anothercoder

    11/26/2021, 4:15 PM
    U need to give permission to allow the user to Select and Delete from storage.objects. U can refer to the template policies for the bucket.
  • u

    user

    11/26/2021, 4:40 PM
    I have added the policies, because I can upload the images with the same policy settings as I do for delete. if I don't have the permissions it gives me back an error saying violates policies.
  • b

    bent

    11/26/2021, 10:48 PM
    our problems sound kinda similar haha
  • u

    user

    11/26/2021, 11:17 PM
    I finally figured out my issue. I had to break the policies into individual policies instead of the all setting. Have you had any luck solving your problem?
  • b

    bent

    11/26/2021, 11:29 PM
    not yet but I suppose I have to look at my policies now
  • b

    bent

    11/26/2021, 11:48 PM
    yeah it was policies
  • b

    bent

    11/26/2021, 11:48 PM
    😊
  • u

    user

    11/27/2021, 12:40 AM
    Did you have to break them up separately as well?
  • b

    bent

    11/27/2021, 12:52 AM
    i realized i need a seperate policy for read, insert etc and also that i need to specify a policy on either storage.objects or storage.buckets for anything to work
  • u

    user

    11/27/2021, 12:57 AM
    I'm glad we were able to both learn about the policies. That is something that the more we do it the more we will know what to do where.
  • n

    Nathan

    11/27/2021, 2:58 AM
    Hey all, I have an issue where I would like to dynamically add filters to a 'select' query. Specifically the gte() and lte() filters. Currently, I'm creating a query for each filter, then combining the results .. which is obviously not ideal. Any thoughts?
  • a

    anothercoder

    11/27/2021, 3:38 AM
    Chain them in code? https://supabase.com/docs/reference/javascript/using-filters
1...333435...81Latest