https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How to debug auth requests?
    m

    Miguel Espinoza

    09/13/2022, 7:28 PM
    I'm having an issue where /auth/v1/token suddenly returns 400. I've set an expiration window of 20 seconds. This originated after finding out that the supabase token disappears from localStorage. It's not clear why I received a 400 for this refreshToken, the path to this should indicate a successful request. Here's a video walking through the situation: https://share.cleanshot.com/mc6hDzOEoD7lzwk4ZSrk
    g
    p
    • 3
    • 155
  • Error using Twitter Auth - Closed.
    e

    Ethanxyz

    09/13/2022, 9:10 PM
    I am currently trying to use twitter to login. Whenever I login, I get redirected to my app and notice the login state has not changed. The login page ( localhost:3000/ ) URL after redirect is >
    http://localhost:3000/?error=server_error&error_description=Error+getting+user+email+from+external+provider
    I assume this is because in my Twitter API Settings I left
    get email from user
    off. I do not want or need a user's email, but maybe I need one ? I want to allow the user to sign in, and then save that user in my database using their user_id ( twitter user id ) as the unique ID. Any ideas on how I can do this ?
    g
    • 2
    • 9
  • Presence connection limits?
    j

    johnrees

    09/13/2022, 9:14 PM
    Are there any hard limits on the number of users that can be simultaneously connected to a presence channel? If so, would it be based on the
    Connections: Pooler
    column on the pricing page? I'm guessing not because presence doesn't touch the DB? Thanks
  • Enabling email signups on dockerised instance after init
    d

    doot0

    09/13/2022, 9:35 PM
    Is it possible to retroactively enable email signups for a dockerised supabase project if the instance was initialized with
    enable_signup
    set to false in
    supabase/config.toml
    ?
    s
    • 2
    • 6
  • Twitter Auth - Error getting email, but account has email.
    e

    Ethanxyz

    09/13/2022, 10:20 PM
    Update: Seems like @mansueli said...
    Copy code
    Two notes about Twitter auth: 
    You need to use Twitter v1 and request for elevated access.
    I applied for access and will update this thread
  • Snippets
    o

    ojg15

    09/13/2022, 10:21 PM
    Any way to save snippets for the whole organisation? I wanted to write some useful ones for my team to look at / adjust but now I realise they're only on my account..
  • operator does not exist jsonb ? uuid
    b

    bhaskar

    09/13/2022, 10:45 PM
    I am getting this exception when trying to add a policy that checks if participants are part of transaction. participant is a jsonb array string. it works if i hardcode auth.uid() though.
    Copy code
    create or replace function public.get_transactions_for_authenticated_user( user_id uuid)
    returns setof bigint
    language sql
    security definer
    set search_path = public
    stable
    as $$
        select id from transactions where participants::jsonb  ? auth.uid()
    $$;
    any pointers?
    g
    • 2
    • 3
  • update tables from backend.
    b

    bhaskar

    09/13/2022, 11:36 PM
    I have a backend service that can update the tables. it is connected to supabase client using the anon key. i don't want to check
    Copy code
    auth.role() = 'anon'
    but would want to have a role or id check. should i auth signin using id? or is there a serviceid that could be assigned a role?
    g
    • 2
    • 3
  • How do I authenticate a user request from my own backend?
    k

    konga

    09/13/2022, 11:53 PM
    To provide some context, I have a Next.js frontend, Rust backend, and a Supabase database. I want to authenticate the user for a specific endpoint in my Rust API. I send the JWT from the frontend to the rust backend but I don't know how to make sure it's legit. Is there a GoTrue endpoint that I could pass the user JWT to and it sends back if it's legit or not? I could also use the JWT secret but I don't know how to obtain the JWT secret when testing locally. Any thoughts?
    • 1
    • 1
  • Postgres resource upgrade
    a

    anthony

    09/14/2022, 1:03 AM
    Hi, 1. I want to know whether adding more compute/ram to the Postgres DB would cause any downtime 2. Is the disk space upgrade automatic? 3. Are there any plans to have automatic migration/update to newer versions of Postgres in the future (v15)
    • 1
    • 1
  • Aroga Access Token Options for Deno
    r

    rlee128

    09/14/2022, 1:52 AM
    Does anyone know if there is an option for using Aroga's access token package to create auth tokens? I don't seem to see any option for using this with Deno.
  • How could I select recent timestamps in JS?
    k

    KTibow

    09/14/2022, 1:55 AM
    I have a chat table, with a column for what group each message was sent in and a column for when it was sent. What syntax would I use to find rows with a timestamp in the last 24 hours?
    g
    • 2
    • 5
  • getPublicUrl subfolder
    t

    tonyhart

    09/14/2022, 3:50 AM
    so I uploaded product and get public url in bucket named product-images but got double 'produt-images' in url
    g
    • 2
    • 7
  • Connect separate projects with dblink
    p

    Prismism

    09/14/2022, 4:47 AM
    Hi, I am trying to use the
    dblink
    extension to open a persistent connection between two of my projects. Here are the two references I have used so far: https://www.postgresql.org/docs/current/contrib-dblink-connect.html https://medium.com/@joelmalone/remote-database-queries-in-postgres-2ec2addda7f6 and based off of those, I here are some things I have tried: -
    SELECT dblink_connect('test_connection', 'hostaddr=db.xxxxxxxxxxxxxxxxxxxx.supabase.co port=5432 dbname=postgres user=postgres password=x')
    -
    SELECT dblink_connect('test_connection', 'host=db.xxxxxxxxxxxxxxxxxxxx.supabase.co port=5432 dbname=postgres user=postgres password=x')
    -
    SELECT dblink_connect('test_connection', 'hostaddr=db.xxxxxxxxxxxxxxxxxxxx.supabase.co port=5432 dbname=postgres')
    -
    SELECT dblink_connect('test_connection', 'host=db.xxxxxxxxxxxxxxxxxxxx.supabase.co port=5432 dbname=postgres')
    In each case, I get
    Failed to run sql query: could not establish connection
    I do get a success result if I do
    SELECT dblink_connect('test_connection', 'dbname=postgres')
    which I presume is just connecting to itself which is obviously not what I want, but figured maybe this helps troubleshoot. I am pulling each of the values in the connection strings from the
    settings/database
    in the other project, and I reset the database password to make sure it matches.
  • Getting an empty json from Supabase API
    r

    R 0 C H E Z

    09/14/2022, 5:13 AM
    I'm using the default API endpoints with apikey from supabase but I get a empty Json
    u
    • 2
    • 1
  • How to create & edit a custom schema in superbase?
    p

    Paul AKA TDI

    09/14/2022, 7:04 AM
    I want this so I can create a data dictionary. Maybe there is better way? I am also open to suggestions.
  • autologin best practice
    p

    pvtctrlalt

    09/14/2022, 8:24 AM
    just looking for some advice, im making a desktop app and when the pc restarts it does not save the last session so the user has to log in again, i want to make it log in automaticly, i have a couple of ideas, the first one was to store the username/password in the os specific keychain/creditional manager then when the program loads it will load those in and log in. the downside to this is obviously there password is then accesible by a bad actor. the other idea i had was to generate an authentication token that is stored when they first register and then use that to validate any server side functions i run i also planned on having this change every time they make a request. is there a better way to do this? or which one would be best practice?
    t
    • 2
    • 4
  • Supabase Infra
    k

    Ktra99

    09/14/2022, 9:38 AM
    Hey, I have been using Supabase for sometime now. I think it's great. I'm currently using Supabase for an application that I'm building. My question is regarding backend infra. I plan on scaling my application at a later stage and would like to know some best practises for doing so with Supabase. Can i simple rely on the supabase infra as is and upgrade storage + db as it grows or how would you guys approach this?
    z
    • 2
    • 1
  • Linking multiple auth providers to a single user
    s

    Spoonz

    09/14/2022, 11:10 AM
    One of my use cases is to allow users to sign in to my app using multiple authentication methods, such as email/password or social auth like gmail. I haven't been able to find much clarity on if this is possible with Supabase Auth, there's a github discussion about it but doesn't provide much further information (https://github.com/supabase/supabase/discussions/5827). Ideally I'd want to create something like Clerk has in this image, where the user can add additional social auth options in their user profile but I'm not sure if Supabase would be able to support this?
    g
    • 2
    • 4
  • reloading the schema cache
    p

    pvtctrlalt

    09/14/2022, 11:54 AM
    trying to call serverside function but getting error
    Copy code
    code: 'PGRST202',
      details: null,
      hint: 'If a new function was created in the database with this name and parameters, try reloading the schema cache.',
      message: 'Could not find the public.public.getauthkey() function or the public.public.getauthkey function with a single unnamed json or jsonb parameter in the schema cache'
    this is my function in app
    Copy code
    export async function GetFirstAuthKey(user:any) {
      const { data, error } = await supabase.rpc('getauthkey', user.id)
      if (error) console.error(error)
      else console.log(data)
      }
    and this was my function on supabase 'create or replace function getauthkey("pid" text) returns text as $$ select authkey from public.userprofile where id::text = pid; $$ language sql;' i added the "" around pid after some googleing but it also did not work before unsure how to solve this one
    g
    • 2
    • 3
  • Getting started with GoTrue on Docker
    r

    Rawr XD

    09/14/2022, 11:58 AM
    I'm looking to self-host GoTrue, but I'm having a little trouble getting started. I can't seem to wrap my head around how to use Docker to self-host, even with the docs. Can anyone offer any help?
  • Unable to connect to Project
    t

    techCS

    09/14/2022, 12:27 PM
    I'm pretty new to SupaBase , I'm under free tier and I'm able to create project and seems like after 30 mins, it only shows
    Connecting to project
    issue, and also I've checked the DB health, it says it has around 99% of Daily Disk IO Budget remaining, but not able to open the project. I've waited for almost 6 to 8 hours and still it behaves similarly. Can anyone help me with this issue 🙂
  • Diff—error creating shadow database
    h

    hko

    09/14/2022, 12:46 PM
    When I try to create a diff, the command fails with
    Error: error creating shadow database
    . I started my local dev by running
    supabase db remote commit
    and then making changes. Running
    supabase db diff services -f services
    results in the error.
    --debug
    does not print additional info. Running
    supabase db diff services -f services --debug --use-migra
    throws the following error:
    ERROR:  relation "pgsodium.key_key_id_seq" does not exist
    and also fails with
    Error: error creating shadow database
    .
  • How to properly add types for nested tables in SvelteKit
    o

    Oskar

    09/14/2022, 2:23 PM
    So based on the example from docs:
    Copy code
    import supabase from '~/lib/supabase'
    import type { Database } from '~/lib/database.types'
    
    async function getMovies() {
      return await supabase.from('movies').select('id, title, actors(*)')
    }
    
    type actors = Database['public']['Tables']['actors']['Row']
    type MoviesResponse = Awaited<ReturnType<typeof getMovies>>
    type MoviesResponseSuccess = MoviesResponse['data'] & {
      actors: actors[]
    }
    type MoviesResponseSuccess = any
    tyoe MovieResponse = any
    actors
    is correctly typed, but actors is just a part of whole reponse by doing this I losing types for
    movies
    as they becoming an
    any
    type, Im still learning typescript and may doing an easy mistakes but I basing very much on examples from docs and other sources, and it looks like it should works, but its not. How to do it properly? My full +page.server.ts file looks like that:
    Copy code
    import { error } from '@sveltejs/kit';
    import { supabase } from '$lib/supabaseClient';
    import type { PageServerLoad, PageServerLoadEvent } from './$types';
    import type { Database } from '$lib/database.types';
    
    export const load: PageServerLoad<{ movies }> = async ({ params }: PageServerLoadEvent) => {
        const { data: movies, error: err } = await (<RankingsResponseSuccess>supabase
            .from('movies')
            .select(
                `*, actor1 (name, slug), actor2 (name, slug),`
            )
            .eq('slug', params.slug)
            .limit(1)
            .single());
        if (err) {
            throw error(404, err.message);
        }
    
        if (movies) {
            return {
                movies: movies
            };
        }
    };
    
    type actor1 = Database['public']['Tables']['actors']['Row'];
    type actor2 = Database['public']['Tables']['actors']['Row'];
    
    type RankingsResponse = Awaited<ReturnType<typeof load>>;
    export type RankingsResponseSuccess = RankingsResponse['movies'] & {
        actor1: actor1[],
            actor2: actor2[]
    };
    Am I doing something wrong?
    • 1
    • 1
  • Help in deleting user from auth.user
    s

    STILLWATER;

    09/14/2022, 2:46 PM
    How do we delete from auth.user, doing it from rpc is causing following error: { error: { code: '42501', details: null, hint: null, message: 'permission denied for table users' }, data: null, count: null, status: 403, statusText: 'Forbidden', body: null }
    g
    c
    • 3
    • 16
  • Session using a store or not?
    e

    enti

    09/14/2022, 2:56 PM
    I followed a guide keeping the current auth Session in a store (pinia/vue3). Obviously, I don't detect if the session ran out. Should I avoid using a store to handle the Session, or call
    supabase.auth.session()
    anywhere I need it instead? Or should I use a getter in my store which will call for
    const session = supabase.auth.session()
    anytime I need this value / check if the user is still authenticated server side?
  • Limit on foreign table to filter select query?
    h

    hko

    09/14/2022, 3:30 PM
    Hi, I'm a bit stuck trying using limit/order on foreign tables:
    Copy code
    js
    const { data, error } = await client
      .from("user_content_queue")
      .select(
        "title, content, type, target_url, format, priority, id, published_at, digest_id (id, created_at)"
      )
      .order("created_at", { foreignTable: "digest_id", ascending: false })
      .limit(1, { foreignTable: "digest_id" })
      .order("type", { ascending: false })
      .order("priority", { ascending: true });
    Multiple pieces of content belong to a single digest. With this query, I want to retrieve all content items that belong to the latest query. While the query runs without any errors, it does not limit the digests to the latest id, but rather returns all digests. Any ideas on how I might get this to work?
  • What happened to db remote set?
    k

    kaaloo

    09/14/2022, 4:24 PM
    I must have missed something but in the latest supabase CLI version the
    db remote set
    command doesn't seem to exist anymore! Is this the case or did I miss something between releases? The current documentation mentions the
    db remote changes
    and
    db remote commit
    commands which presumably still require setting the remote URL...
    v
    • 2
    • 3
  • How can I delete an user from my Website
    s

    Shecky

    09/14/2022, 4:29 PM
    Hi, i cant find a way to delete an auth user from my website, so not server side. Also i cant use the secret key, because that would expose him. So is there a way?
    g
    • 2
    • 5
  • supabase 2.0 select from view
    j

    Jaaneek

    09/14/2022, 4:40 PM
    I do not have intelisense on views when using supabase 2.0. I can't select.from(VIEW) but in supabase 1.0 it's possible to select.from(VIEW)
1...222324...230Latest