https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How to add RLS to my View
    r

    rafael

    03/01/2023, 12:48 AM
    Hey guys, I created a view using:
    Copy code
    CREATE OR REPLACE VIEW projects_public AS
      SELECT P.id, P.name, P.description, P.instructions, P.created_at, U.first_name, U.last_name, U.avatar
      FROM public.projects P
      INNER JOIN public.user_profile U ON P.owner_id = U.owner_id
      WHERE P.visibility = 'PUBLIC'
    And I read something saying views are public. So I'm not sure if is public PUBLIC or is public available to authenticated users. So, I tried to add authenticated only for this view...
    Copy code
    ALTER VIEW projects_public OWNER TO authenticated;
    But then I get an error:
    Copy code
    Failed to run sql query: permission denied for schema public
    Looks like this is not the correct way. What I'm doing wrong? Do I have to add this kind of role to access my view? Thanks
    g
    • 2
    • 1
  • RPC Calls not working inside docker? (C# Client)
    u

    Unknown Member

    03/01/2023, 2:53 AM
    I am currently calling RPC from within a dockerized .NET server, but it seems like it's not working. It's giving me this weird error saying that no function can be found without parameters in schema.. but my logs says my parameters do exist... I wonder if there is some additional step I have to do if I am calling Supabase RPCs within a dockerized server. For reference, the RPC works in my local device, and other Supabase functionalities work. Wonder if anyone has encountered such issue with docker and supabase? IF ANYTHING - I can just migrate all my RPC calls to the front-end, but I really want to have it in the server for security and additional business rules.
    g
    a
    • 3
    • 27
  • Supabase storage upload gives error "The parent resource is not found" with custom JWT
    e

    ericrav

    03/01/2023, 2:56 AM
    Hi! I'm trying to upload an image to a storage bucket from the browser using the JS client api with a custom JWT, but it responds with the error "The parent resource is not found". I am setting my Supabase client up with a JWT header that I'm creating with NextAuth.js like so:
    Copy code
    createSupabase<Database>(
      process.env.NEXT_PUBLIC_SUPABASE_URL!,
      process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
      {
        global: {
          headers: {
            Authorization: `Bearer ${supabaseAccessToken}`,
          },
        },
      },
    );
    Also, I'm running Supabase locally in Docker on macOS. If I remove this Authorization header, the upload does work. However, I can use this custom JWT to insert data into the database without a problem and access my custom JWT data in the RLS policies for my table, so it seems to only affect the storage API. (I want to be able to access my custom JWT data in the storage bucket policy too, but currently I'm using a storage policy that evaluates to
    true
    until I can get the upload working). Searching the error "The parent resource is not found" on Google only returns a single result: https://www.reddit.com/r/Supabase/comments/1137lru/how_to_upload_through_http/ Any ideas what this means or how to further debug?
    g
    • 2
    • 11
  • Retrieve file metadata
    n

    nkeating

    03/01/2023, 3:15 AM
    Does supabase storage have a way to retrieve file/image metadata? Cloudinary/Imgix have dedicated calls to retrieve this, making it easy to store in database.
  • Unknown "in" filter syntax in realtime subscription.
    a

    Agusjk

    03/01/2023, 3:17 AM
    I'm having some problems with using an "in" filter in a realtime subscription, i'm pretty sure that there is no docs explaining how to use it in this case. I need help.
    g
    • 2
    • 5
  • Can not set realtime for table
    s

    sinrabo

    03/01/2023, 4:09 AM
    I try to set supabase realtime for my table but I get this error: failed to update pg.publications with the given ID: must be owner of publication supabase_realtime How can I fix this error?
    g
    • 2
    • 10
  • Cannot read properties of undefined (reading 'decode')
    m

    MoreeZ

    03/01/2023, 4:20 AM
    I ran into the following error when updating my dependencies. I probably need to upgrade or downgrade a dependency but Idk which. Has anyone ran into this issue before? Only the web version of my react native app is failing. error:
    Copy code
    Uncaught TypeError: Cannot read properties of undefined (reading 'decode')
        at new URLStateMachine (url-state-machine.js:541:1)
        at module.exports.basicURLParse (url-state-machine.js:1259:1)
        at new URLImpl (URL-impl.js:19:1)
        at Object.setup (URL.js:73:1)
        at new URL (URL.js:105:1)
        at new SupabaseClient (SupabaseClient.ts:104:1)
        at createClient (index.ts:38:1)
        at ./src/state/supabase.js (supabase.js:6:1)
        at __webpack_require__ (bootstrap:24:1)
        at fn (hot module replacement:62:1)
    supabase config
    Copy code
    js
    import "react-native-url-polyfill/auto";
    import AsyncStorage from "@react-native-async-storage/async-storage";
    import appjson from "../../app.json";
    import { createClient } from "@supabase/supabase-js";
    
    export const supabase = createClient(
        appjson.supabase.url,
        appjson.supabase.anon_key,
        {
            auth: {
                storage: AsyncStorage,
                autoRefreshToken: true,
                persistSession: true,
                detectSessionInUrl: false,
            },
        }
    );
    z
    • 2
    • 3
  • Need help supabase auth flow
    i

    itzSuNNy

    03/01/2023, 7:44 AM
    hi devs i am facing this issue while removing domain from supabase this message clearly say i dont have any domain register but it show on supabase admin portal this cause issue in auth flow i have to remove
    s
    • 2
    • 1
  • set access token
    n

    NJ™

    03/01/2023, 8:03 AM
    I am facing an issue in inviting the user. As a super admin i am inviting user using inviteUserByEmail. I want to redirect them to set password page where they can set their password and login. I am unable to set their password i assume it would require and access token or something which I am not getting in the url. #1006358244786196510
    s
    • 2
    • 29
  • Database user request
    l

    lecookie

    03/01/2023, 8:03 AM
    So I have a kinda hard problem that I don't know how to solve. I have 2 tables 1 publicprofile 2 profile publicprofile is a the same as profile but doesn't contain tokens know I am creating an admin panel but I need to access the private profile of other user. The question is is there any way to only return the private profiles of everyone if the user that is making the request is admin
    • 1
    • 2
  • Realtime DB Updates cost per update or eventsPerSecond?
    n

    NicolasM

    03/01/2023, 8:55 AM
    Hi! I am currently evaluating Supabase for a Project where realtime Updates of the Dashboard would be real nice. As I wanted to caluclate the presumable cost, I wasnt sure what metric to apply tho. In the docs there is a "eventsPerSecond" param for the realtime options. If I were to set this to 10 and create a client that uses realtime Postgres Updates to stay on the newest version of data, would this be 10*60 = 600 Updates per minute, or just the actual number of changes to the DB Table? Thx!
  • Unable to use 'https://esm.sh/@supabase/supabase-js@2' for Edge Functions.
    j

    Jafrilli

    03/01/2023, 9:03 AM
    I'm running supabase locally using the supabase CLI via
    supabase start
    . I'm trying to import createClient, SupabaseClient, and other objects from 'https://esm.sh/@supabase/supabase-js@2' to use within my edge functions. Using
    supabase functions serve <edge function name>
    results in this error:
    error: TS2305 [ERROR]: Module '"internal:///missing_dependency.d.ts"' has no exported member 'createClient'
    . This has never happened before, and I'm honestly not sure what I did to make this happen. Not sure where to begin solving this to be honest. I stopped and started my local supabase, updated the CLI, but nothing I can think of is working. Is there a particular reason why this is happening? This is my function. It is basically the default template, with the added import.
    Copy code
    ts
    import { serve } from 'https://deno.land/std@0.168.0/http/server.ts'
    import { createClient } from 'https://esm.sh/@supabase/supabase-js@2' // <- causes the typescript error. seems like the types are not getting imported, which is weird, since this has never happened before.
    
    console.log('Hello from Functions!')
    
    serve(async req => {
      const { name } = await req.json()
      const data = {
        message: `Hello ${name}!`
      }
    
      return new Response(JSON.stringify(data), {
        headers: { 'Content-Type': 'application/json' }
      })
    })
    o
    • 2
    • 2
  • how to use graphql in plv8 and then create custom resolver for graphql?
    r

    Richard77

    03/01/2023, 10:04 AM
    I need help using plv8 to query graphql and then create a custom resolver. Thank you
    g
    j
    • 3
    • 3
  • Prisma and Supabase Auth
    f

    Fayyaz

    03/01/2023, 10:39 AM
    Hi all, I am starting my first project using nextjs13, where I plan to use prisma for any db operations and like to use supabase auth for user auth and management. I don't want to use "multischema" as by using multischema exposes all auth schema in the application. Looking any recommendations/pros and cons using "multischema" or using prisma and auth separately. Regards #prisma #multischema #auth
    s
    b
    • 3
    • 5
  • Is Supabase is a good choice for application like (Social Network)?
    d

    DevThoughts

    03/01/2023, 10:54 AM
    I am looking in to alternative, and wondring if Supabase is a good choice for application like (Social Network)?
    b
    a
    j
    • 4
    • 12
  • business logic using supabase + graphql
    r

    Richard77

    03/01/2023, 12:21 PM
    can some give me pointers how can i use supabase and graphql as backend? i need to do some business logic for query result. i need to them in graphql resolver but really have no clue where to write custom resolver.
    m
    • 2
    • 1
  • onAuthStateChange callback
    o

    Oleksandr Nedilko

    03/01/2023, 1:16 PM
    As described in documentation https://supabase.com/docs/reference/javascript/auth-onauthstatechange currently
    onAuthStateChange()
    doesn't work across tabs. But I suppose this is not true. I setup next js 13 project with app directory routing, wrapped
    onAuthStateChange
    in
    useEffect
    callback with empty array of dependencies, and added condition it
    event === "PASSWORD_RECOVERY"
    then show password reset modal. When I follow password recovery link, it opens in new tab, modal shows and everything is okay. Except one thing - this modal also opens in initial tab, from which I invoked the process of restoring password. So the issue here is when I reset password from newly opened tab (the one opened by following password reset link), this reset password modal closes after successful password reset, but on the initial tab (the one from which I initialised password reset procedure), password reset modal also appears and not closes until I manually go to this initial tab and close this modal. Is this expected behaviour of
    onAuthStateChange
    or I'm doing something wrong with my application state?
    g
    n
    +2
    • 5
    • 101
  • Thousands of auth api calls
    f

    Funky Duck

    03/01/2023, 2:18 PM
    I have an application with 5 users. In the supabase dashboard I am seeing 3000 requests to
    /token
    per minute. I am using the Flutter SDK, is this normal? There must be something wrong?!
    g
    • 2
    • 7
  • NextJS auth-helper settings. "anon" role works, but not "authenticated" role
    p

    peepoo

    03/01/2023, 2:23 PM
    How can I make specific user as the admin and only let this account to do certain action, in this case, insert data into the database? EDIT: anon works and authenticated does not when inserting data into table with RLS setting "authenticated" as the target role
    g
    n
    • 3
    • 33
  • Converting existing column to array type
    h

    Hugos

    03/01/2023, 3:39 PM
    I've got this table I imported from a CSV, can i convert the moves and categories column to an array? I tried just marking it as array but there wasn't an option to specificy it should split on space's or anything like that
    g
    • 2
    • 1
  • Email vs social auth
    ř

    Řambo

    03/01/2023, 3:43 PM
    If i login with social provider, my tokens are saved in local storage so if i refresh i keep the session. If i login with email and password and i refresh, it lose the session. Why does this happen, and what are some ways i can handle this?
  • Ensure uniqueness across multiple columns
    j

    Jaba

    03/01/2023, 4:23 PM
    Hi, I'm wondering if there's a way to ensure uniqueness of a row based on multiple columns. i.e. each row must have a unique combination of two columns. In my case I have a bookings table which combines student_ids and lesson_ids. I want to ensure that there can only ever be one booking in the table for each student-lesson combo, in order to prevent the same user booking onto a lesson multiple times. Was wondering if I have to use triggers/functions for this or if I could use policies?
    n
    • 2
    • 3
  • Where can I find Documentation for API endpoints?
    p

    prenx4x

    03/01/2023, 4:23 PM
    Hello, Where can I find documentation for all the api endpoints. I want to see all return status, error messages etc and the javascript references does not provide a detailed list of all possible params, return types and error codes that can be returned.
    b
    • 2
    • 1
  • 429 too many requests: 5 requests per min???
    g

    gintruxx

    03/01/2023, 4:43 PM
    Hi, I’m using supabase-py package inside a python project. I called sign_up method a few times while testing and I’m getting: httpx.HTTPStatusError: Client error '429 Too Many Requests' for url 'https://aplakvklqzaywmdehpxc.supabase.co/auth/v1/signup' this is ridiculous. How can there be 429? I only made 3 requests this minute. Nobody will be able to use the database at all with such limitations. What is happening? I also created trigger & sql function on new user sign up
    g
    • 2
    • 2
  • How to use Basic Auth in an edge function?
    d

    drewbie

    03/01/2023, 5:07 PM
    I am trying to secure an edge function I have deployed via basic auth. Its a webhook listener and i want to make sure people cant slam the webhook. I tried calling the webhook url via http://foo:bar@localhost:54321/functions/v1/function-name, but I'm not seeing the url in the request of the Edge function to be able to validate if the password if correct. I couldnt find any docs on this so Id appreciate anyones help! Thanks
    • 1
    • 1
  • Retrieving a random row with filters
    h

    Hugos

    03/01/2023, 5:25 PM
    I want to retrieve a random row that still complies with some criteria:
    Copy code
    js
        const { data, error } = await supabaseClient
        .from("puzzles")
        .select("*")
        .eq('id', Math.floor(Math.random() * (50000)))
        .lt('rating', 700)
        .limit(1)
        .single();
    I want to retrieve a random row from puzzle where the rating column has a value thats less than 700, how could i achieve such a thing?
    d
    a
    • 3
    • 71
  • How to calculate database egress?
    d

    DanMossa

    03/01/2023, 5:45 PM
    My plan has 50gb of Database egress a month. I want to know how much is added to that when I retrieve values from the database using my client. What's a good way to check this? Should I just grab the size of the returned json in bytes? What's the overhead?
  • Function Store
    b

    bekathegooner

    03/01/2023, 6:10 PM
    Hello everyone, could you please explain where is this function store in the architecture diagram? I'd like to learn how Supabase saves Edge function metadata in this function store.
  • user still available after deleting from supabase dashboard
    ř

    Řambo

    03/01/2023, 6:30 PM
    Im singing up with email. If i delete the user from authentication section on supabase and i refresh the page. The user and session is still there
    g
    • 2
    • 3
  • RLS rules
    l

    lecookie

    03/01/2023, 6:52 PM
    I have a table with public data like names and private data in it is there any way I can only return the private of all user if they are admin ? admin is a value that each user has that is boolean
1...150151152...230Latest