https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • What's the best way to store a duration in Supabase?
    b

    battlesheep123

    04/25/2023, 6:27 PM
    What's the best way to store a duration in Supabase? Something like "00:30:00" (HH:MM:SS)
    n
    • 2
    • 1
  • Not able to additional schema.
    v

    ven

    04/25/2023, 6:34 PM
    i fixed it.
  • Tips/tricks local vs production environment
    s

    sten

    04/25/2023, 6:50 PM
    Hi Guys! I am curious how I should setup supabase in different environments. I use supabase along with Clerk and Clerk supports a development environment and a production environment. I was thinking that maybe I should use supabase local development along with clerk dev environment? https://supabase.com/docs/guides/getting-started/local-development Is that possible or is it better to just create a new project? Saw this and it's not looking promising creating a staging environment https://github.com/orgs/supabase/discussions/5930 However is this an option? https://supabase.com/docs/guides/integrations/snaplet
  • Supabase CLI db dump issue, wrong db URL?
    s

    sten

    04/25/2023, 7:30 PM
    npx supabase db dump --db-url "https://xxxxxxxx.supabase.co" -f roles.sql --role-only
    Error: cannot parse `https://xxxxxxxx.supabase.co`: failed to parse as DSN (invalid dsn) What is wrong here? Following instructions here https://supabase.com/docs/guides/platform/migrating-and-upgrading-projects I assumed it to be the Project URL under settings in supabase.
    g
    • 2
    • 14
  • [BUG] Creating a 'content' column creates a duplicate and deleting one deletes both.
    v

    Vik

    04/25/2023, 8:35 PM
    Just started running into this issue today. When generating types for my React Native project the content field shows up twice. Looking into the dashboard and clicking edit table, I see that two of the same name are being created. But only one is visible on the table view itself.

    https://cdn.discordapp.com/attachments/1100520482857550006/1100520483230847018/Screenshot_2023-04-25_at_1.33.36_PM.png▾

    g
    • 2
    • 14
  • NextJS 13 app router, severe lag with Supabase auth
    a

    anargiris

    04/25/2023, 8:38 PM
    Hello, I started building a new app with the new app router for Next and Supabase. I have followed the official examples and got the helpers working too. The problem is when I try to use the "session" object from the provider. It works on the first 2,3 calls but then I experience a severe lag on my project. It seems that something is making Node overload. Anyone else had the same experience? All in all, it might be a Next13 error since there's a ton of bugs on this new way to build.
  • how can I list auth.users from Javascript Client?
    o

    osamita

    04/25/2023, 8:50 PM
    I have a table called "addresses" that has a foreign key that point to auth.users.id (this is a protected table) I can fetch addresses doing: let { data: addresses, error } = await supabase .from("addresses") .select(" * ") but i'd like to know how to fetch each address with their respective user. I tried: .select(" * ", users(*)") .select(" * ", auth.users(*)") but any of that work Can I read protected foreign tables? how? or is that a not recommended practice?
    g
    • 2
    • 2
  • Policy for pagination/select query execution
    j

    Jolly Joy

    04/25/2023, 9:14 PM
    Hi Is there any way to create policy for pagination on a table or limit how many times user can execute select query. e.g. in the user management example there is following policy create policy "Public profiles are viewable by everyone." on profiles for select using (true); But does this mean any logged in user can query my entire profiles table. What if someone tries to abuse this.
    g
    • 2
    • 10
  • How do i get the cdn url of an image in a supabase bucket after its been uploaded?
    l

    landfight

    04/25/2023, 10:32 PM
    Once I've uploaded an image to the bucket, is there a method to retrieve the CDN URL of the uploaded image, so I can insert it into a table in the PostgreSQL database? This would enable me to display the image on a screen when the CDN URL is accessed.

    https://cdn.discordapp.com/attachments/1100549924908699768/1100549925722411008/code.png▾

    g
    • 2
    • 1
  • its not pushing to a new route
    f

    formigueiro

    04/25/2023, 10:36 PM
    Hi guys, someone could helpe me? Im using nuxt3 with supabase, and after i login im pushing user to another router but its not working. Ive tryied replace so but nothing works fine
    Copy code
    js
    const handleLogin = async () => {
      try {
        const { user, error } = await supabase.auth.signInWithPassword({
          email: email.value,
          password: password.value
        })
        if (error) throw error
        else {
          await supabase.auth.refreshSession()
          useNuxtApp().$toast.success('Login efetuado com sucesso!', {
            theme: 'dark'
          })
          navigateTo('/dashboard') // redireciona para /admin após o login bem-sucedido
        }
      } catch (error) {
        useNuxtApp().$toast.error('Falha ao logar. Tente novamente!', {
          theme: 'dark'
        })
      }
    }
    im using https://supabase.nuxtjs.org/
    l
    • 2
    • 6
  • Selecting rows which reference this table
    m

    mansedan

    04/25/2023, 11:40 PM
    Hey all we are trying to get rows from table B that reference table A w/ the below query but its only returning an empty array:
    Copy code
    js
    const { data, error } = await supabase.from('sports_odds').select('*,events_odds_api(*)')
    the
    events_odd_api
    is a table that has a column
    sport
    which references a unique column from
    sports_odds
    We are hoping to query the
    sports_odds
    table and populate in the rows from
    events_odd_api
    all in one query. Is this possible?
  • Social Login User Metadata, Invite Shortcomings
    a

    andrewonaboat

    04/26/2023, 1:03 AM
    As outlined here https://twitter.com/shellscape/status/1651021114200432641 both the social login system and the invite system seem to have a pretty big hole. The invite system can't use the social login for confirmation, and the social login system doesn't appear to provide any mechanism to provide custom user metadata for insertion into raw_user_meta_data when the auth.user record is created. The latter need exists because the invites system can't use a social login, so we need some method of conveying metadata - like an invite code we hand roll - into the social login process for new users. We've considered multiple redirect, but that's very sloppy and doesn't play well with webhooks or triggers on auth.users. Before I head to github and open this as an issue, I wanted to post here to see if I'm missing something crucial.
    g
    • 2
    • 1
  • querying jsonb not returning result
    f

    FreddieDredd

    04/26/2023, 1:11 AM
    the sql version was working: select data from users where data->>'username' = 'Rubi' but the supabase library version return empty array

    https://cdn.discordapp.com/attachments/1100589937360900209/1100589937881002014/image.png▾

    https://cdn.discordapp.com/attachments/1100589937360900209/1100589938082316310/image.png▾

    s
    • 2
    • 1
  • Deploy edge functions using GitHub Actions
    b

    Baorong Huang

    04/26/2023, 1:46 AM

    https://www.youtube.com/watch?v=l2KlzGrhB6w&list=PL5S4mPUpp4OulD3olUW8Eq1IYKpUbk5Ob&index=5▾

    Do I need to add a supabase functions deploy line per function?
    s
    • 2
    • 1
  • why doesn't the preview of the image show on the storage console
    l

    landfight

    04/26/2023, 2:40 AM
    When i upload a image programatically to the storage bucket, it shows up as this, im able to download it and use the public url fine to view the image, but it doesn't show the preview on the web app

    https://cdn.discordapp.com/attachments/1100612262579937280/1100612263234240614/image.png▾

    https://cdn.discordapp.com/attachments/1100612262579937280/1100612263506890773/code.png▾

  • Need help finding request body in logs
    r

    Riley

    04/26/2023, 3:08 AM
    Hi I recently overwrote some important data in my database and am trying to recover data from one of my old get / patch requests. I see plenty of them in the logs and I know the body of the requests has the data I'm looking for, but when I select a log entry it only shows the request / response metadata. Is the request body accessible somehow? I looked in the docs but didn't see much mention of this specifically, any help is greatly appreciated

    https://cdn.discordapp.com/attachments/1100619424282722314/1100619424437907456/image.png▾

    g
    • 2
    • 2
  • Hi, I am trying to connect to Supabase from pgadmin
    d

    deathless

    04/26/2023, 3:11 AM
    Hi, I am trying to connect to Supabase from pgadmin and psql but am getting a connection refused error. This is the psql command copied from the Supabase dashboard: psql -h db.XXXX.supabase.co -p 5432 -d postgres -U postgres Thsi si the error: psql: error: connection to server at "db.XXXX.supabase.co" (XX.82.81.54), port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? Any ideas? Thanks!!
    g
    • 2
    • 4
  • background jobs
    n

    nimo

    04/26/2023, 3:27 AM
    My backend is written in NextJS, I'm using supabase auth. I am setting up a lot of background jobs. I'd like to make sure that RLS policies are still respected, but of course the background job doesn't have access to the same auth wrappers as a regular API. I've written the first version using the
    SUPABASE_SERVICE_ROLE_KEY
    . I'm a little concerned about doing that though, and curious if there's an easy / good workaround to make sure that RLS policies are preserved in background jobs? Thanks.
    g
    • 2
    • 9
  • `supabase start` fails with a error SQLSTATE 42704
    s

    sreetamdas

    04/26/2023, 3:38 AM
    I am trying to run
    supabase start
    in order to serve my edge function locally for development, and it fails with the following error:
    Copy code
    Error: ERROR: role "pg_read_all_data" does not exist (SQLSTATE 42704)
    At statement 44: GRANT pg_read_all_data TO supabase_read_only_user GRANTED BY postgres
    Not sure what is causing this, but my guess is that the
    pg_read_all_data
    role was introduced in a newer version of Postgres, while my project is using
    v13.3.0.4
    .
    • 1
    • 1
  • Issue with users signing up
    s

    Sarcodo

    04/26/2023, 6:09 AM
    Hi there, I'm getting an error on user sign up
    ERROR: duplicate key value violates unique constraint "user_pkey"
    . I have a trigger which I assume is where the problem lies, however I've tested it before and it has worked and it also works on our local db. All trigger changes in our migrations are as follows:
    Copy code
    CREATE FUNCTION "public"."handle_new_user"() RETURNS "trigger"
        LANGUAGE "plpgsql" SECURITY DEFINER
        AS $$
    begin
      insert into public.user (user_id)
      values (new.id);
      return new;
    end;
    $$;
    
    ALTER FUNCTION "public"."handle_new_user"() OWNER TO "postgres";
    GRANT ALL ON FUNCTION "public"."handle_new_user"() TO "anon";
    GRANT ALL ON FUNCTION "public"."handle_new_user"() TO "authenticated";
    GRANT ALL ON FUNCTION "public"."handle_new_user"() TO "service_role";
    
    CREATE TRIGGER on_new_user AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION handle_new_user();
    I can't seem to see why I would be getting the error, in the network tab in the browser the uuid it spits out to say it duplicated doesn't exist in the db so I'm unsure what to do. The auth logs on the signup failing also just show the duplicate key violation and not much more to go off
    s
    g
    • 3
    • 5
  • Cannot update table with `not null` postgres domain
    c

    cohlar

    04/26/2023, 7:28 AM
    Hi, I'm experiencing what seems to be a bug in the supabase client / postgrest with the
    not null
    constraint on domains. I have a
    dimensions
    domain and a
    products
    table with one product:
    Copy code
    sql
    create domain dimensions as real [] not null check (cardinality(value) = 3);
    
    create table public.products (
      id bigint primary key generated by default as identity,
      sku text unique not null check ("sku" <> ''),
      dimensions dimensions,
      archived boolean default false not null
    );
    
    insert into public.products (sku, dimensions, archived)
    values ('sku-1', array [1,2,3], false);
    Then I would like to update a record of the
    products
    table from my client as follows:
    Copy code
    js
    supabase.from('products').update({ archived: true }).eq('id', 1);
    However I get the following error from posgtrest: "domain dimensions does not allow null values". It doesn't seem to be a postgres restriction as when I update the record with SQL as follows, everything works fine:
    Copy code
    sql
    update public.products set archived = true where id = 1;
    The below workaround works for me for now (move
    not null
    from the domain definition to the table column).
    Copy code
    sql
    create domain dimensions as real [] check (cardinality(value) = 3);
    
    create table public.products (
      id bigint primary key generated by default as identity,
      sku text unique not null check ("sku" <> ''),
      dimensions dimensions not null,
      archived boolean default false not null
    );
    
    insert into public.products (sku, dimensions, archived)
    values ('sku-1', array [1,2,3], false);
    Thanks for your help - I also created an issue on github: https://github.com/supabase/supabase/issues/13978
    • 1
    • 1
  • Support for sslmode=verify-ca/verify-full
    i

    in

    04/26/2023, 7:36 AM
    From what I understood, using SSL/TLS is currently only possible on Supabase Cloud, not in self-hosted. Only having client reverse proxy encrypted communication is not enough, all communication Nginx auth/rest/realtime/etc postgres should be encrypted. It would be highly valuable, if not primordial, if each relevant image had an implementation to encrypt/decrypt requests on both sides. Regarding the config, simply add env variables to specify the location of the cert and the private key which will be used for both sides. Plus, another one to specify the Postgres sslmode such as verify-ca and verify-full. I know this is already being worked by the amazing Supabase team, but is there an ETA?
  • New row violates row-level security policy for table
    a

    and_g

    04/26/2023, 7:53 AM
    If I try to insert new row into the table, I get an error: "New row violates row-level security policy for table" I have a table "user_profiles" that have a foreign key "user_id" to auth table "auth.users.id" I am using "supabase.auth.onAuthStateChange" hook where I want to add new row when user logs in. In policies section, I have RLS enabled, but I didn't add any policies. Then, I tried to add a policy from template that only authenticated users can add a row, but it didn't change anything. Then, I came across this SO question https://stackoverflow.com/questions/69527475/cannot-insert-to-table-with-authenticated-role-policy-in-supabase and tried to add a policy from template that only authenticated users can select, but I am still getting the same error.

    https://cdn.discordapp.com/attachments/1100691072914563144/1100691073770205224/Screenshot_2023-04-26_at_09.50.19.png▾

    https://cdn.discordapp.com/attachments/1100691072914563144/1100691074168668321/Screenshot_2023-04-26_at_09.48.56.png▾

    https://cdn.discordapp.com/attachments/1100691072914563144/1100691074491625594/Screenshot_2023-04-26_at_09.47.33.png▾

    https://cdn.discordapp.com/attachments/1100691072914563144/1100691075011715122/Screenshot_2023-04-26_at_09.45.16.png▾

    n
    s
    • 3
    • 38
  • Force user to re-authenticate with OAuth
    a

    alitnk

    04/26/2023, 7:56 AM
    How can I make the user go through the GitHub OAuth prompt? (again) My GitHub provider has some additional scopes that request access on user's organizations and I'd like to be able to request them again after they've logged in. Just any way to get them to the GitHub auth prompt...
    • 1
    • 1
  • Local auth on CLI project
    m

    MartinW

    04/26/2023, 8:04 AM
    On a local project created using Supabase CLI, with a React project, trying to create a user the auth fails with:
    Fetch API cannot load http://localhost/auth/v1/signup due to access control checks.
    Any suggestions on configuration I'm missing?
    s
    • 2
    • 2
  • Rows inserted/upserted from Pipedream not appearing in Supabase
    m

    majordisco

    04/26/2023, 9:12 AM
    I am using Pipedream to connect to Supabase and insert/upsert rows to a table, and I am able to see that I am successfully hitting the API (i.e. when I manually insert a row, I can see that
    id
    is incrementing as expected from the Pipedream tests) but the records are not appearing in Supabase itself. Any ideas on why this might be happening?
    • 1
    • 1
  • Just got notified I'm exceeding my usage limits (specifically egress), had a few questions
    p

    pArsLey7

    04/26/2023, 10:07 AM
    So I've been working on a little citizen science project for a little while and did an initial soft launch last weekend where I shared the link online and with some friends just to get a bit of feedback. I'm currently using the free plan with Supabase because until this week it was only me and one team member working on the project so we didn't need to worry about exceeding our usage limits. However, after this launch we've found that we're exceeding our database egress by over a gigabyte (for reference, our database size is 73mb). I'm not really too familiar with egress and I'm looking for some advice on how I could reduce it? Cheers
    n
    g
    • 3
    • 3
  • Google Auth and Magic Link not working on mobile devices
    f

    fekdaoui

    04/26/2023, 10:14 AM
    Hi all, I have a VueJS frontend using Supabase for authentication. Users can either log in using Google Auth or through a Magic Link - on desktop all of this works perfectly. On mobile however, neither option seems to work. Users are redirected to the landing page and are not being logged in. What could be the reason for this? When I simulate a mobile device using Google DevTools it works fine as well, only on an actual mobile device it does not work. Would really appreciate your help here as I cannot seem to find what the issue is.. Thank you in advance 🙏🏽🙏🏽
    c
    r
    • 3
    • 5
  • Using unsupported languages
    c

    CzarSalad

    04/26/2023, 10:20 AM
    How would I go about using an unsupported programming language for Supabase? I have used Supabase for my JS Discord bot and love it. Due to this Im interested in seeing if I can use it for Java as I am going to be developing some Minecraft plugins here soon.
    s
    • 2
    • 2
  • Control of redirectTo by user status
    r

    Ryuya

    04/26/2023, 12:02 PM
    I use
    signInWithOAuth
    for github authentication. I want to separate this
    redirectTo
    by user status. Specifically, I want to change the destination depending on whether
    is_onboarding_completed
    in the user table is true or false. The return value (data) of
    signInWithOAuth
    is as follows and has no information to identify the user.
    Copy code
    {
      "provider": "github",.
      "url": "https://[id].supabase.co/auth/v1/authorize?provider=github"
    }
    How can I accomplish this?
    g
    • 2
    • 4
1...192193194...230Latest