https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Is there a way to see webhook errors in the log?
    s

    stillmotion

    01/02/2023, 8:30 PM
    My endpoint is failing, but would be nice to see what response the Supabase side is getting.
    g
    • 2
    • 8
  • Issues with having 2 clients
    p

    Pythonic

    01/02/2023, 8:31 PM
    Hi there, I just started using supabase so I'm pretty new to it. I am using Next JS so I would like to have a supabase client that has super user access and a supabase client that uses the public anon key for RLS. So this is how I tried to implement it:
    Copy code
    ts
    const PROJECT_URL = "***";
    const PUBLIC_KEY = "***";
    const PRIVATE_KEY = process.env.SUPABASE_KEY;
    
    export const supabase_admin = createClient(PROJECT_URL, PRIVATE_KEY || '');
    export const supabase_client = createClient(PROJECT_URL, PUBLIC_KEY);
    Copy code
    ts
    import { supabase_client } from "@/lib/supabase";
    import { FaGoogle } from "react-icons/fa";
    
    export default function GoogleLogin() {
        const signIn = async () => {
            const { data, error } = await supabase_client.auth.signInWithOAuth({
                provider: 'google',
            })
        }
        return (
          ...
        );
      }
    However when I import both of them into my projet is get a
    Error: supabaseKey is required.
    s
    • 2
    • 2
  • triggers missing with db diff
    b

    bob_merlin

    01/02/2023, 9:40 PM
    Hi i know that the diff tool is not foolproof, but is there any way to prevent issues like the one in the title? It doesn't matter if i use
    migra
    or the standart command, the `trigger`'s created in the UI will not be in the migrations
  • If I am self hosting supabase, what are the system requirements of a VPS
    a

    Andrewww

    01/02/2023, 11:58 PM
    I am looking at options for a virtual machine on Linode to host a docker container of supabase, and I don't know how many (shared) CPU's or how much Ram I would need. I feel confident that storage won't be an issue, as their lowest offering is 25 GB, but I don't know much about the CPU and Ram minimum requirements. Here is the pricing/amount chart I am looking at: https://www.linode.com/pricing/#compute-shared Any advice and knowledge would be greatly appreciated! Thank you
    n
    s
    • 3
    • 4
  • Alternative on Using NPM Package in Edge Functions
    a

    anggoran

    01/03/2023, 1:52 AM
    So, I just tried to deploy Supabase Functions, and got this error:
    Copy code
    Uncaught (in promise) Error: Module not found "npm:js2xmlparser@5.0.0".
    It seems that Supabase use Deno Deploy. From what I've seen in Deno discord channel, it doesn't support npm package. Is there any alternative on this?
    • 1
    • 1
  • TypeError Cannot read properties of undefined (reading 'signUp')
    e

    Esore

    01/03/2023, 1:54 AM
    Hello, I am running into this error for some reason. I am using Nextjs 13. I have no idea what the issue is as I have been stuck on it all day.
    Copy code
    'use client'
    import type {NextPage} from "next"
    import {useUser, useSupabaseClient} from "@supabase/auth-helpers-react"
    import {Auth, ThemeSupa} from "@supabase/auth-ui-react"
    import {useRouter} from "next/navigation"
    
    const Login:NextPage = () => {
    
        const supabaseClient = useSupabaseClient();
        const user = useUser();
        const router = useRouter();
    
      if(user) {
        router.push('/dashboard')
      }
    
      return (
    
        <Auth appearance={{theme: ThemeSupa}} supabaseClient={supabaseClient} />
        
      )
    }
    
    export default Login
    This is my login page. What could be leading to this error? Thanks!
    • 1
    • 1
  • Copy schema to make a staging project
    t

    Tony_n

    01/03/2023, 3:05 AM
    I saw this link https://supabase.com/docs/guides/platform/migrating-and-upgrading-projects but there was a github issue where a user mentioned it deleted his old data. My project is in production and I am worried about losing data. Any ideas?
    n
    • 2
    • 2
  • Database trigger based on db update
    m

    mickey

    01/03/2023, 3:37 AM
    Hi, I would like to ask if it is possible to trigger a db update after a db_row.status field has been updated to 'completed'. Currently, it seems like the triggers on the database is only tracking the event. How can I check what field has been updated and what's the old/new value? Do i do it on the db trigger or the db functions? or I have to use edge functions?
    u
    • 2
    • 3
  • Upload Image and Save to Database (Hook?)
    j

    jdgamble555

    01/03/2023, 4:06 AM
    I was just curious if anyone had implemented (or had any ideas) of a way to guarantee that if an image is uploaded to storage, the URL is also saved to the database. In Cloud Storage, for example, I could use a Cloud Storage Trigger Function to update the database, or I could use a Callable Cloud Function to upload the image and then save it to the database. Either way, I don't have to do two actions in order to guarantee one or the other does not fail (assuming I wrote contingencies). J
    r
    g
    • 3
    • 5
  • Returning joined data
    c

    Caleb

    01/03/2023, 4:26 AM
    I'm having quite the issue with this funtion. I'm having an issue where i have tables with collumns that have the same name but i do need to join them and returned the joinded tables. For example i have a table
    members_teams
    with
    id, team_id, user_id, created_at
    and a table
    teams
    with
    id, team_name, created_at
    . When i join them and return the product i get errors because there's multiple instances of
    id
    . What would be a good solution here? I was searching for3 or 4 hours last night and can't seem to find a solid answer. I would just SELECT the records and return them with
    RETURN NEXT
    but supabase throws and error that has only one discussion from some random article in 2003 saying
    materialize mode required, but it is not allowed in this context
    So if anyone knows the answer to that..
    Copy code
    sql
    create or replace view r as select
      members_teams.*,
      teams.created_at as teams_created_at,
      teams.id as teams_id,
      teams.team_name as teams_team_name,
      accounts.id as accounts_id,
      accounts.full_name as accounts_full_name,
      accounts.created_at as accounts_created_at,
      accounts.profile_picture as accounts_profile_picture,
      accounts.public_profile as accounts_public_profile,
      accounts.user_id as accounts_user_id,
      accounts.username as accounts_username
      FROM members_teams 
      JOIN teams on members_teams.team_id = teams.id 
      JOIN accounts on members_teams.account_id = accounts.user_id
      where members_teams.user_id = auth.uid();
    
    CREATE OR REPLACE FUNCTION handle_new_team(team_name text)
    RETURNS r
    AS
    $$
    DECLARE
      _team_id uuid;
      data record;
    BEGIN
      insert into teams (team_name)
      values (team_name)
      returning id into _team_id;
    
      insert into members_teams (team_id, user_id, team_manager, member_role, account_id)
      values (_team_id, auth.uid(), true, 'Team Manager', auth.uid());
      select * into data FROM r where r.team_id = _team_id;
    
      return data;
    END;
    $$
    LANGUAGE plpgsql;
    This is the function for reference
    s
    • 2
    • 1
  • [Solved] Question about supabase bucket example
    r

    rinorzk

    01/03/2023, 6:37 AM
    I'm struggling to update the the url of a user's avatar. I have uploaded the image on the bucket and all of that, and I can download the image too. However following this example https://supabase.com/docs/guides/getting-started/tutorials/with-nextjs#create-an-upload-widget I'm very confused how they updated the profile, with the new avatar_url, where all that url is it's the file path to the image, not the actual image url from the bucket, so how would one display that? My avatar_url at that point it's just the filepath that I chose, for example folder-name/image.png, how would I use that for pointing to an image on bucket?
    • 1
    • 1
  • Read times out, write times out, internal server error when updating table
    j

    Jb

    01/03/2023, 7:23 AM
    Hello, Happy new year 2023 to everyone. I was quite satisfied with supabase since I m trying it for few days now, but recently I created a new table of 30 columns. I have a lot of data to insert in it. I tried first the whole dataset and it timedout on writting operation. Then I tried different things and even 5 lines times out now. I tried to modified one column of this table and it s a return with internal server error on the supabase admin panel. I don t understand? Please help. Another question is about the users creation. I m using the Anon public key atm, when I try to create a new user, it sending an email to the user but the link is not working? What should I do? Many thanks for your support.
    m
    s
    • 3
    • 6
  • RLS Policy not working with 'ANY'?
    m

    MaceDogg

    01/03/2023, 7:53 AM
    What I am putting
    • 1
    • 1
  • DB function that automatically deletes the image from the storage bucket when a post is deleted..
    c

    Crownie

    01/03/2023, 9:01 AM
    The image path is stored in posts(image_path) This is what i tried
    Copy code
    sql
    -- Delete image after post is deleted
    CREATE OR REPLACE FUNCTION delete_image() RETURNS TRIGGER AS $$
    DECLARE
      image_path text;
    BEGIN
      -- Get the image path for the post being deleted
      SELECT public.posts.image_path INTO image_path FROM public.posts;
    
      -- Delete the image from the post-images bucket
     delete from storage.objects where bucket_id = 'post-images' and name = image_path;
    
      RETURN NULL;
    END;
    $$ LANGUAGE plpgsql;
    
    
    -- Create a trigger that calls the delete_image function after a post is deleted
    CREATE TRIGGER delete_image_when_postdelete
    AFTER DELETE ON posts
    FOR EACH ROW
    EXECUTE PROCEDURE delete_image();
    I think this is more of a postgresql problem but is there like an easy way to do this?
    g
    • 2
    • 7
  • custom sdk as inline script with embedding supabase as dependency
    f

    flapili (FR, bad EN)

    01/03/2023, 9:03 AM
    Hi, I would like to create an sdk/script where supabase will be in dependency my case is to create an analytics system
    g
    • 2
    • 6
  • Partnership with Supabase
    j

    Jerry X

    01/03/2023, 9:18 AM
    Hi supabase team, I am jerry from ILLA. We are very interested in partner with Supabase. We are a low-code development tool. I have submited the material online, but I haven't heard back from you guys. Is there anything else I can do to push this partnership? Please let me know
    s
    • 2
    • 1
  • Auth - Monthly Active Users
    d

    D3R1K

    01/03/2023, 9:22 AM
    Good day and happy new year to all. When it come to the Auth MAUs... are these limits based on unique users (meaning on the free tier you can have 50k unique users making auth requests for sign up, sign in/out) or does it count every time a user makes some sort of Auth request regardless if they have already been active during the month?
    g
    • 2
    • 2
  • All the emails of confirmation of registration going to SPAM
    s

    silentworks

    01/03/2023, 11:50 AM
    Are you using a custom SMTP?
    a
    • 2
    • 7
  • Help on Nuxt supabase
    d

    davidvic02

    01/03/2023, 11:35 AM
    Hi Guys im still rookie on supabase may i know how should i pull data on nuxt as i already created database shown in the image do i need to create policy to allow it to be pulled help me please thank you?
    s
    • 2
    • 4
  • Is there a way I can read the plain text of my Supabase secrets?
    u

    49Ryann

    01/03/2023, 1:20 PM
    I only get an encrypted version via:
    Copy code
    supabase secrets list
    s
    • 2
    • 2
  • Building drag-drop app in vue
    s

    sylar815

    01/03/2023, 1:37 PM
    Hi Everyone, I am looking for guidance on creating front-end interfaces with vue. e.g. workflow use case with drag-drop, setting conditions reference - https://retool.com/products/workflows Any suggestions?
    s
    f
    • 3
    • 3
  • how to ensure 3 columns is either null or non empty string ? (utm)
    f

    flapili (FR, bad EN)

    01/03/2023, 1:56 PM
    Hi, I'm building a utm tracker
    u
    • 2
    • 11
  • Error when setting up local environment
    o

    osgm

    01/03/2023, 2:15 PM
    I just got started with Supabase and after following the guide here: https://supabase.com/docs/guides/resources/supabase-cli/managing-environments I am already stuck. I get errors about
    local config differs from linked project
    right after
    supabase link
    . Full output:
    Copy code
    Finished supabase link.
    Local config differs from linked project. Try updating supabase/config.toml
    [api]
    port = 54321
    schemas = ["public", "storage", "graphql_public"]
    extra_search_path = ["public", "extensions"]
    max_rows = 1000
    oskar@MacBook-Pro-2 test-backend % supabase db remote commit                       
    Error: The remote database's migration history is not in sync with the contents of supabase/migrations. Resolve this by:
    - Updating the project from version control to get the latest supabase/migrations,
    - Pushing unapplied migrations with supabase db push,
    - Or failing that, manually editing supabase_migrations.schema_migrations table with supabase migration repair.
    Try rerunning the command with --debug to troubleshoot the error.
    oskar@MacBook-Pro-2 test-backend % git add .
    fatal: not a git repository (or any of the parent directories): .git
    This is a fresh project, the only thing I've done is add two buckets using the Dashboard
    z
    n
    • 3
    • 2
  • pgbouncer config error
    r

    Rares | Foton • Teeps

    01/03/2023, 2:34 PM
    I am trying to connect supabase to a remix app ... will deploy to vercel so i need to use connection pooling schema.prisma looks like this:
    Copy code
    datasource db {
      provider = "postgresql"
      url      = env("DATABASE_URL")
      shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
    }
    
    generator client {
      provider = "prisma-client-js"
    }
    
    model Extension {
      id    String @id @default(cuid())
    }
    .env:
    Copy code
    DATABASE_URL=postgres://aaa:aaa@db.xxx.supabase.co:6543/postgres?pgbouncer=true&connection_limit=1
    SHADOW_DATABASE_URL=postgres://aaa:aaa@db.xxx.supabase.co:6543/postgres_shadow
    when i run
    Copy code
    js
    prisma migrate dev --name init
    i get
    Copy code
    Error: db error: FATAL: bouncer config error
       0: migration_core::state::DevDiagnostic
                 at migration-engine/core/src/state.rs:264
    m
    n
    • 3
    • 13
  • Creating User (adding users table's row) on Sign-Up in Supabase Magic Link
    k

    KennStack01

    01/03/2023, 2:34 PM
    hey, hope you're fine! Currently building an app using supabase. Would like to get some help from you guys: I am using a magic link login system, and I want to add a row (data) in the "users" table every time a user signs up (automatically)... Been trying to use a trigger code, but it says "Failed to run SQL query: relation "users" already exists", BUT when the user signs up, Nothing happens on the users' table. Any help? I'd appreciate it 🙏
    u
    s
    • 3
    • 22
  • Undefined function in trigger function?
    b

    brassotron

    01/03/2023, 2:42 PM
    Hello, I'm trying to make an API request to a third party when a row is inserted into a table, but for some reason while I can call the
    http_header
    function outside the body of the function, if I try to call this inside the function body I get the following error?
    Copy code
    function http_header(unknown, unknown) does not exist
    Is it because of the language set on the function? Thanks, Connor
    g
    • 2
    • 52
  • Current transaction is aborted error
    d

    dexsnake

    01/03/2023, 3:27 PM
    I keep randomly getting this error:
    current transaction is aborted, commands ignored until end of transaction block
    when using the v2 javascript library in my react native project. I can't seem to track down the issue as it happens randomly in any function that calls the api, inserts, selects etc. When the error is thrown, there is no details or hint on the error object. Just a 25P02 code and that message.
    g
    • 2
    • 13
  • How can I get a single column like name for example without return an array?
    s

    salym_akhmedov

    01/03/2023, 3:43 PM
    And this is what my fetch function looks like export const getBoardById = async (id: string | undefined) => { return await boardsApi.get(
    /board?id=eq.${id}&select=*
    ); };
    g
    • 2
    • 2
  • Convert SQL to GraphQL
    t

    twonarly

    01/03/2023, 3:44 PM
    I currently have this query
    Copy code
    select * from rentalequipment where to_tsvector(title)
      @@ to_tsquery('Hilti');
    returning the correct data, but my postgresql.graphql file is not written correctly. Currently this is what I have
    Copy code
    getRentalequipmentByTerm(term: String): [Rentalequipment]
        @dbquery(
          type: "postgresql"
          schema: "public"
          query: """
          SELECT * from rentalequipment where to_tsvector(title)
            @@ to_tsquery('$1');
          """
          configuration: "postgresql_config"
        )
    • 1
    • 1
  • type problem with inviteUserByEmail()
    l

    logemann

    01/03/2023, 3:57 PM
    Hi, i get a weird typescript error when doing this:
    Copy code
    import { UserResponse } from '@supabase/gotrue-js/src/lib/types';
       const foo = () : Promise<UserResponse> => {
       const supabase = createServerClient();
       return supabase.auth.admin.inviteUserByEmail("some@email.com");
    }
    It complains about Promise but when i look into the supabase code, i see this very return type. Anyone else facing this issue? original error message: > TS2322: Type 'Promise' is not assignable to type 'Promise'.   Type 'import("/Users/ml/development/projects/nextjs/with-tailwindcss-app/node_modules/@supabase/gotrue-js/dist/module/lib/types").UserResponse' is not assignable to type 'import("/Users/ml/development/projects/nextjs/with-tailwindcss-app/node_modules/@supabase/gotrue-js/src/lib/types").UserResponse'.
    • 1
    • 1
1...868788...230Latest