https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Permission Denied on Schema with `stripe-sync-engine`
    n

    nahtnam

    01/28/2023, 9:26 AM
    I'm setting up
    stripe-sync-engine
    for my project and noticed that the init script did not create a schema. I tried creating one with the following in the web UI:
    Copy code
    CREATE SCHEMA IF NOT EXISTS stripe;
    GRANT USAGE ON SCHEMA stripe TO postgres;
    GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA stripe TO postgres;
    but now I'm getting this error:
    Error: Migration failed. Reason: permission denied for schema stripe
    Any ideas why?
    • 1
    • 3
  • How do you use the `stripe-sync-engine`?
    n

    nahtnam

    01/28/2023, 10:12 AM
    Hello! I am struggling a bit to understand how to use the stripe-sync-engine. I understand how the whole workflow with stripe works and this is what I think I need to do: 1. Create customer in stripe via api 2. Add
    customer_id
    into
    profiles
    table 3. Create a subscription through my app 4. stripe-sync-engine will auto capture through the webhook the status What now? I think if I had premium content, I can add a RLS lock that cross references that the customer has an active subscription? What if in my app I would like to get a boolean if the user is subscribed or not? Do I need to make a trigger to sync the customers state into the profiles table? Seems kind of cumbersome, any way I can add a computed column or view or make my
    stripe
    schema public to supabase (but secured via RLS)?
    • 1
    • 3
  • Generated Functions
    e

    ehesp

    01/28/2023, 10:30 AM
    Hello, Is it possible to generate Edge Functions to they live in a ignored directory? Netlify have this: https://docs.netlify.com/edge-functions/create-integration/ I'd prefer not to keep my generated code in the same directory as my other functions, instead keep it in a gitignored directory. Is this possible?
  • Is it possible to validate that text is not empty?
    e

    Einar Persson

    01/28/2023, 12:12 PM
    Hi! New here. I have just created a hello world Person-table with columns
    id
    ,
    name
    (text) and
    title
    (text) I have marked the columns as not nullable, and I verified in the UI that it prevented me from creating a new row if name or title was absent. However, I also noticed that I via the javascript-client was able to insert empty strings. My question is simply: Is it possible to prevent empty strings from being accepted as valid values, similar to not being null?
    s
    l
    • 3
    • 3
  • How to know the outcome of signInWithOAuth() in Flutter SDK?
    s

    SandySeagull

    01/28/2023, 1:18 PM
    Hello! I have just implemented Google OAuth in my Flutter app, and it seems to be working fine. However, the "signInWithOAuth()" function that I am using for such purpose returns true immediately as soon as the Google OAuth webpage is opened, regardless of the authorization outcome. I believe this is a design choice, as I probably have to wait for a new event on the "onAuthStateChange" to determine whether the login attempt was successful or not. I want the app UI to reflect this wait (which at times is even a few seconds on bad connections), for example by displaying a message as soon as I call "signInWithOAuth()" and until I receive an event about the outcome. Unfortunately, while I do receive an event on a successful login, I DO NOT receive one on failed or cancelled attempts. So how can the app know that the attempt has failed? Thanks for any insight 🙂
    g
    • 2
    • 2
  • Google Oauth not creating session in flutter app
    i

    Imposer

    01/28/2023, 1:40 PM
    I am trying to sign in the user using google provider. When the button is clicked, browser is opened , the user selects google account and then it redirects back to the application. The database is getting updated with the google credentials but when the user is redirected to the app no session is created. Should i do smtg when the user is redirected? I am getting the currentUser as null when the redirection is successful. Please help me
    g
    • 2
    • 1
  • NextJS /api vs. supabase Deno Edge functions
    l

    logemann

    01/28/2023, 1:42 PM
    Hi guys, i have somewhat a general question. I definitely need some backend functions within my NextJS / supabase project. Which approach do you use for writing those functions. 1) using the built in NextJS /api approach 2) using supabase Deno functions 3) i deploy on Netlify and could also use Netlify Functions So many options. Currently i am reading about the Supabase Deno TS functions and these looks sexy.. together with backed in JWT validation... i tend to option (1). Thoughts? Thanks guys.
    a
    g
    • 3
    • 7
  • Failed to create hook
    k

    Kuba

    01/28/2023, 2:50 PM
    Hello, I wanted to create a Webhook, but I get following error:
    Copy code
    Failed to create hook: failed to create pg.triggers: schema "supabase_functions" does not exist
    I enabled
    PG_NET
    and created schema
    supabase_functions
    , but then I got following error:
    Copy code
    Failed to create hook: failed to create pg.triggers: function supabase_functions.http_request() does not exist
    I stumbled upon this discussion on GitHub: https://github.com/supabase/supabase/discussions/6966, but the
    extensions
    is already in path. Adding
    pg_temp
    doesn't solve the issue either. Enabling
    HTTP
    extension for
    extensions
    or previously created
    supabase_functions
    doesn't work. PS.: The UX in this section is cumbersome. Clicking on the popup to copy the error text dismisses the menu for hook creation.
    g
    p
    +2
    • 5
    • 47
  • Processing files in Storage by Edge functions
    e

    Eidur

    01/28/2023, 4:19 PM
    I'm downloading XML files and processing them in edge functions. It works really well but my app is still really small and I am already noticing very large data egress. Is it a bad practice to download to storage and process with edge functions? Are there better solutions for this? Should I just use 3rd party storage that is cheaper/has larger limits for data processing? Any recommendations? Any tips are welcome
  • Generated types with type gen but types are inferred in VSCode
    u

    3dyuval

    01/28/2023, 4:47 PM
    Hey, I've followed this video

    https://www.youtube.com/watch?v=7CqlTU9aOR4&t=73s▾

    and got the correct type schema file created, put it into the generic of createClient function, but I am not getting any nice auto complete?
    • 1
    • 1
  • Function Call via RPC returns null but works in UI
    b

    bewfra

    01/28/2023, 5:06 PM
    1. I have a custom function that works just fine when being called f rom the SQL Editor e.g. via
    SELECT "getcategorychildren"('cat_3c9193d0b2a451f57f64692a0b87c70f')
    2. I copied the code from the docs to invoke the function from my JS client like:
    Copy code
    let { data, error } = await supabase
      .rpc('getcategorychildren', {
        category_id_initial: 'cat_3c9193d0b2a451f57f64692a0b87c70f'
      })
    
    if (error) console.error(error)
    else console.log(data)
    It returns
    null
    . Other queries work just fine. I am using the
    SECRET_KEY
    right now since its server side. What could be the issue? It worked shortly before, I then changed the function - just changed the name to be honest - and ever since its just
    null
    g
    • 2
    • 30
  • Sveltekit auth helper function question
    t

    Trixrabbit

    01/28/2023, 5:39 PM
    I'm following the documentation and reading the code for the auth helper functions and I don't understand the need for a
    getServerSession()
    when
    getSupabase()
    almost does the same thing but returns the session + the client. In the docs they use
    getServerSession()
    to return the session in the
    +layout.server.ts
    and
    getSupabase()
    in the
    +layout.ts
    ... Can someone help me understand why it doesn't use
    getSupabase()
    in the
    +layout.server.ts
    also ? Thanks
    d
    • 2
    • 1
  • Auths that require manual approval
    e

    egonschiele

    01/28/2023, 6:24 PM
    Is there an option I can turn on so when a user signs up for my app, I need to manually approve their account before they can start using the app?
    g
    • 2
    • 4
  • How to reset IP Block on database
    j

    Jaaneek

    01/28/2023, 7:27 PM
    Basically this, I can;t develop 😭 https://github.com/supabase/supabase/issues/7938
    g
    • 2
    • 1
  • How do you do a successful GET request through Supabase?
    a

    AntDX316

    01/28/2023, 7:54 PM
    How do you do a successful GET request through Supabase? I can't figure it out. Hasura works but I can't figure out how to have it have permissions.
  • How do you setup rate limits?
    a

    AntDX316

    01/28/2023, 8:27 PM
    How do you setup rate limits just incase someone DDOS rate limits the DB to the point where I can't use it.
  • Custom fields on users
    g

    GKL

    01/28/2023, 9:03 PM
    Hey! I'm a bit new to all of this stuff, been a while since ive done some dev work haha. I'm wanting to add more custom fields to my users database, would i be better off keeping the auth users table as it is and make a new users field? or is adding fields on to the auth table alright to do? im not sure what is best practice / best to do.
    g
    • 2
    • 2
  • 401 error while trying to authenticate
    r

    rhythm493

    01/28/2023, 9:46 PM
    I have been trying to login to my react app since 3 hours but it give an error of 401 invalid claim : missing subclaim Haven't changed any auth functions in my app and have already regenerated new tokens for google oauth, email login also dosen't work. I have attached a Screenshot of the error and would be happy to provide more information.
  • If you query the whole table with like 50000 fields, does it cost a lot of read data?
    a

    AntDX316

    01/28/2023, 10:06 PM
    If you query the whole table with like 50000 fields, does it cost a lot of read data? Does it cost More read data than querying 50000 fields individually? Also, is the Query count for that 1 or 50000 or is it per row, etc.? I'm having issues trying to display the data into a table but then I'm thinking it's not even worth doing it especially when it makes it worse.
    g
    • 2
    • 3
  • Does 1 query = 1 field search/update/post/etc? Does creating a row with 20 columns means 21 queries?
    a

    AntDX316

    01/28/2023, 10:36 PM
    Does 1 query = 1 field search/update/post/etc.? Does creating a row with 20 columns mean 21 queries?
  • Add database types to state variable
    a

    AltDan

    01/28/2023, 11:53 PM
    I've used the
    supabase gen types
    command to generate some types based on my database. Id like to add types to the companies state variable, however it seems long winded to import this from the
    lib/database.types.ts
    file. For example:
    Copy code
    import { Database } from './lib/database.types';
    
    const [companies, setCompanies] = useState<Database['public']['Tables']['companies']['Row'][]>([]);
    Is there a neater way to achieve this?
  • Supabase C#
    u

    Unknown Member

    01/29/2023, 1:12 AM
    Hey @acupofjose , can the C# client for Supabase be used with ASP.net core?
    a
    • 2
    • 16
  • Versioning Supabase backend API (v3, v4) for frontend clients
    d

    dogedogego

    01/29/2023, 2:43 AM
    How do you version your API for frontend clients that may not always be the most up to date?
    g
    • 2
    • 3
  • Trying to update views on an ad...
    r

    rchrdnsh

    01/29/2023, 4:33 AM
    Got a supabase function:
    Copy code
    sql
    create function increment (row_id int)
      returns void as
      $$
        update ads
        set views = views + 1
        where id = row_id;
      $$
      language sql volatile
    ;
    ...that is supposed to update one of the row fields... ...in my sveltekit app I do this:
    Copy code
    html
    <script>
      import { supabase } from '$library/supabase/supabaseClient';
      function updateViews() {
        const { data, error } = supabase.rpc("increment", { row_id: 1 });
        console.log(`This function ran! I swear`);
      };
    </script>
    
    <div
      class='ad'
      use:inview
      on:enter={() => {
        updateViews();
        views++;
        console.log(`views: `, views);
        console.log(`entered`);}
      }
    >
    ... the ad and stuff...
    </div>
    ...and all the stuff works when the inview action fires, except I am not seeing the views value increment in the database, so it's not working somehow... ...it seems like everything is working in the sveltkit part, so I figure the sql function is messed up, I just don't know how to fix it...
    g
    • 2
    • 6
  • Support for Cross-Origin-Resource-Policy response headers on Storage CDN
    f

    fabianuribe

    01/29/2023, 5:04 AM
    Hello Supabase! I'm looking for any pointers around adding the response header
    Cross-Origin-Resource-Policy: cross-origin
    on Storage assets in order to support Cross-Origin Embedder Policy (https://web.dev/coop-coep/) It appears that there is currently no support for setting custom headers for Storage in Production (https://github.com/supabase/storage-api/issues/216#issuecomment-1324759684) Is there any way to add this header to the storage response without having to add an intermediary such as a reverse-proxy?
    j
    • 2
    • 6
  • Duplicate key value violates unique constraint error
    s

    stu

    01/29/2023, 6:23 AM
    I'm getting this error on a text column that isn't a primary key. Any ideas how to resolve this issue? The column should allow the same value in multiple rows. The insert that is failing looks like...
    Copy code
    ts
    const { data, error } = (await supabase
      .from("devices")
      .insert({
        name,
        manufacturer,
      })
      .select()) as { data: DeviceRow[]; error: PostgrestError | null };
    And the details for the failed insert look like Key (name)=(Tempest) already exists.
    g
    • 2
    • 4
  • Row Level Security is awesome - but what about fields?
    p

    pmembrey

    01/29/2023, 6:26 AM
    Hi, I'm really liking the integration and power of RLS and how nicely that integrates into APIs and the auth system. One thing I'm not really sure about, and I wasn't able to find anything in the docs (admittedly that could just be me though) about protecting individual fields. For example, in the
    user_profile
    example, there is a field
    username
    . I don't want users to be able to change their usernames, even though I am fine with them changing (for example) the display name. Similarly, if I store a
    customer_id
    for user with Stripe, I don't really want the user to be able to see that, and certainly not be able to edit it. I would expect this is a fairly common scenario for APIs, so I imagine I'm missing something, but I would greatly appreciate being pointed in the right direction 🙂 Thanks!
    y
    g
    • 3
    • 3
  • Uploading base64 images to supabase storage
    a

    Adi

    01/29/2023, 10:15 AM
    I have list of base64 encoded images do I need to first download them and then upload them to supabase? Can I directly put base64 encoded urls to supabase and generate a signed url which I then can store it in database? Note: I am using express server
  • Need advice on how to secure sensitive data
    w

    Wizzel

    01/29/2023, 11:14 AM
    I need to store credentials and sessioncookies of other services for each of my users. What is the best option to handle this data securely? I have read about pgsodium but since I am new to postgres in general, I am a bit confused. I also saw that supabase is about to release the "vault" feature so I am not sure if I should wait for it instead.
    l
    v
    • 3
    • 3
  • top 10 best/ biggest opensource supabase projects in react?
    j

    J0rdan

    01/29/2023, 12:01 PM
    Was just curious about a top 10 bog opensource projects on supabase. For Example how Build air bnb on supabase Real world bog projects Anyone suggestions?🙏
1...112113114...230Latest