https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • GoTrue Kt throws invalid grant exception
    h

    Hieu Vu

    04/20/2023, 3:01 PM
    Hi guys, Currently I'm using GoTrue Kt to build my authentication feature. The sign up works fine but when I use login with email, it throws unreasonable exception. Did I miss any configuration? Here is the log: invalid_grant URL: https://jzdduyzfelmfniuebkre.supabase.co/auth/v1/token?grant_type=password&redirect_to=supabase%3A%2F%2Flogin Headers: [apikey=[eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imp6ZGR1eXpmZWxtZm5pdWVia3JlIiwicm9sZSI6ImFub24iLCJpYXQiOjE2ODA2OTUwODMsImV4cCI6MTk5NjI3MTA4M30.Eo29b7weMkAOucfGa0eRbb7fZR7Cpw1_Ifde_FV3zGc], Accept=[application/json], Accept-Charset=[UTF-8]] Http Method: POST My code to sign in: (authService is instance of GoTrue)
    Copy code
    authService.loginWith(Email) {
                this.email = email
                this.password = password
            }
    How I provide GoTrue:
    Copy code
    createSupabaseClient(
                supabaseUrl = BuildConfig.SUPABASE_URL,
                supabaseKey = BuildConfig.API_KEY
            ) {
                install(Postgrest)
                install(GoTrue)
            }
  • Sveltekit app auth state not refreshed after user redirected from magic link
    c

    catico

    04/20/2023, 3:35 PM
    I've followed to the the T the tutorial https://supabase.com/docs/guides/getting-started/tutorials/with-sveltekit, but the session is not being set after user comes from magic link redirect. The session in
    hooks.server.ts
    is null.
    s
    • 2
    • 34
  • Active connections
    v

    Vadorequest

    04/20/2023, 3:48 PM
    I noticed I had almost 50% of active connection being taken, I have created the DB yesterday and I've only linked WeWeb to it, and there are no users. I guess WeWeb take some connections, but is that normal to have so many being used by default?

    https://cdn.discordapp.com/attachments/1098636215122673754/1098636215357546536/image.png▾

    g
    • 2
    • 2
  • [SOLVED] Multipul .eq()'s
    d

    DignifiedSwine

    04/20/2023, 4:18 PM
    I am trying to use multiple .eq()'s to filter what gets updated. What I have so far is: function saveExamScores(exams, results) { var sid = document.getElementById("players").querySelector('#profile').querySelector('#pid').value; for (var x = 0; x < exams.length; x++) { _supabase.from('exam<>student').update('score', results[x]).eq('exam', exams[x]).eq('student', sid).then(response => { }) } } Am I doing something wrong? The 'score' field is not getting updated.
    g
    • 2
    • 3
  • I see a lot of errors in supabase studio when trying to fetch data from /api/rest
    d

    daniromo

    04/20/2023, 4:28 PM
    Are there any plans to update the studio docker image any time soon? I'm not sure why this is happening, storage also has errors, I've been trying really hard to get this to run for the past two weeks

    https://cdn.discordapp.com/attachments/1098646500499787908/1098646500818567258/image.png▾

  • Frustrated with Postgres Functions and Triggers
    k

    kpradel

    04/20/2023, 4:58 PM
    I've been banging my head against the wall on what should be a fairly simple ask: When a new user is created, I want to populate a userprofile table with the new id and email, an accounts table with the new user id, and a accounts_users table that has the account id and as well as the user id. I am running Supabase locally for development so I have zero visibility into any errors that are happening (even looking at the logs I get nothing indicating why the query is failing). My trigger is set up correctly and I have verified that I can perform the first piece of the query by itself.
    Copy code
    create or replace function hello_world()
    returns trigger
    language plpgsql
    as $$
    begin
     WITH userprofile AS (
      insert into public.userprofile (userid, email)
      values (new.id, new.email)
      returning userid
    ),
    accounts AS (
      insert into public.accounts (ownerid)
      select userprofile.userid from userprofile
      returning id  
    ) 
    insert into public.accounts_users (userid, accountid) 
      select userprofile.userid, accounts.id from userprofile, accounts;
      return new;
    end;
    $$;
    In the SQL editor I get confirmation that the function ran successfully. But when I sign up as a new user, I get Database error saving new user". Please help. This is beyond frustrating...
    s
    b
    g
    • 4
    • 56
  • Deploy edge function fails
    b

    bombillazo

    04/20/2023, 5:36 PM
    Hello. Locally, I am able to run Deno commands to compile, bundle and run functions without a problem. However, when I run the Supabase CLI command
    deploy
    , I get errors. I am on the latest version of the CLI. If I run
    supabase functions deploy test
    I get the folowing error:
    Copy code
    sh
    Deploying supabase function: test
    Version 1.30.3 is already installed
    Bundling test
    Error: Error bundling function: exit status 1
    file:///src/import_map.json
    file:///src/index.ts
    file:///_shared/supabase.client.ts
    file:///services/users/user.service.ts
    file:///util/format.types.ts
    error: Uncaught (in promise) Error: NotFound: No such file or directory (os error 2)
          const ret = new Error(getStringFromWasm0(arg0, arg1));
                      ^
        at __wbg_new_8d2af00bc1e329ee (https://deno.land/x/eszip@v0.35.0/eszip_wasm.generated.js:513:19)
        at <anonymous> (https://deno.land/x/eszip@v0.35.0/eszip_wasm_bg.wasm:1:1559899)
        at <anonymous> (https://deno.land/x/eszip@v0.35.0/eszip_wasm_bg.wasm:1:1398157)
        at <anonymous> (https://deno.land/x/eszip@v0.35.0/eszip_wasm_bg.wasm:1:1895031)
        at __wbg_adapter_40 (https://deno.land/x/eszip@v0.35.0/eszip_wasm.generated.js:229:6)
        at real (https://deno.land/x/eszip@v0.35.0/eszip_wasm.generated.js:213:14)
    If I use the
    --legacy-bundle
    flag though, I get a different error:
    Copy code
    sh
    Deploying supabase function: test
    Version 1.30.3 is already installed
    Bundling test
    Error: Error bundling function: exit status 1
    error: Module not found "file:///services/users/user.service.ts".
        at file:///Users/code/supabase/functions/my_function/index.ts:4:28
    services
    is a directory directly besides the
    functions
    folder inside the
    Supabase
    directory. My import_map.json file includes a path to the file.
    utils
    is a directory outside the supabase folder. Here is my import_map.json, which is inside the
    functions
    dir:
    Copy code
    json
    {
      "imports": {
        ...
        "/services/": "../services/",
        "/utils/": "../../src/utils/",
      }
    }
    Thanks!
    s
    • 2
    • 6
  • Connection limit reached
    j

    Jannik Wempe

    04/20/2023, 6:29 PM
    A friend of mine just went life with a product and is running out of connections. Can additional connections be bought (for $10 as per pricing page)? How?
  • Supabase Client in edge functions
    r

    Rosibert

    04/20/2023, 6:57 PM
    Hi, I want to insert data to my supabase db via supabaseClient inside of an edge function. Therefore i wrote following code:
    Copy code
    js
    import { createClient } from "@supabase/supabase-js"
    import { serve } from "https://deno.land/std@0.168.0/http/server.ts"
    
    const supabaseClient = createClient(
      // Supabase API URL - env var exported by default.
      Deno.env.get('SUPABASE_URL') ?? '',
      // Supabase API ANON KEY - env var exported by default.
      Deno.env.get('SUPABASE_ANON_KEY') ?? '',
    )
    
    serve(async (req) => {
      const { userId } = await req.json()
      supabaseClient.from('user_roles').insert({user: userId, role: 'customer'})
    
      return new Response(
        JSON.stringify(data),
        { headers: { "Content-Type": "application/json" } },
      )
    })
    Now the deployment does not work because of the relative import in line 1. Can I import the supabase client via an absolute path anyhow? If so: where can I read up on this?
    j
    • 2
    • 3
  • 406 Not Acceptable after enabling RLS
    p

    pippin_mole

    04/20/2023, 7:40 PM
    I removed the RLS policies and it's still causing the error, even though it worked before turning them on
    s
    • 2
    • 20
  • 401 Error when calling edge function via webhook
    q

    quintin

    04/20/2023, 7:59 PM
    Hello, I have set up a webhook that calls one of my deployed subabase edge functions. But a 401 error ("lacks valid authentication credentials") occurs. Is there a way we can have supabase automatically set a JWT token when calling a subabase edge function?
    s
    • 2
    • 2
  • Is the _shared (or other _ dirs) in ./supabase/functions the only way to import local code in funcs?
    p

    pid1

    04/20/2023, 8:24 PM
    I'm trying to setup a monorepo with packages (types, etc) shared across all our apps and functions. I'm running into issues trying to import paths outside of ./supabase/functions/_shared. Is it possible?
    • 1
    • 1
  • Select with RLS for authenticated users returns status 200 with an empty array - expecting 401 error
    t

    TotallyNervous

    04/20/2023, 9:43 PM
    When running a basic select query on a table with RLS enabled, using target roles of authenticated and a using expression of:
    auth.uid() IS NOT NULL
    I was expecting to receive a 401 unauthorized error but it returns 200 with an empty array, is this normal behaviour? Any help is appreciated!
    g
    • 2
    • 3
  • How to get all profiles of friends of a user?
    d

    DwarfNinja

    04/20/2023, 10:29 PM
    Hey I was wondering how I can get all the profiles of the friends of a user. My current implementation requires two queries, one to get the friends ids and the second to get the friends profiles. But I assume it should be possible to do this using a single query with eg.
    !inner
    but I have not yet been able to figure it out: The tables:
    Copy code
    profiles {
    id PK
    name
    username
    }
    
    friends {
    id PK
    user FK profiles.id
    friend FK profiles.id
    }
    The current implementation:
    Copy code
    dart
      getAllIdsOfFriends() async {
        var friendIds = await supabase
            .from('friends')
            .select('friend')
            .eq('user', supabase.auth.currentUser!.id);
    
        final List<String> friendIdsList = friendIds.map<String>((obj) => obj['friend'] as String).toList();
        return friendIdsList;
      }
     
      getAllFriends() async {
        List<String> friendIdsList = await getAllIdsOfFriends();
    
        var data = await supabase
            .from('profiles')
            .select('*')
            .in_('user', friendIdsList);
        return data;
      }
    g
    • 2
    • 5
  • Managing auth emails?
    b

    brassotron

    04/20/2023, 11:10 PM
    Hello, Is it possible to completely offload handling of auth emails? I'm trying to manage all transactional mail via Mailersend and I'd like to add the auth emails as Mailersend templates and trigger them inline with auth events. Can anybody point me in the direction of documentation on how to do this. I understand I can configure the SMTP credentials to use Mailersend's SMTP servers, but I believe that would still require me to set the templates in Supabase, not Mailersend for auth emails? Thanks for any recommendations
    g
    • 2
    • 10
  • egress exceed limit - what happens next?
    s

    sophianana

    04/20/2023, 11:33 PM
    It says that my egress storage limit is exceeded, but the whole system is still working fine. Can I just leave it without upgrading it? When does the system stop if I do not upgrade it?
    g
    • 2
    • 1
  • Making auto-generated (particularly Geaphql) API’s private
    d

    drewbie

    04/20/2023, 11:40 PM
    Is it possible to make the API endpoints private and only accessible from certain hosts? Since the endpoints serve an awesome out of the box api for REST and Graphql, I’m wondering if it’s possible to hide them behind certain credentials so that the database schema isn’t so obvious to the public? Beyond RLS policies on the tables themself, I’m more so wondering about hiding the schema from the Graphql endpoint in case it’s looked at via introspection.
  • Structuring PgVector PostgreSQL DB
    s

    Saylessss

    04/21/2023, 12:33 AM
    I am a DB noob. I am planning on storing thousands of embeddings for each user and I am not sure how to structure my tables. I initially thought I could make a table for each user to be more organized, but I learned this what not the best practice. What can I do to keep my DB organized? Imagining a single table that stores hundreds of thousands of entries seems inefficient when searching, as I only care about the entries that belong to a specific user. Thanks
    n
    • 2
    • 4
  • How to query many inner joins in supabase_flutter
    s

    saule

    04/21/2023, 1:39 AM
    Is there a way to do many inner queries in a select? Something like this raw sql query: SELECT patients.*, array_agg(spaces.name) AS spaces_assigned FROM patients INNER JOIN patient_spaces ON patients.id = patient_spaces.patient INNER JOIN spaces_members ON patient_spaces.space = spaces_members.spaces INNER JOIN spaces ON spaces_members.spaces = spaces.id WHERE spaces_members.doctors = 1 GROUP BY patients.id;
    g
    • 2
    • 4
  • Problem with supabase storage self hosted when copy to new computer.
    p

    pckimlong

    04/21/2023, 2:51 AM
    I have a linux server host supabase instance and I've copied that to my other computer by copied the entire supabase included docker and volume. I successfully run the database and all data persisted except storage. Open in supabase studio I can see the storage objects listing. But I cannot preview it when I download it. There an error with status code 500 and message "Internal Server Error". I don't know why I've been trying to fix this for week now. I've check the volume that mounted to supabases-storage. The file still there. Like I said, I've copied the entire supabase project include docker so the volume of storage will be copied as well. Please help me
    g
    • 2
    • 5
  • When I update my avatar, I received this alert: `Could not resolve host: <YOURPROJECTURL>`.
    v

    vinciarts

    04/21/2023, 5:21 AM
    Hi, it still works days ago. idk how to fix this. I did not change any code these days (I guess?) 🥲
    s
    g
    • 3
    • 8
  • Is custom authentication possible through native API? (using internal PIN code)
    v

    Vadorequest

    04/21/2023, 7:16 AM
    Our company assigns a 8-digits PIN code to each employee, and they can use it to authenticate. It's an easier mean of authentication, most suited for phones/tablets devices. I wonder if it's possible to build a custom authentication for this, without using code. (using any Supabase API directly) I believe I could build this using Next.js (for instance) and a custom endpoint, but I'm trying to avoid that, if possible. P.S: Using Xano, I was able to build something like this fairly easily, as it allows creating custom API endpoints, but it's a very different tool, and I'd perfectly understand if it's not natively possible with Supabase.
    g
    • 2
    • 6
  • Open role at Supabase
    a

    Ashwin

    04/21/2023, 8:03 AM
    Hi there, I recently saw Supabase was looking for a DevRel, before I could apply the posting was no longer available, is there an email where I can send my proposal?
    g
    • 2
    • 2
  • ERROR: /usr/local/share/lua/5.1/kong/tools/dns.lua:39: /etc/hosts: Permission denied
    b

    BMaD_Chillyo | ARTSY | Polygoonz

    04/21/2023, 9:51 AM
    For the life of me I cannot figure out what the issue is. I've never had this issue on any other box but this new one. FWIW, it works if I disable ufw. Any ideas?
    s
    • 2
    • 1
  • multiple filter options in realtime subscription
    m

    Mirik

    04/21/2023, 9:54 AM
    Hi, at the moment i am doing a few filters in callback fn, around the payload (.client side ). Is it possible to do this filters on database side? I couldn't find any solution for this.
    Copy code
    .on(
     "postgres_changes",
     {
       event: "*",
       schema: "public",
       table: "users",
       // i need something like this
       filter:
    `lat.gte=${minLat},lng.lte=${minLng},...`
      },
      (payload) => {
        // but for now my filters are here...
       }
    )
    g
    • 2
    • 1
  • Insert multipul rows into database
    d

    DignifiedSwine

    04/21/2023, 10:17 AM
    I am trying to insert multiple IDs into diffrent rows but my issue is that the loop seems to only insert on the last instance. The code I have is: function createAllRelationships() { var sid = document.getElementById("profile").querySelector('#pid').value; for (var y = 0; y < PPCid.length; y++) { var sid = PPCid[y]; for (var x = 0; x < NPCid.length; x++) { var nid = NPCid[x]; _supabase.from('npc<>student').select('*').eq('npc', nid).eq('student', sid).then(response => { if (response.data.length == 0) { _supabase.from('npc<>student').insert({ 'npc': nid, 'student': sid, 'relationship': 0 }).then(response => { }); } }); } } } is there something I have to do to slow down the loop to allow each instance to trigger??
    v
    • 2
    • 7
  • does auth-ui support mfa?
    m

    magenta

    04/21/2023, 10:19 AM
    There isn't any info about this
    s
    • 2
    • 1
  • Can I alter my Employee table so that "id" references auth.users?
    v

    Vadorequest

    04/21/2023, 10:27 AM
    I understood a bit late that I needed to reference the auth.users table in the Employee.id column. https://supabase.com/docs/guides/auth/managing-user-data#creating-user-tables Can I do it afterwards? Or must I recreate the whole table?
    n
    g
    • 3
    • 4
  • q: built a discord chat bot that helps answer questions about Supabase - can I enable?
    a

    abhi99

    04/21/2023, 11:33 AM
    Hi, big fan of supabase but at times has been frustrating finding the right answer to my questions. As a fun side project I've built a bot that's ingested+embedded the supabase docs and can also ingest/embed message history from a channel. You can then query the bot (uses gpt3-turbo) in the channel instead of searching faqs / asking a q that's been answered before Would love to try this out in this community - can an admin DM me to help enable it?
  • Session init after verifyOtp() [nextjs13/app-dir]
    m

    metafoo

    04/21/2023, 12:21 PM
    Maybe I missed something. Are there any mechanisms to init a session after calling verifyOtp()? Or do I have to do this manually (by setting a cookie)?
    n
    s
    • 3
    • 5
1...187188189...230Latest