https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Is it possible to change use role to be an admin?
    s

    supsupdev

    09/27/2022, 9:15 AM
    Hi, my app has regular logged in users, but I'd need some users to be admins so that they can access the backoffice. From the UI i'd check if they are admin and let them see the backoffice, from supabase I will also create policies that will only allow queries in the backoffice to users with role admin. How would you change the role? I was not able to find anything about this. Thanks
    g
    s
    • 3
    • 8
  • OAuth provider metadata documentation
    s

    Spoonz

    09/27/2022, 12:02 PM
    Is there somewhere I can see documentation of what each oauth provider returns as metadata? I'm trying to work out what data I'll be able to save for each user when they sign up but I can't find any documentation about the different metadata each provider returns.
    s
    • 2
    • 2
  • Why isn't google auth returning user and session?
    l

    lordmike

    09/27/2022, 12:18 PM
    so im doing google o auth, which works fine, but unfortunately im not able to dispatch them to react context like this ( google auth just redirects me back to the home page )
    s
    • 2
    • 3
  • Rest API get count using CURL
    m

    Mokamars

    09/27/2022, 1:01 PM
    Hi everyone, I'm currently implementing a node js api for my react front and want to use the supabase rest api with axios. But I cannot find how to get the count of a table ? If I'm using thenpm package every call is made via Websockets and it cannot work on my desktop. thanks for your help
    s
    s
    • 3
    • 3
  • Error [500] failed to get pg.tables could not open file globalpg_filenode.map
    w

    Waterpile

    09/27/2022, 2:15 PM
    Had some issues with the API this morning, looked in the dashboard and can't access most options. Only one project has been affected by this. Error below: Error: [500] failed to get pg.tables: could not open file "global/pg_filenode.map": Input/output error
    s
    • 2
    • 2
  • Invalid JWT Token `statusCode '401', error 'Invalid JWT', message 'new row violates row-level`
    v

    ven

    09/27/2022, 3:35 PM
    I am trying to upload a file to a storage bucket using the JS library. I think I have set the right policies for insert and select. Why would i be getting this error?
    g
    • 2
    • 3
  • AWS Aurora PostgreSQL as a db backend?
    s

    SteveBrinager

    09/27/2022, 3:48 PM
    For compliance reasons, we need to self-host. We're an AWS-based shop and would prefer to use AWS Aurora PostgreSQL for our backend instead of a docker or EC2 based Postgres database. The problem is, we don't have access to the postgres user and all the Supabase init scripts assume you are running as that user. We were able to work around that by making some small tweaks to the scripts and preparing an admin-style account on our own ahead of time, but when we try to start up the realtime container, the eval Realtime.Release.migrate portion of the command fails.
    • 1
    • 1
  • Deploying functions with dependencies
    t

    tito

    09/27/2022, 3:50 PM
    Here's a scenario. Say you have a project with a few functions (e.g. 30). Common code has been refactored in a utility.js/.ts file so that it can be accessed from some of these functions. At some point, a bug is fixed in this file which is used in say, 20 of these files. Now... in Firebase, it's up to the developer to trace back the calls and figure out the top functions/endpoints to deploy. This is time-consuming, non-productive and error-prone. How about Supabase? Is there a way to deploy everything so no function gets left behind? I see in the docs that each function must be uploaded individually? If so, it sounds pretty limiting. What is your workflow?
  • Best Practice for Storage RLS
    d

    dwome

    09/27/2022, 3:57 PM
    Hey, I am currently wondering if there is any kind of best practices for indices when setting up rls for storage? Status Quo: Since the folder path is concatenated in the "name" property of the storage.objects table I do not see a way to setup an rls and indice where the DB just look at the first or second part of the name path in a performance efficient way. **Example**: folder path: //file_name We have an RLS Setup that checks if the user has access to the team_id Now I would like to setup an indice so that a user can access the files of his team very efficient, as currently we are performing very week index scan, which are actually full table scans. Is there any kind of example for RLS and indice setup available or any tip to setup a RLS on folder level with the corresponding indices?
  • Supabase CLI not found on v2 RC
    m

    MapleLeaf 🍁

    09/27/2022, 4:06 PM
    hey I installed the supabase v2 RC in my project which uses pnpm, but there's no binary found. other binaries seem to appear just fine
    s
    • 2
    • 4
  • ` db error FATAL remaining connection slots are reserved for non-replication...` when using supa
    j

    jfy

    09/27/2022, 4:10 PM
    Error querying the database: db error: FATAL: remaining connection slots are reserved for non-replication superuser connections
    We're only getting this when we switch from Railway to Supabase. See pic of logs. Any idea why?
    s
    a
    • 3
    • 3
  • path_tokens null on storage object insert trigger
    s

    stevharve

    09/27/2022, 4:12 PM
    Copy code
    sql
    BEGIN
      IF new.bucket_id != 'team-gallery' THEN
        RETURN null;
      END IF;
      INSERT INTO public.gallery
      (object_id, user_id, team_id)
      VALUES
      (new.id, new.owner, new.path_tokens[0]::uuid);
    
      RETURN new;
    END;
    While inserting the team_id into the gallery table from the new.path_tokens[0] team_id is null. The object that I am listening for an insert from is in a folder with the uuid of the team.
    s
    • 2
    • 8
  • Does Supabase support global read-only replication?
    c

    Cheesy

    09/27/2022, 5:02 PM
    I'm currently the founder of a global app with thousands of users. We want to limit latency for our global users but also want to migrate to Supabase!
    s
    • 2
    • 1
  • What does 'Inactivity' mean for the app suspension?
    s

    SimonP

    09/27/2022, 5:20 PM
    Gets my free-tier app suspended if no requests are made to it, or if no admin logs in to the console?
    g
    • 2
    • 1
  • graphql aggregations
    j

    jdgamble555

    09/27/2022, 5:22 PM
    Does Supabase Graphql support aggregations? J
    • 1
    • 1
  • Invite user via zapier
    j

    JuicyBenjamin

    09/27/2022, 5:47 PM
    Hi there Would it be possible to setup a flow where a user is invited via zapier? I have no idea how it would work, but I'd like to be able to have it set up so when [insert thing] happens off site, a user with the corresponding mail gets invited. Is this too out there or is it actually possible?
  • Realtime with custom JWT not working on Supabase platform
    i

    Ion

    09/27/2022, 6:44 PM
    Hi! I am trying to set the credentials with
    supabase.auth.setAuth(token)
    , and the subscriptions in
    realtime.subscription
    table vanish after a few seconds. In logs I found this:
    "Received an invalid access token from client: {:error, :unknown}" "Unknown connection authorization error: :error"
    . I use the flutter SDK and the jwt is signed using jwt secret and the payload contains all the required claims like for example
    { "supabase_uid": "1ed9dcf5-e383-4e41-820f-58df106c3e5c", "role": "authenticated", "aud": "authenticated", "app_metadata": {}, "user_metadata": {}, "iss": "my_supabase", "iat": 1663875937, "exp": 1663880737 }
    I test my code on a self-hosted supabase and it works as expected. Can anyone please tell me what can be done in this case?
    g
    • 2
    • 4
  • How to move a project to different organization
    s

    shepherdgames

    09/27/2022, 6:46 PM
    Is it possible to move a project from one organization to another organization in same account?
    s
    • 2
    • 1
  • Hi, can someone please help me turn this query into a supabase-js query ?
    z

    ZetiMente

    09/27/2022, 6:48 PM
    Copy code
    select *
    from profiles 
    INNER JOIN images ON profiles.id = images.profile_id
    INNER JOIN follows on profiles.id = follows.following_id
    where follower_id = 12;
    This works:
    Copy code
    let { data: images } = await supabase
            .from('images')
            .select('*, profiles!inner(*)')
            .range(0, 25)
            .eq('profiles.id', 10)
            .order('created_at', { ascending: false });
    But can't figure out the syntax to add follows.following_id. It is a FK to profiles but it's a composite key with followers_id. For some reason can't get a working version of this SQL query into Javascript.
    i
    s
    • 3
    • 8
  • Magic Link redirects
    n

    NCavaliere1116

    09/27/2022, 7:40 PM
    I'm running supabase-auth-helpers-react on next.js and we have a login page that emails the user a magic link. Upon authorization when the link is clicked, the user should be redirected to the '/profile' page using: supabase.auth.signIn( { email: data.email }, { redirectTo:
    ${process.env.NEXT_PUBLIC_HOST_DOMAIN}/profile
    } ) When the profile page is fetching the user data client side by hitting an api endpoint within the app, the redirect works accordingly. const { user, error } = useUser() useEffect(() => { async function loadData() { fetch(
    /api/users/${user?.id}
    ) .then(res => res.json()) .then(result => setInfo(result)) } // Only run query once user is logged in. if (user) { try { loadData() console.log(user) } catch (error) { console.log(error) } } }, [user]) When fetching the data using getServerSideProps, the redirect no longer works and i get sent to the home route of the app. The user is confirmed to be authorized and signed in when navigating back to the /profile page. export const getServerSideProps = withPageAuth({ async getServerSideProps(ctx) { const prisma = new PrismaClient() // Access the user object const { user, accessToken } = await getUser(ctx) const prismaUser = await prisma.user.findUnique({ where: { id: user?.id, }, }) return { props: { user, prismaUser, }, } }, }) Has anyone else experienced this redirect bug when fetching data server side rather than client side? Any help would be greatly appreciated!
    n
    • 2
    • 4
  • Basic SQL Question
    j

    jdgamble555

    09/27/2022, 10:54 PM
    I'm trying to make a View with my hearts count: hearts - pid (fk to posts) - ... posts - id -...
    Copy code
    sql
    CREATE OR REPLACE VIEW posts_hearts_count AS
    SELECT hearts.pid, posts.*, COUNT(hearts.pid) AS heartsCount
    FROM posts
    JOIN hearts ON posts.id = hearts.pid
    GROUP BY hearts.pid
    But I get this error:
    Copy code
    Failed to run sql query: column "posts.created_at" must appear in the GROUP BY clause or be used in an aggregate function
    I basically want my entire posts data along with the
    heartsCount
    field for the total likes of that post. Relearning SQL is interesting... J
    • 1
    • 1
  • Add a new property to all objects in an array ?
    k

    Kevin.

    09/27/2022, 10:56 PM
    I am thinking of using Superbase in my next project. I would have to import a large data set of data to the database. Am I able to easily add a property and value to every object in the database ? the property name and value would be the same for every object.
    g
    • 2
    • 1
  • Role permissions
    n

    NanoBit

    09/27/2022, 11:31 PM
    You should grant the role that is trying to access from the JavaScript client to the custom schema. Grant …. To (role) On (custom schema) (Syntax sth like above. I didn’t verify it)
    g
    • 2
    • 5
  • Best way to track all changes (and who made the change)
    n

    nkeating

    09/28/2022, 12:48 AM
    I came across the
    supa_audit
    package which looks sufficient, but the issue is we manage authentication outside of supabase so we have an issue of not knowing what user made a specific change to a given record/row... Whats the best approach to solve this?
    k
    n
    • 3
    • 2
  • Best way to store a image in storage with additional data
    s

    stevharve

    09/28/2022, 2:46 AM
    How could I relate information such as a caption, team_id (uuid of the team that the image belongs to), location, and other stuff to the image in storage. I am looking for a way that won't leave a image with no data or data with no image. (AKA I don't want to upload the image, get the id from the image, then create the record all client side. Is there a way to do this with RPC or a edge function? (One invoke/call from browser to create record and upload image?)
    j
    • 2
    • 1
  • Weird link instead of App name on Google OAuth Screen
    d

    Domcario

    09/28/2022, 3:35 AM
    Why is the OAuth screen page using the Supabase project URL instead of the App name i specified in google console's oauth consent screen settings? Is it because it is the Authorized redirect URIs for my OAuth 2.0 client id on google console settings?
    s
    • 2
    • 1
  • Does realtime work on database views?
    t

    thestepafter

    09/28/2022, 4:37 AM
    Curious if realtime works for database views or only database tables?
    j
    g
    • 3
    • 8
  • Is it possible to invoke an edge function from web client?
    u

    49Ryann

    09/28/2022, 5:11 AM
    Is it possible to invoked edge functions from web client? Currently I am adding a new row to a table to invoke the generation of a new Twilio Access Token for a user, is this the easiest way to do so currently in your opinion?
    g
    • 2
    • 4
  • Storage RLS Performance Index not used with RLS enabled
    p

    psteinroe

    09/28/2022, 7:59 AM
    Hey everyone, I am having major struggles with the query performance of the storage.objects table and cannot get my head around it. Any help is highly appreciated. We are providing a multi-tenant solution where different entities can have files attached. To easily query them on different levels, we enforce the following directory structure:
    organisation-id/entity-id/myfile.jpg
    In some cases, we also have one more level, e.g. for conversation with messages, we want to attach files to a message but also query all files of a conversation:
    organisation-id/conversation-id/message-id/myfile.jpg
    . To query files for an entity, we use the following query (simplified):
    Copy code
    sql
    select id
    from storage.objects
    where bucket_id = 'message_files'
    and uuid_from_path_level_2(name) = '7daa4a53-1233-432d-bf11-a9dee8140027'::uuid;
    For a better performance, we setup a bunch of indices, and when executed as service_role (bypassing rls), the indices are properly picked up ([Visualised on explain.dalibo](https://explain.dalibo.com/plan/4247g6e82726c139)).
    • 1
    • 6
  • Supabase and Web3 Auth Guidance & Experience
    c

    cryptoneur

    09/28/2022, 8:38 AM
    Hey supabase frens, I saw that in the latest comment that sign in with ethereum / other web3 auth ideas are depriroritzed right now for good reasons: httpsgithub.comsupabasegotruepull282. I saw
    moralis
    and
    clerk
    offering some third party soultions as well as someone suggesting to just use
    wagmi
    or
    rainbowkit
    and link a new web3 table to the original
    users
    table via a foreign key. Anyone has tried any of this? What was your experience? Would love to implement an open source solution but haven't found any good tutorial or codebases. Would love to hear your experience or any links to REPOS where one implemented this! Thanks 🙏
1...333435...230Latest