https://supabase.com/ logo
Join DiscordCommunities
Powered by
# help-and-questions
  • Seeding users in Flutter (supabase_flutter 1.0.1)
    a

    avalanche

    10/21/2022, 10:38 AM
    I'd like to create a dart program which will seed my database with dynamic values. For that I have to insert multiple users without logging in. Is there any way to do this? I see JS api has function createUser() https://supabase.com/docs/reference/javascript/v1/auth-api-createuser. What is the equivalent of that in supabase_flutter? btw. I'm using supabase_flutter v1.0.1
  • Hello, i try get signIn with google provider in react-native, but never work, can you help me?
    m

    matteo

    10/21/2022, 1:44 PM
    hello, i try get auth with google with supabase client in expo react-natvie project, in first time i have worning relative window.location.href in GoTrueClient.js, row 724 but i fix it for the moment. the problem is abount onAuthStateChange, never work, and i not have the user logged after i return from web google sign in page please can tou help me?
  • Custom JWT Secret (from Firebase)
    r

    Red Baron

    10/21/2022, 2:23 PM
    I'm having trouble setting custom JWT Secret from Firebase so I can authenticate to the Supabase and later use that token to access Firebase. I generated a new private key from Firebase Service Account, opened JSON, got Private Key, copied it to Supabase Custom JWT secret, and got an error from Supabase. Any idea what to try? Thanks
  • I want to fetch profile data upon user login. how do i do that?
    t

    Thoth Trismegistus

    10/21/2022, 2:53 PM
    I am using google oauth. I can login successfully but i want to fetch profile data from
    profiles
    table upon user login. Is there a callback function which is called upon user login?
    g
    • 2
    • 1
  • SupabaseAuthState in Flutter
    t

    thomas_mol

    10/21/2022, 3:09 PM
    Hi, I just upgraded to the latest version (1.0.1) of supabase-dart to use in my flutter project, great milestone! However, the SupabaseAuthState class seems to be gone and I cannot find any documentation or migration changes. Any help how to solve this? Does it have a new name?
    v
    l
    • 3
    • 10
  • verifyOtp
    i

    inaxium

    10/21/2022, 4:27 PM
    Is there anyone with whom verifyOtp works. I have it with the {{.token}} 6 number and the (URL) &token= 56 characters but only ever get one has expired or is invalid. Actually I work with Flutter, but since I also have problems there, I validated it again in ES. const {data, error} = await supabase.auth.verifyOtp({ email: email, token:token, type:"signup" });
    g
    • 2
    • 14
  • RLS auth each user
    k

    komagata

    10/21/2022, 5:26 PM
    Is it possible for RLS to restrict each user to see only the data heshe has posted?
    j
    • 2
    • 2
  • docs for the REST API
    r

    Rawa

    10/21/2022, 6:41 PM
    I may have not looked enough, but I couldn't find docs for the REST API, Specifically docs on interacting with database, functions, storage
    • 1
    • 1
  • Errors restoring postgres db
    r

    rgfx

    10/21/2022, 6:46 PM
    Trying to restore my postgres db to posgres server using self hosting, I getting these issue. Anyone know what doing wrong?
  • Sync data to Elasticsearch?
    d

    drgonxoo

    10/21/2022, 7:22 PM
    Does anyone know of a good way to ingest data from Supabase tables to Elasticsearch as it is inserted and updated?
    u
    • 2
    • 1
  • How do I use Access Tokens generated on the supabase admin?
    g

    guifromrio

    10/21/2022, 7:50 PM
    I want to authenticate an API so that I don't have to use the user's credential, but a first-class API credential to talk to supabase. The only "token generation" I could find in the admin is in https://app.supabase.com/account/tokens. Now that I have generated a token, however, I have no ideia how to actually use this, and can't seem to find any mention of it in docs. Even my google-fu has failed me. What am I missing? How do I create a supabase client that uses this token to communicate? Or create a JWT from this token?
    • 1
    • 2
  • Forcing JWT refresh after setting custom claims
    l

    lawnday

    10/21/2022, 10:05 PM
    Hey folks! I'm using https://github.com/supabase-community/supabase-custom-claims to set custom claims in my JWT for integration with another service (Hasura). I have a database trigger that sets the claim whenever a new user is inserted. This works fine, but when creating an account using
    supabase.auth.signUp
    , I get the session data with an initial JWT back immediately, before the trigger runs. Is there any way to force a refresh of the JWT so that I get a version with the new claim in it? Right now, I'm only able to get it working by logging out and logging back in again. I've tried a few combinations of
    setSession
    ,
    updateUser
    , etc, but I only ever get the initial JWT back.
    j
    • 2
    • 8
  • How to know if can update row in frontend from RLS ?
    c

    CerfDareDevil

    10/21/2022, 10:12 PM
    Hi all ! I’ m new with Supabase and RLS. is there a way for the frontend to know if a user has the right to see but not modify a line to hide an option for example directly via the RLS. Sort of like permissions. Thx in advance !
    t
    g
    c
    • 4
    • 7
  • Reset local Supabase instance?
    b

    beeman

    10/21/2022, 11:18 PM
    I'm playing around with a local supabase instance but it looks like I messed something up, I can no longer update things in using the Studio as seen in the screenshot. I tried restarting, removing the containers, initializing a new project, but it seems to be failing. Any ideas on how I can start with a clean slate?
    n
    • 2
    • 6
  • filters not resetting between requests
    k

    KTibow

    10/22/2022, 12:51 AM
    i've been having some random problems where my project sometimes just intermittently fails to use supabase i looked into it and it looks like the
    .eq
    filters are stacking between requests, which means the request is asking for a row with an id that is 2 things at once how do i fix this?
    g
    • 2
    • 8
  • Purpose of SQL Loop Functions
    j

    jon.m

    10/22/2022, 3:59 AM
    Aside from generating random data, I'm struggling to understand a use case for a SQL loop. Where do these control structures come in handy? As an example, you can use a loop to insert data into a table from another table, or you can just insert the result set of a query into a table. So the loop is not needed.
    o
    • 2
    • 1
  • RLS for a transaction based following system with counters
    v

    VWL Tobias Hassebrock

    10/22/2022, 9:32 AM
    I would like to implement this architecture (I do not want to count it after every select):
    Copy code
    relationship_of_following (
    Relationship_id uuid,
    Follower uuid,
    Follows uuid
    )
    
    usersFollowingCounter(
    User_id uuid,
    following_counter number
    )
    
     userFollowsCounter(
    User_id uuid,
    follows_counter number
    )
    Then I have 3 functions: 1. Function Insert insertFollowingFollowerRelationship() 2. Function increment_follower_counter() 3. Function increment_following_counter()
    Copy code
    insertFollowingFollowerRelationship(follower uuid, following uuid)
    BEGIN
      INSERT INTO "following_profile_system"
      VALUES (follower, following);
    END;
    
    function increment_tfollower_counter(userId uuid)
    BEGIN
      update userFollowsCounter
      set " follows_counter " = " follows_counter" + 1
      where id = userId;
    END;
    
    function increment_following_counter(userId uuid)
    BEGIN
      update usersFollowingCounter
      set " following_counter " = following_counter + 1
      where id = userId;
    END;
    $$;
    And a transaction:
    Copy code
    function followTransaction(followerId uuid,  followingId uuid)
    BEGIN
      PERFORM insertFollowingFollowerRelationship(followerId, followingId);
      PERFORM increment_follower_counter(followingId);
      PERFORM increment_following_counter(followerId);
    END;
    The client only calls the FollowerTransaction() with .rpc() How would I design security rules for this architecture with the following requirements? 1. Users should only be able to insert a unique combination in the “relationship_of_following” table 2. Users should only be able to increase follower and following counter once (if relationship did not exist before) 1. Can I ensure that the counters are only incremented if the .rpc FollowerTransaction() was called or that the increase counter is only called once after insertFollowingFollowerRelationship()? Should I use a triggers? 3. Did I understand it correctly that if one of PERFORM calls from the transaction fails, all changes are not committed? Any best practice recommendations?
    • 1
    • 1
  • hoist project to pro
    c

    Captain

    10/22/2022, 10:30 AM
    i have a supabase pro account. i had a project which i deleted. i created a new project. turns out if want to upgrade the new project to pro, i need to pay for it. i dont understand. i got pro today. just a few minutes a go. so now i need to pay another 25 dollar if i delete an old project and add new one? anyone have an idea how to solve this?
    r
    • 2
    • 1
  • AuthApiError
    m

    mattposgate

    10/22/2022, 11:11 AM
    I'm struggling with verifyOtp with captchas. The captchas are working for signin and the verifyOtp works when captchas are disabled. Here's the line of code: const authResponse = await supabaseClient.auth.verifyOtp({ email, token: otp, type: "recovery", options: { captchaToken, }, }); using @supabase/supabase-js": "^2.0.4" in a 'static' nextjs app The error returned is as follows: Failed to load resource: the server responded with a status of 400 () The authResponse looks like this: { data: {user:null, session:null}, error: { name: "AuthApiError", status: 400, message: "request disallowed", stack: "AuthApiError: request disallowed at eval (webpack-internal:///../../node_modules/@supabase/gotrue-js/dist/module/lib/fetch.js:47:20)" } }
  • Database error finding user
    a

    avalanche

    10/22/2022, 11:58 AM
    I have upgraded supabase_flutter to 1.0.1 and I'm suddenly getting 'Database error finding user' when trying to signUp a user. Database is emtpy. Error happens only when calling signUp for the first time, each consequent call will succeed until I get another error 'Access token refresh retry limit exceded'
    Copy code
    dart
     for (final testUser in testUsers) {
        final res = await Supabase.instance.client.auth.signUp(
          email: testUser.email,
          password: testUser.password,
        );
      }
    This code was working with previous version of supabase_flutter 0.3.3. Any ideas?
  • Flutter - upload file to storage - StorageError (new row violates row-level security policy...)
    b

    boeledi

    10/22/2022, 12:05 PM
    Hello, I have created a bucket, called "avatars" and made it "public". I am trying to upload a picture into that bucket, in Flutter. The answer is the following
    Copy code
    StorageError(message: new row violates row-level security policy for table "objects", statusCode: 42501, error: )
    -- The code to upload is the following:
    Copy code
    await Supabase.initialize(
          url: "https://${Environment.supabaseUrl}.supabase.co",
          anonKey: Environment.supabaseAnon,
          debug: !kReleaseMode,
        );    
    ...
        File? fileToUpload;
    
        try {
          ///
          /// We first need to transfer the base64 content to a real file
          ///
          fileToUpload = await FileHelper().writeStringToFile('temp', 'profile_picture.png', base64Content.replaceAll('base64:', ''));
    
          ///
          /// Now, we need to upload the file onto the Storage bucket
          ///
          final StorageResponse<String> storageResponse = await Supabase.instance.client.storage.from('avatars').upload(
                'avatar1.jpg',
                fileToUpload,
                fileOptions: const FileOptions(cacheControl: '3600', upsert: true),
              );
    
          if (storageResponse.hasError) {
            log('STORAGE ERROR => ${storageResponse.error}');
          } else {
            log('STORAGE SUCCESS => ${storageResponse.data}');
          }
        } catch (e) {
          // Nothing
          log('STORAGE ERROR (Exception)=> $e');
        } finally {
          if (fileToUpload != null) {
            fileToUpload.delete();
          }
        }
    I also tried to set the default "Policies" (Allow access to JPG images..) but still the same error. Could anyone please help me? Many thanks
  • Supabase Twilio Error
    t

    teiki

    10/22/2022, 1:19 PM
    POST localhost/v1/verify 401 AuthApiError: Token has expired or is invalid at fetch.ts:41:16 I can recieve the message tho cannot verify it, I always get this back
  • 201 Returning No Data, Response
    u

    𝖘𝖚𝖗𝖌𝖎𝖊𝖇𝖔𝖎 | Drooler

    10/22/2022, 2:38 PM
    I do not have RLS enabled on the table I'm inserting into; moreover, when posting I receive a 201, but I'm not getting any response data returned from Supabase. Additionally, in my Network tab, in Response for the successfully posted request, it reads, "This request has no response data available." Snippet below: const { data, error } = await supabase .from("listings") .insert( { seller: wallet, image: values.file.name, title: values.title, price: values.price, status: 1, featured: 0 }) Moreover, when testing "data" I also tried to use: - console.log(data) - setState(data) - both return "null" Notes: 1. I am also using Formik and posting the updated form values. 2. Supabase returns 201 3. The row is successfully created in Supabase 4. No RLS is enabled Am I missing something? 🤯
    g
    • 2
    • 2
  • type error when using definition from openapi
    c

    Captain

    10/22/2022, 3:31 PM
    I am using the openapi lib to generate the types for the db. when i want to select from specific table, i provide the generic in the FROM function. but that is apparently incorrect. i followed this example. https://supabase.com/docs/guides/api/generating-types but when i pass the generic in the same way as the example, i get the following error: No overload expects 1 type arguments, but overloads do exist that expect either 0 or 2 type arguments. my code: const data = supabaseAdmin.from('account').select('*') example: const allOnlineUsers = await supabase.from('users') .select('*').eq('status', 'ONLINE')
  • Using SWR to fetch comments from database
    k

    kvnfo

    10/22/2022, 3:47 PM
    Looking for some help, so I'm using SWR to fetch comments for a single post but it's returning all comments. How can I specify to only pull items from post.id? in [slug].js
    Copy code
    const { data: commentList, error } = useSWR(`/api/comments/`,  fetcher);
    And then in my comments.js (api)
    Copy code
    case "GET":
            const { data, error } = await supabase
                .from("comments")
                .select("*, user_id (username, avatar_url)")
                .order("created_at", { ascending: false })      
            if (error) {
                res.status(500).json({ error: error.message });
            } else {
                res.status(200).json(data);
            }
            break;
    Any help or advice would be appreciated
    g
    • 2
    • 2
  • Free Tier Bandwidth
    t

    tpz

    10/22/2022, 4:33 PM
    Hello! I'm new to supabase and I'm starting to love it. I just wanna ask if the 2gb database egress limit resets every month? Or it's the overall bandwidth for free tiers? Thank you!
    o
    • 2
    • 3
  • Permission based withPageAuth
    b

    B3n

    10/22/2022, 5:14 PM
    Hi, I'm trying to restrict certain pages to users meeting a certain criteria. I've got 'withPageAuth' working for logged in users and I've read that if you use middleware you can check the user's email if it ends in a certain domain. I can't get this to work as it allows all logged in users and it not restricting. I'm not using typescript so is that the issue? I'm not getting any errors so any help would be much appreciated. Thanks in advance.
    m
    n
    • 3
    • 24
  • RLS based on custom jwt
    f

    flapili (FR, bad EN)

    10/22/2022, 5:20 PM
    Hi, I would like to know if it would be possible to have RLS based on custom jwt ?
    g
    • 2
    • 34
  • Import data via 'Paste text' with a new table doesn't work
    s

    Spoonz

    10/22/2022, 5:44 PM
    I'm trying to import a with a column that contains large sections of rich text along with newline tags, which is preventing me from uploading a CSV to import data. Instead, I've tried simply pasting the tab le from Excel into the "Paste text" section. Doing this shows a preview of the table as expected, but when I save the table, it creates the table with the correct headings but does not add any rows to the database. I have also tried this with a simple import to make sure it wasn't a problem with the data being imported and it also does not work.
    j
    • 2
    • 2
  • Developing a project for a client
    o

    omar

    10/22/2022, 6:03 PM
    Hey all, I am working with a client helping them with their web app and want to use supabase as their backend. What is the best way to do that as they are not very technical? Have them sign up t supabase and share credentials or can they add me as a developer? I can’t seem to sign in with a different username as supabase is tied to my GitHub. Can we sign in using another auth service or maybe username and password?
    r
    • 2
    • 1
1...505152...230Latest