https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Local; How can I insert test data into auth.users?
    s

    skagiya

    11/18/2022, 11:08 AM
    What I would most like to do is to insert test data to public users. However, I can't insert directly because the id of the users is tied to the id of the auth's users. Any tips? Thank you!
    n
    • 2
    • 5
  • Generate JSON Schema
    m

    MrPoule

    11/18/2022, 11:19 AM
    Hey community! Is there any way to generate JSON Schema for insert and update. I was thinking something along the line of the type generation for typescript but for json validation in javascript. Thanks already for the help.
    x
    • 2
    • 1
  • Help with Python library
    s

    starsend

    11/18/2022, 2:02 PM
    Big fan of supabase! Just started building a product. I've set up the schema and am trying to push data into the DB via the python supabase library. I've taken the credentials from the Auth part of the website but I am always stuck on: postgrest.exceptions.APIError: {'code': '42501', 'details': None, 'hint': None, 'message': 'permission denied for table Organization'} What are the reasons that could be it? I did run this script thinking it could be it: grant usage on schema public to postgres, anon, authenticated, service_role; alter default privileges in schema public grant all on tables to postgres, anon, authenticated, service_role; alter default privileges in schema public grant all on functions to postgres, anon, authenticated, service_role; alter default privileges in schema public grant all on sequences to postgres, anon, authenticated, service_role; alter default privileges for user supabase_admin in schema public grant all on sequences to postgres, anon, authenticated, service_role; alter default privileges for user supabase_admin in schema public grant all on tables to postgres, anon, authenticated, service_role; alter default privileges for user supabase_admin in schema public grant all on functions to postgres, anon, authenticated, service_role; But no luck Any help will be appreciated!
    g
    s
    • 3
    • 17
  • Supabase is not sending reset password emails
    a

    Alexnortung

    11/18/2022, 2:21 PM
    Hello I am trying to reset a password for myself, but it is not sending an email, however it does send emails when sending magic links. I have tried sending reset password from my app and the supabase interface. Has anyone experienced this issue? Is it a supabase issue or some issue with my configuration?
    j
    g
    +4
    • 7
    • 15
  • new updaete buggerd
    p

    pvtctrlalt

    11/18/2022, 2:50 PM
    I updated to the v2. when i sign in i cant use any thing as it says i dont have rls when it worked before fine. also updated to the newer way of doing it but that didnt work either. when i check to see if a user is signed in a get null
    g
    • 2
    • 40
  • Full Text Search
    r

    rlee128

    11/18/2022, 3:15 PM
    I have full text search working but was trying to find out is there a way for it work where it matches based off say 3 letters like how googles search works?
    g
    d
    r
    • 4
    • 5
  • Help with SQL function
    m

    Matt B

    11/18/2022, 3:16 PM
    I am trying to create a function that returns a set of rows while also joining to another table. SQL doesn't seem to like that I'm returning a setof groups. I am pretty new to SQL, so I'm not sure exactly what I am supposed to be returning here. Any help would be appreciated. 🙂 The arguments taken in the function will be used later once I get this figured out, I just took out the WHERE clause to troubleshoot.
  • updating user returning null
    m

    MDobs

    11/18/2022, 3:51 PM
    We are having issues updating user data and the actions returning null in both the data and the error From an edge function
    const { data, error } = await supabase.auth.updateUser({email: 'new@email.com'})
    From browser
    Copy code
    const { dataSignIn, errorSignIn } = await supabase.auth.signInWithPassword({
            email: userObject.email,
            password: userObject.name,
          })
    
          const { dataSession, errorSession } = await supabase.auth.getSession()
    
          const { user, errorUpdateUser } = await supabase.auth.updateUser({
            email: email,
            password: password
          })
    These functions don't return anything but null and the data don't change on the DB
    j
    m
    +2
    • 5
    • 28
  • Failed to run SQL query
    c

    ChunkyLubie

    11/18/2022, 3:54 PM
    Hey, I am trying to figure out why I'm getting this error thrown when I run query for User Management Starter. The error I get is ```Failed to run sql query: function "handle_new_user" already exists with same argument types```What do I do? Thanks
    g
    • 2
    • 4
  • Non-profit Discount
    n

    NullBitMe

    11/18/2022, 4:08 PM
    Does Supabase currently offer any discounts for charities/non-profit organizations? Thank you!
  • SQL failed to run. Not sure how to fix.
    i

    Ivan Kartashov

    11/18/2022, 4:25 PM
    Hey guys. I'm new to SQL. I would like to implement a new function. I hope you got my idea from code:
    Copy code
    sql
    create or replace function fetch_users(user_id text)
    returns json as
    $func$
      declare @cached_array array
      declare @result json
    
      select @cached_array = cached 
      from public.kisis_cache 
      where tg_id = $1;
    
      select @result = *
      from public.kisis_cache 
      where tg_id not in cached_array and status = 'active';
    
      return @result
    $func$
    language sql;
    In a few words: I would like to initially fetch the array from table. Then return the records from another table where a column is NOT IN that array.
  • twitter auth error
    e

    eunuch

    11/18/2022, 4:42 PM
    Response Body: {"errors":[{"message":"You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve","code":453}]}
    t
    • 2
    • 1
  • realtime
    p

    pvtctrlalt

    11/18/2022, 5:49 PM
    do i need to use this https://github.com/supabase/realtime if i want to use realtime? or is built into supabase now?
    g
    • 2
    • 4
  • How to make a func return several Records
    i

    Ivan Kartashov

    11/18/2022, 6:59 PM
    I want to return a QUERY, but there's only "RECORD" type available when creating a new RPC func.
    g
    • 2
    • 3
  • webpack-internal.node_modulesnextdistclientdeverror-overlayhot-dev-client.js26255 ERROR
    n

    NØØne

    11/18/2022, 7:41 PM
    After updating with "npm i next@latest react@latest react-dom@latest eslint-config-next@latest" I get this error message when I "npm run dev" my project: "TypeError: Cannot read properties of null (reading 'length') at eval (webpack-internal:///./node_modules/next/dist/client/dev/error-overlay/hot-dev-client.js:262:55)". Anyone getting the same error? Any idea how to solve it? I reverted to 13.0.3 but I still get it. Thanks.
  • Migrating to v2
    f

    fadethegap

    11/18/2022, 8:24 PM
    I'm getting ready to migrate to v2. Our app that uses supabase as the backend is live, and I'm terrified of installing the v2 upagrade and then finding myself in bug hell. @garyaustin provided me the link to the upgragde-guide, and I've read the release notes, etc. I understand I will have to make some auth mods, and .(eq).select() mods in my code. My main question is: if I checkout a git branch, perform the upgrade, and don't merge it with main, will my package.json file remain intact? Bottom line, can I work on the upgrade in a branch until I get things working, and have main remain intact with the v1 dependencies?
    s
    • 2
    • 2
  • Maintainer of postgrest-rs needed!
    k

    konga

    11/18/2022, 9:43 PM
    https://github.com/supabase-community/postgrest-rs/pull/46 Here's the fix with a more detailed explanation.
    s
    • 2
    • 5
  • sveltekit form login
    z

    zeedee

    11/18/2022, 10:25 PM
    Throwing another question out here for anyone experienced in svelte form actions and supabase I'm implementing a supabase login (with plans to move it to production after hammering out the kinks in my knowledege) I'm running into an issue with login.
    Copy code
    js
    /** @type {import('./$types').Actions} */
    export const actions = {
        login: async (request, page) => {
            const formData = await request.formData();
            const { data, error } = await supabaseClient.auth.signInWithPassword({
                email: formData.get('email'),
                password: formData.get('password'),
            })
            return {data, error}
        },
        register: async (event) => {
            // TODO register the user
        }
    };
    There is my form action,
    Copy code
    html
        <form method="POST" action="?/login">
            <input name="email" type="email" />
            <input name="password" type="password" />
            <button>Log in</button>
        </form>
    the form itself How to I pass the login back from the server into my app? I tested the login using a clientside function
    Copy code
    ts
         async function handleRandom(email, password) {
             const { data, error } = await supabaseClient.auth.signInWithPassword({
                 email,
                 password
             });
         }
    This works. However I need the login handled serverside. What do I need to wire up to make it work?
    g
    • 2
    • 1
  • Is there any hook in supabase like isAuthenticated in Auth0?
    z

    ZebraCoder

    11/18/2022, 11:12 PM
    Is there any hook in supabase like isAuthenticated in Auth0?
    z
    • 2
    • 3
  • Error when uploading to Storage (Swift)
    m

    malachi

    11/18/2022, 11:25 PM
    I keep getting this error when trying to upload an image file to my Supabase Storage bucket: "StorageError(statusCode: Optional(400), message: Optional("Error"))". I am trying to figure out if there is an issue with my code or with the way I have set up my Storage policies. I have attached an image of my code, any help would be greatly appreciated!
    g
    • 2
    • 76
  • Supabase + NextJS authorisation without RLS
    e

    epsilon42

    11/19/2022, 7:15 AM
    TL;DR: A bit overwhelmed with having to learn RLS and was hoping to find an alternative Supabase + NextJS example of how an authenticated user can access only things they are authorised to in a DB ----- Firstly, I realise there are probably some fundamental things I'm not understanding about the way things work, so apologies for the dumb questions and being all over the place 😅 I come from a frontend background and can see the power of RLS but there's a lot to learn so I'm getting overwhelmed with having to learn RLS policies on top of everything else. I was hoping to see if there was an alternative approach to make an app that has the same functionality as the NextJS quick start (i.e. limit what users are authorised to make changes to), but without the RLS policies aspect. I don't necessarily need code examples, but was just after some direction on how I should modify the project in the quick start tutorial in order to achieve the same result. Was thinking something along the lines of having an API route which interacts with the DB. As the JWT contains the user id, this would be enough for me to determine what the user is authorised to do (I'm feel like I'm okay with this part). Do I just send this token as an auth header when calling the API route? Or is this already handled with some of the Supabase libs. If taking this approach would I also need to: verify the token against my JWT secret, and check whether a token is expired? (my thinking: if an expired token is posted to the API, and I haven't programmed in these checks, then the API function will proceed with grabbing the user id and performing the DB transaction even if the token is expired).
    n
    • 2
    • 4
  • How Self Hosting without docker?
    a

    AndrewSong

    11/19/2022, 10:50 AM
    local hosting directly
    s
    • 2
    • 3
  • Supabase edge functions + JS framework
    m

    meow

    11/19/2022, 12:17 PM
    Can Supabase edge functions be used to run a JS framework such as Deno's Fresh?
    v
    • 2
    • 1
  • SessionContextProvider initialSession prop
    e

    epsilon42

    11/19/2022, 1:42 PM
    In the guides/tutorial the
    SessionContextProvider
    has an
    initialSession
    prop. Does this code do anything in the example, or is
    getServerSideProps
    required in order for this to actually have a value?
    Copy code
    import '../styles/globals.css'
    import { useState } from 'react'
    import type { AppProps } from 'next/app'
    import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
    import { SessionContextProvider, Session } from '@supabase/auth-helpers-react'
    
    function MyApp({
      Component,
      pageProps,
    }: AppProps<{
      initialSession: Session
    }>) {
      const [supabaseClient] = useState(() => createBrowserSupabaseClient())
    
      return (
        <SessionContextProvider
          supabaseClient={supabaseClient}
          initialSession={pageProps.initialSession}
        >
          <Component {...pageProps} />
        </SessionContextProvider>
      )
    }
    
    export default MyApp
  • Is it possible to set the desired return type for a select ?
    y

    YANN

    11/19/2022, 2:05 PM
    Hello, let's say I want to query 2 fields like
    Copy code
    ts
    supabase.from("table").select("id, color");
    Ideally I would like to receive the color field in a nested record, as such:
    Copy code
    json
    {
        id: 0,
        appearance: {
            color: 5
        }
    }
    I know this is possible via graphql, but I would like to avoid using it, thanks in advance!
    g
    • 2
    • 2
  • Prevent plpsql function to be invoked with rpc
    e

    enyo

    11/19/2022, 4:10 PM
    I called
    alter default privileges revoke execute on functions from public;
    but my function is still available to be invoked with
    supabase.rpc
    . What can I do to prevent a function from being accessible by users?
    g
    • 2
    • 15
  • Set up self-hosted supabase for web-access?
    t

    TheGreyRaven

    11/19/2022, 4:13 PM
    Hello! I have downloaded supabase docker container and I'm looking at the .env file. I want to be able to access the supabase dashboard from an url like this: " https://backend.domain.com/ ", the env file is a bit unclear for me as there are multiple different ports that I can change and most of them points to localhost. What settings do I need to change to open up my selfhosted supabase to the web?
  • Hide or prevent SUPABASE_KEY from being exposed on the client
    a

    adolfoportilla

    11/19/2022, 4:43 PM
    Every time I make a API call, the supabase key is sent. I know this is intended, but there is an issue. This key can be used to send a manual request and delete tables, access information that I don't want that user to have. Is there any way I can prevent this? I enabled RLS, and it works in the browser, because I can distinguish the user. But if they send a curl request, or use postman, RLS does not prevent them from accessing the tables/rows I don't want them to access.
    g
    • 2
    • 2
  • Delete Folder in Storage
    b

    benyi3k

    11/19/2022, 5:11 PM
    I have this problem: await this.orderSvc.deleteAttachment(${this.order.branch_id}/${this.order.id}); async deleteAttachment(path: string) { return new Promise(async (resolve, reject) => { let { error, data } = await this.supabase.storage.from(this.from_attachments).remove([path]); if (error) { reject(error); } else { resolve(data); } }); } I create a folder with the branch_id, and then a child folder with the order_id, and inside i upload the files. But when I trigger remove([path]) to remove the order_id folder, is not deleted. Is this way to do it or there's a better way? Thank you!
    g
    • 2
    • 6
  • Deploy Error with Stripe Example
    c

    COP

    11/19/2022, 5:35 PM
    I was just tinkering around with the edge functions and after getting the environment set up I tried to deploy the stripe example and was receiving this error. I’m not if it is me or if the stripe webhook example needs to be updated.
1...676869...230Latest