https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Deleting users in the dashboard requires me to first delete their avatar
    v

    Vik

    03/21/2023, 1:00 AM
    Looking for some assistance in deleting accounts in the dashboard. The ideal flow would be that the user deletes their account and the avatar they have tied to their account also gets deleted. Right now, I'm using the auth.uid() to store the avatars in their own folders. What would be the right approach to fixing this? It's important I get this fixed because Apple requires a way for users to delete their account. Note, the
    avatars
    is a public bucket and these are the security policies. SELECT
    ((bucket_id = 'avatars'::text) AND true)
    DELETE
    ((bucket_id = 'avatars'::text) AND ((auth.uid())::text = (storage.foldername(name))[1]))
    INSERT
    ((bucket_id = 'avatars'::text) AND ((auth.uid())::text = (storage.foldername(name))[1]))
    UPDATE
    ((bucket_id = 'avatars'::text) AND ((auth.uid())::text = (storage.foldername(name))[1]))
    g
    • 2
    • 2
  • Failed to create organization: Unauthorized
    m

    Mai | GMT+8

    03/21/2023, 2:31 AM
    Hi team, new to supabase, when I tried to create a project, it prompted me to create a org, but it failed with reason: Unauthorized I already signed up with github! hope anyone can help me!πŸ™
    g
    • 2
    • 5
  • Understanding how deploying a migration works
    j

    Jinni

    03/21/2023, 5:33 AM
    So I am reading this: https://supabase.com/docs/guides/cli/managing-environments#configure-github-actions As I can understand, it will update the database (
    db push
    ) after merging the develop branch to main branch. Can someone explain what could be the problems? What happens if db push fails and the code got merged? Is there a downtime?
  • how do you create a unique apikey per app?
    a

    AntDX316

    03/21/2023, 7:56 AM
    how do you create a unique apikey per app? There are is the anon and service_role key but if you have more than 2 programs you cannot adjust? If you have like 50 apps that need its own unique apikey just incase anon or service_role gets compromised how do you do this? I don't want to update all the apps just to change a key : ( I'm quite new to https requests and supabase so all I know there are only 2?
    n
    g
    r
    • 4
    • 12
  • Supabase types in NextJS
    a

    Aissam

    03/21/2023, 8:02 AM
    Hi, I’m working in a Nextjs / supabase project. I generated types from supabase and stored them in types directory. In one of my components I need to reference one supabase type let’s call it customer. The problem is that I cannot extract it from the supabase generated types
  • Obtaining a specific value from the table
    s

    Saad

    03/21/2023, 8:41 AM
    Hi everyone! I am using Supabase with Appsmith to create something like a record of account information of registered users on Supabase cloud for my application. Now the record is stored in a Table in Supabase Cloud called "users", there are several columns: id, email, firstName, lastName, role, phone and createad_at Now using the API endpoint I am trying to retrieve the "role" of the registered user from Supabase Table "users". Therefore, the following picture shows the API endpoint that I entered. However, upon running this function I do not get any response that I am expecting in either the "Table" tab or the "JSON" tab. I have attached the picture, so if you could please help me out with this that'd be great. Thank you
    g
    • 2
    • 4
  • Has anyone ever connected Supabase to ToolJet
    s

    sinrabo

    03/21/2023, 8:43 AM
    I want to try connect supabase with tooljet. But it connect faild in db server. Have anyone do this before?
  • Is it necessary to store user_id in client state?
    j

    jimbo123

    03/21/2023, 9:22 AM
    I have a table where one column is a required relationship to a user ID. Users can insert into the table but the relationship must be to their own user ID. Im using this RLS policy on insert:
    (auth.uid() = user_id)
    I'm passing
    user_id
    from the client with
    supabase.from("mytable").insert({ name: "foo", user_id: state.id });
    This is working but it feels redundant to store the user's ID in application state given its already part of the authentication system. Is my approach considered best practice or is there a better way?
    n
    s
    • 3
    • 5
  • Signups not allowed for otp
    k

    kresimirgalic

    03/21/2023, 9:29 AM
    Hey guys, i am doing OTP with sms and i passed the options shouldCreateUser to false and it gives me an error like this, here is my implementation of code:
    Copy code
    const { data, error } = await supabase.auth.signInWithOtp({
        phone,
        options: {
          shouldCreateUser: false
        },
      });
    Phone param is coming from the function i am calling, so you got the point. This issue is really crucial for the app i am doing right now, and i didnt found the answer. Do i need to setup something in the dashboard? I am using this version "@supabase/supabase-js": "^2.12.0",
    s
    g
    • 3
    • 9
  • Supabase auth jwt issue
    s

    STILLWATER;

    03/21/2023, 10:13 AM
    How to debug jwt issue of supabase auth? We are usign supabase for authentication? How does supabase issue jwt tokens and is it stored somewhere in db for me to debug from server side.
    n
    • 2
    • 12
  • Password resett TS error for accessToken
    v

    Vimes

    03/21/2023, 10:56 AM
    Trying to make a password-reset page. As I am an idiot that dosen't know how to code I follow guides in the internet. But TS says that accessToken is "Type 'string' has no properties in common with type 'UserAttributes'" Is there some new way to pass accessToken? Couldn't find anything in the cocs This is my attempt so far (gets data from a form, using react-hook-forms)
    Copy code
    js
      const accessToken = router.query.access_token as string;
      const supabase = useSupabaseClient();
      const supaResett: SubmitHandler<FormValues> = async ({ password }) => {
        console.log("Inni supareset");
        supabase.auth
          .updateUser(accessToken, { password }) <- TS says I can't use accessToken here
          .then(() => {
            console.log("User password updated");
          })
          .catch(() => {
            console.log("Feila Γ₯ oppdatere bruker passord");
            setState("default");
          });
        return <p>Test</p>;
      };
    s
    • 2
    • 8
  • How to access/view Materialized View in Supabase dashboard?
    s

    sleepyhairman

    03/21/2023, 10:58 AM
    I try to run SQL that created a Materialized View and it works but it doesn't appear in the table editor tab. Meanwhile if I created a View instead, it appeared in the table editor. I want to see the result of Materialized View.
  • Supabase emails block by gmail provider
    c

    Cadavreux

    03/21/2023, 11:01 AM
    Hello guys, it seems that emails send throught supabase templates for password recovery, account creation etc are not receive (neither in spam nor im messages) for corporate gmails account. Any idea what could go wrong?
    s
    g
    • 3
    • 6
  • updatePassword() does not work (Refine, MUI, NextJS)
    b

    bono

    03/21/2023, 11:15 AM
    Hello everyone! The updatePassword() function does not work on my project. After I submit the new password, the old one is not changed to the new one. Is there something wrong in my code?
    Copy code
    javascript
    forgotPassword: async ({ email }) => {
        const { error } = await supabaseClient.auth.resetPasswordForEmail(
          email, { redirectTo: "http://localhost:3000/update-password" }
        );
    
        if (error) {
          return {
            success: false,
            error,
          };
        }
    
        return {
          success: true,
        };
      },
      updatePassword: async ({ newPassword }) => {
        const { data, error } = await supabaseClient.auth.updateUser({ password: newPassword, });
    
        if (error) {
          return {
            success: false,
            error,
          };
        }
    
        return {
          success: true,
          redirectTo: "/",
        };
      }
    s
    • 2
    • 4
  • OTP Email not working
    m

    MrWhite

    03/21/2023, 1:18 PM
    Greetings I am attempting to reset the user email using an otp. I have changed my Reset Password email template in the Supabase to use {{ .Token }} instead of {{ .ConfirmationURL }}. When submitting the request using "requestPasswordForEmail", I get the email but without the OTP. Am I missing Something? Thank you
    s
    • 2
    • 2
  • Is there a way to run edge functions with the debugger active?
    d

    Dan Rumney

    03/21/2023, 1:37 PM
    Deno supports the V8 debugger protocol which is IP based so should be accessible from outside the container. Is there a way to enable this currently?
    • 1
    • 1
  • How do you parse XML strings in Edge functions?
    l

    lake_mattiato

    03/21/2023, 1:51 PM
    I tried the DOMParser, xml2js, but it always throws an error saying that either another dependency is not installed or not defined...
  • Url not redirecting
    n

    NJβ„’

    03/21/2023, 2:26 PM
    i am providing url in options but the email that I am being redirected to is the same as the local host. It gets fixed when i switch the site url in url configuration tab. Need help with that!
    g
    • 2
    • 25
  • Pass custom query params in auth redirect url?
    y

    YourAverageTechBro

    03/21/2023, 2:32 PM
    Hey everyone. I'm trying to pass in a specific redirect url for the user on a successful authentication. Current behavior: 1) User goes to
    abc.com/auth?state=abc
    to sign up for an account 2) On successful sign up, the user is redirected to
    abc.om/auth#
    Desired behavior: 1) User goes to
    abc.com/auth?state=abc
    to sign up for an account 2) On successful sign up the user is redirect to
    abc.com/auth?state=abc
    In the auth process is there any way to send the
    stateId
    in the sign up process for social auth (primarily Google, FB, Apple) as well as email sign up?
    a
    • 2
    • 7
  • Connection Issues Between PostgREST and Database
    f

    ffkml

    03/21/2023, 2:43 PM
    I'm seeing intermittent connection issues when making requests with
    supabase-js
    which seem to look like connection issues between the
    postgrest
    container and the
    postgres
    container. ## To Reproduce I'm running a self-hosted docker instance of Supabase. Some requests come back with the following errors:
    Copy code
    { code: '', details: null, hint: null, message: '' }
    Copy code
    {
      code: 'PGRST001',
      details: 'no connection to the server\n',
      hint: null,
      message: 'Database client error. Retrying the connection.'
    }
    Looking at the logs for PostgREST I saw the following:
    Copy code
    09/Mar/2023:13:12:17 +0000: Attempting to connect to the database...
    10.0.12.24 - service_role [09/Mar/2023:13:12:17 +0000] "POST /foo_table HTTP/1.1" 503 - "" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
    ## System information - OS: Alpine Linux / Docker - Version of supabase-js: 2.10.0 - Version of Node.js: 16 ## Additional context FWIW - I've also seen some console errors in the UI portion of the app that also have 503 codes related to supabase queries/operations. I suspect these are related.
    s
    • 2
    • 3
  • Type Error: Type instantiation is excessively deep and possibly infinite.
    a

    Ames Dean

    03/21/2023, 3:04 PM
    Hello Supabase peeps! I was wondering if anyone else has seen this issue from the generated type file from supabase? I have several columns with nested jsonB data, some of which are arrays of json. The issue seems to be with the generated Json type as shown in the pic, specifically the last union of the type, eg
    | Json[]
    . When this is removed, the error disappears with seemingly no side effects. Does anyone happen to have any insight into this? Thanks! Jim
    b
    • 2
    • 13
  • pgsodium with RLS is causing permission denied errors
    t

    Terminal

    03/21/2023, 3:20 PM
    I've got a table
    some_connections
    which has RLS enabled with a policy
    Copy code
    SQL
    CREATE POLICY "Enable all acitons for authenticated users only" ON "public"."some_connections"
    AS PERMISSIVE FOR ALL
    TO authenticated
    USING (true)
    WITH CHECK (true)
    However, when calling
    await supabase.from('some_connections').insert(someConnectionDetails);
    I am receiving
    Copy code
    {
      error: {
        code: '42501',
        details: null,
        hint: null,
        message: 'permission denied for function crypto_aead_det_encrypt'
      },
      data: null,
      count: null,
      status: 403,
      statusText: 'Forbidden'
    }
    On this table I am also using pgsodium to perform cell encryption with a trigger on a column
    key_id
    Copy code
    sql
    DECLARE
      key_record pgsodium.valid_key%ROWTYPE;
    BEGIN
      SELECT * INTO key_record FROM pgsodium.create_key();
      RETURN key_record.id;
    END;
    What might be causing this permission denied error
    g
    h
    • 3
    • 3
  • Project ref for localhost?
    q

    Quazar

    03/21/2023, 3:54 PM
    I'm following the excellent guide https://blog.logrocket.com/using-edge-functions-supabase-complete-guide/ and got to the part where we deploy a local enviro https://blog.logrocket.com/working-supabase-studio/#installing-supabase-studio-locally Studio runs fine (so slick!) . I am struggling to understand how to link to localhost
    supabase link --project-ref <your-project-ref>
    Will eventually figure it out eventually but could use some help. Thanks!
    • 1
    • 7
  • Listening to realtime postgres changes doesnt fire on saving json column
    r

    rbl

    03/21/2023, 4:16 PM
    I have a column of type
    jsonb
    and I update it with a json object. Realtime isn't firing an update on the json change. It also doesn't return back jsonb columns in the insert as well.
    g
    • 2
    • 4
  • Failed to run sql query: operator does not exist: uuid = bigint
    p

    Paradox

    03/21/2023, 4:35 PM
    I am trying to run this SQL query to create RLS policies and I'm encountering the error
    Copy code
    Failed to run sql query: operator does not exist: uuid = bigint
    I want to simply allow all registered users to be able to create messages, read and update them. SQL isn't my strongest point and I'm new to Supabase but I can't seem to work out why this is throwing the error, are you not allowed to use the ID for the user that has a Data Type of
    Copy code
    bigint
    in this way?
    Copy code
    sql
    create policy "Allow logged in read access" on public.messages using (auth.role() = 'authenticated');
    create policy "Allow individual insert access" on public.messages for insert with check ( auth.uid() = id );
    create policy "Allow individual update access" on public.messages for update using (auth.uid() = id )
    g
    • 2
    • 11
  • Client-side error when expanding row details
    u

    π–˜π–šπ–—π–Œπ–Žπ–Šπ–‡π–”π–Ž | Drooler

    03/21/2023, 5:06 PM
    currently experiencing a client side error (attached)... when clicking on a row's expand icon to open the row details/information... i've tried logging out & restarting my browser... but it keeps throwing the error 😭
    g
    • 2
    • 3
  • Edge Functions Get User
    f

    florian.megamind.solutions

    03/21/2023, 5:08 PM
    I am trying to get the calling user in an edge function. I am calling the function via supabase.js, but whenever I try to get the user on the server side, i get a null response. Here is my code: Call in frontend: const permissionData = await supabase.functions.invoke('permissionCheck'); EdgeFunction: import { serve } from "https://deno.land/std/http/server.ts"; import { createClient } from 'https://esm.sh/@supabase/supabase-js@2'; import { corsHeaders } from './cors.js' serve(async (req: Request) => { if (req.method === 'OPTIONS') { return new Response('ok', { headers: corsHeaders ,status : 200}) } // Check if the request has a valid Authorization header const authHeader = req.headers.get("Authorization"); if (!authHeader || !authHeader.startsWith("Bearer ")) { return new Response("Wrong auth", { headers: { ...corsHeaders, 'Content-Type': 'application/json' }, status: 401 }); } const supabaseClient = createClient( supabaseUrl,supabaseKey, { global: { headers: { Authorization: req.headers.get('Authorization')! } } } ) const { user, error } =await supabaseClient.auth.getUser(); ... even if i pass the jwt token directly to the auth.getUser() method I get a null response any help would be appreciated πŸ™‚
    g
    j
    • 3
    • 5
  • Is using plain text with supabase auth functions secure?
    r

    Rytterboi

    03/21/2023, 5:10 PM
    As the title im a bit confused whether using the supabase auth functions with plain text is the way im meant to setup auth? I havent been able to find anything in the docs about this. Do i need to encrypt the password parameter client side or i giving it to the supabase auth function as plain text secure in and of itself?
    g
    • 2
    • 1
  • Change login method to Supabase
    b

    battlesheep123

    03/21/2023, 5:20 PM
    This question is about the login to the Supabase account. Is it possible to change the authentication method from "GitHub" to "Email and Password"?
    g
    • 2
    • 3
  • How to check if auth.uid() is defined?
    p

    pakkerr

    03/21/2023, 5:21 PM
    The reason for this is that querying the following table is returning nothing with the following RLS policies applied. See screenshots below for my tables and RLS. I'm using Next.js on the frontend. I suspect that auth.uid() is undefined because when I hard code the values into the query it works.
    g
    • 2
    • 10
1...174175176...230Latest