https://supabase.com/ logo
Join DiscordCommunities
Powered by
# help-and-questions
  • Nothing happens when inserting: no error, nor data
    o

    ola berglund

    05/22/2023, 6:29 PM
    As seen by the logs on Vercel. Any ideas?

    https://cdn.discordapp.com/attachments/1110273262816075786/1110273263294222356/image.pngβ–Ύ

    https://cdn.discordapp.com/attachments/1110273262816075786/1110273263659143319/image.pngβ–Ύ

    g
    • 2
    • 65
  • Sharing types between app frontend code and deno edge functions in vscode
    t

    taylor

    05/22/2023, 6:59 PM
    I recently watched this video on setting up a vscode workspace to have both app code (e.g. React Native) and supabase edge function definitions:

    https://www.youtube.com/watch?v=lFhU3L8VoSQ&t=621sβ–Ύ

    I'd really like to find a way to share typescript types between the app and edge function code and be able to click through references with vscode. Is this possible, given the separate language server configuration?
    g
    • 2
    • 3
  • Is it insecure/bad to allow read access to join tables
    h

    Hugos

    05/22/2023, 7:00 PM
    I have join tables setup and to add RLS to it i get a bunch of recursion errors, not matter what I try it seems to be impossible to achieve what I want, but maybe I don't need to be this 'secure', so my question is, is it safe to enable 'select' access to everyone on a join table?
    g
    • 2
    • 1
  • How do I get the file contents using storage?
    l

    limitlessloop

    05/22/2023, 8:14 PM
    I'm a bit confused about how I can retrieve a file's content or url of a file using the JavaScript API. This is what I have:
    Copy code
    js
    const { data, error } = await supabase
      .storage
      .from('snippet_thumbnails')
      .list('private')
    but from what I can tell, it doesn't return a url or content. What am I missing?
    g
    • 2
    • 2
  • [RESOLVED] Listen to New User in realtime
    l

    LittlePinkCookie

    05/22/2023, 8:41 PM
    Hey, I am trying, on server side (with Service Role key) to listen on new user creation - I activated Real time on auth.users table - I set up a listener on it
    Copy code
    js
    export const listenUsers = (onChange: (payload: RealtimePostgresChangesPayload<User>) => void) => {
        supabaseClient.channel('users')
            .on('postgres_changes', { event: '*', schema: 'auth', table: 'users' }, onChange)
            .subscribe()
    }
    
        listenUsers(async (change) => {
            // New user has been created
            if (change.eventType === 'INSERT') {
                console.log("πŸš€ ~ file: events.ts:17 ~ listenUsers ~ change:", change)
                // some actions
            }
        })
    But the output of the console log is
    Copy code
    πŸš€ ~ file: events.ts:17 ~ listenUsers ~ change: {
       schema: 'auth',
       table: 'users',
       commit_timestamp: null,
       eventType: 'INSERT',
       new: {},
       old: {},
       errors: [ 'Error 401: Unauthorized' ]
     }
    How can I achieve that ? Thanks in advance 🀞
    g
    a
    c
    • 4
    • 6
  • Help width files upload
    o

    osamita

    05/22/2023, 9:02 PM
    is there a way to upload many files with only one request?
    g
    z
    • 3
    • 5
  • Can we get an auth quick start for Qwik?
    m

    Mr.Furious

    05/22/2023, 9:08 PM
    Pretty please?!
    o
    g
    • 3
    • 4
  • Is supabase email signup method slow by itselft or am I using it wrong?
    l

    Lyingcap

    05/22/2023, 9:13 PM
    When I try to signup the user with the supabase.auth.signUp() method, it takes almost 2 seconds to do the operation, can someone help me with this? When the user try to submit the form with the email and password , it calls this function: const handleSignUp = async () => { if (validaForm()) { let { error } = await supabase.auth.signUp({ email: email, password: senha, }); if (!error) { setIsOK(true); setAlert({ type: "", message: "" }); } else { setAlert({ type: "warning", message: "Verifique as credenciais e tente novamente.", }); } } }; basically the validaForm() just validade if the inputs are not null and call for another function that checks if there's another instance of user with the same email as the inserted now.

    https://cdn.discordapp.com/attachments/1110314634474422325/1110314634583478302/image.pngβ–Ύ

    g
    • 2
    • 46
  • Failed to delete user: update or delete on table "users" violates foreign key constraint "objects_ow
    f

    formigueiro

    05/22/2023, 9:45 PM
    I cant delete user, im getting this error
    Failed to delete user: update or delete on table "users" violates foreign key constraint "objects_owner_fkey" on table "objects"

    https://cdn.discordapp.com/attachments/1110322447615525036/1110322448408260628/image.pngβ–Ύ

    g
    • 2
    • 9
  • Supabase Auth with Redux Toolkit
    p

    pshushereba

    05/23/2023, 12:53 AM
    I was wondering if there were any examples from the Supabase team for setting up Supabase Auth with React and Redux Toolkit? I could really use a template to follow for making sure that I have things setup the right way.
    g
    • 2
    • 2
  • How to pass arguments using Function editor
    m

    mephiles

    05/23/2023, 2:25 AM
    Hi, I am quite new in Supabase and would love to connect the db through rpc. I am quite lost in passing arguments when creating new function using Function editor (Database > Functions > Add A New Functions). I am familiar with sql, not plpgsql, and I have limited knowledge on postgreSQL. Based on the attachment, I managed to get the correct record if I didn't include the WHERE statement. I also got error of
    Failed to create function: failed to create pg.functions: column "id" does not exist
    , maybe it's because the Id field is Primary key somehow? πŸ‘€ I don't know. :/ Any hints about passing the arguments? In the advanced settings, I've select: Language = sql Behavior = stable

    https://cdn.discordapp.com/attachments/1110392997578805248/1110392997725618206/Screenshot_2023-05-23_100948.pngβ–Ύ

    g
    • 2
    • 2
  • Help With HTTP Request in Powershell
    n

    Nixelite

    05/23/2023, 2:39 AM
    How to get specific row using powershell http request?
    Copy code
    powershell
    $apiKey = "MY-SECRET-API-KEY"
    $baseUrl = "https://<MY-SECRET-SUPABASE-PROJECT>.supabase.co"
    $endpoint = "MY-SECRET-ENDPOINT"
    
    $headers = @{
        "apikey" = $apiKey
        "Authorization" = "Bearer $apiKey"
    }
    
    $response = Invoke-RestMethod -Uri "$baseUrl/rest/v1/$endpoint?select=key" -Method GET -Headers $headers
    $response | ConvertTo-Json
    I'm using this, then it returns
    Invoke-RestMethod : The remote server returned an error: (404) Not Found.
    g
    • 2
    • 2
  • Supabase with Custom Backend
    c

    confidential

    05/23/2023, 3:10 AM
    Im building an app in golang using custom api, database migrations, everything. I find that auth is a pain to deal with and supabase has that all setup for me and also has a managed database in postgres. However I have custom functionality for my golang backend and thats what im familiar with. How would I manage to use the auth and database features but also use my golang api for other parts of the app besides the basic auth so I have fine grained control over my app and what i return in JSON requests instead of using purely RLS to manage that
    e
    • 2
    • 1
  • Error Running Edge Functions that connect to REST endpoint locally
    m

    mdc405

    05/23/2023, 3:57 AM
    hey all - I'm trying to run an edge function locally and have it connect to my local supabase stack but get the following error:
    error trying to connect: tcp connect error: Cannot assign requested address (os error 99)
    I've started by supabase stack and the edge function is issuing a simple
    await supabase.from('foo').select('id').eq('id', 'a')
    The REST query that's generated is
    http://localhost:54321/rest/v1/foo?select=id&id=a
    and this route is accessible from a browser but my edge function is failing to make this call. The full error is:
    Copy code
    TypeError: error sending request for url (http://localhost:54321/rest/v1/foo?select=id&id=a): error trying to connect: tcp connect error: Cannot assign requested address (os error 99)
    I'm invoking the function via
    supabase functions serve foo-function --env-file ./supabase/.env.local
    And my .env.local contains
    SB_URL=http://localhost:54321
    and I'm initializing the supabase client in my function via:
    const supabase = createClient<Database>(supabaseUrl, supabaseAnonKey)
    Been trying to figure this out but not sure where to start. Help!
  • Permission denied for Postgres trigger
    t

    TrashPanda

    05/23/2023, 5:52 AM
    Hi there, I'm trying to create a trigger that insert a new row into
    user_profile
    table whenever a new user is signed up. The triggered function is
    Copy code
    BEGIN
      INSERT INTO public.user_profile(id) VALUES(new.id);
      RETURN new;
    END;
    I have tried disable the
    user_profile
    RLS and this is the error I'm getting.
    permission denied for table user_profile
    Not sure what I might be doing wrong here?
    n
    g
    • 3
    • 8
  • Api key security
    f

    Fatih G.

    05/23/2023, 8:46 AM
    I am working with three different api in my project. Can I store the keys securely in supabase?
    r
    v
    g
    • 4
    • 3
  • Typed edge functions in js-client
    t

    TheRien

    05/23/2023, 9:04 AM
    Is there any way of getting types for my edge functions in the js-client? For example if I call
    await this.supabaseService.supabase.functions.invoke('create-user')
    I would love to have a typed response. I type my edge functions explicitly so that's not the problem. Can I somehow generate these types or otherwise write them manually? I have the
    database.types.ts
    but that doensΒ΄t cover it
    r
    v
    • 3
    • 12
  • Unexpected number of rest requests
    y

    YANN

    05/23/2023, 9:04 AM
    Hello supabase, today while checking my cloud supabase logs I saw that I had over 100k rest requests over the last hours, which is quite anormal as it's not a production application and based on my useage. So I inspected the API edge network tab and I saw the attached image requests ``rest/v1/item``, which is a request being made in my UI on a component mounting.
    Copy code
    ts
    export function FloatingWindow({ inventoryIndex }: { inventoryIndex: keyof typeof proxies }) {
        console.log("rendering");
        const query = use(supabase.from("item").select("*"));
        if (!query.error) {
            for (const data of query.data as { type: number }[]) {
                proxies[inventoryIndex].set(`bags-${data.parent_slot}`, { slot: data.parent_slot });
            }
        }
    
        return <div></div>;
    }
    The rendering log of this component and is being called 2 times only (2 because of react strict mode), but you clearly see that there is more than 17 rest endpoint calls being made, my item table contains only 1 item, am I missing something obvious ?

    https://cdn.discordapp.com/attachments/1110493535649660938/1110493536027160646/image.pngβ–Ύ

    r
    • 2
    • 3
  • ~is dashboard currently down?~ (Solved due to network issue)
    m

    mephiles

    05/23/2023, 9:06 AM
    πŸ‘€
    r
    • 2
    • 11
  • Explain analyze fails with 'None of these media types are available: application/vnd.pgrst.plan+text
    a

    avalanche

    05/23/2023, 9:41 AM
    I'm trying to execute this line of code:
    Copy code
    typescript
      const { data, error } = await supabase.rpc('search_context', {
        database_id: databaseId,
        embedding: `[${embedding.join(',')}]`,
        match_count: 10,
        match_threshold: 0.5,
        min_content_length: 1,
      }).explain()
    I'm hoping to get analyze result to investigate performance issues with my rpc funciton but instead I get error: 'None of these media types are available: application/vnd.pgrst.plan+text; for="undefined"' Query works as expected if I remove .explain() function
    g
    • 2
    • 7
  • Need help following docs (SvelteKit TypeScript + Supabase Auth)
    c

    Cokaps016

    05/23/2023, 12:13 PM
    So I follow this guide on [Supabase Docs](https://supabase.com/docs/guides/auth/auth-helpers/sveltekit#set-up-the-supabase-client) but I get this error when run `pnpm dev`:
    Copy code
    powershell
    TypeError: getSession is not a function
        at load (D:/Hobby/thuchanh/src/routes/+layout.server.ts:5:20)
        at Module.load_server_data (D:/Hobby/thuchanh/node_modules/.pnpm/@sveltejs+kit@1.18.0_svelte@3.59.1_vite@4.3.8/node_modules/@sveltejs/kit/src/runtime/server/page/load_data.js:57:41)
        at eval (D:/Hobby/thuchanh/node_modules/.pnpm/@sveltejs+kit@1.18.0_svelte@3.59.1_vite@4.3.8/node_modules/@sveltejs/kit/src/runtime/server/page/index.js:150:41)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
    When I come to the step Send session to client, the whole things break (500 - Interval issue) and I get error above. Even when I finish step: Generate types from your database, the issues isn't fixed. Sorry if this sound noob because Im a self-learn dev and I've just learnt abt supabase for a week
    j
    g
    • 3
    • 24
  • DB change subscriptions not working with RLS enabled
    g

    Geoff

    05/23/2023, 12:19 PM
    Hi there, I know this kind of problem has been reported before but having Googled for hours no solution I've found seems to help me here. I am building a multi-tenant app, and storing the
    tenant_id
    for each user in their
    raw_user_meta_data
    . I'm then using the following function for row-level security:
    Copy code
    DROP FUNCTION IF EXISTS current_tenant_id();
    CREATE OR REPLACE FUNCTION current_tenant_id() RETURNS integer
        LANGUAGE "plpgsql" SECURITY DEFINER SET search_path = public
        AS $$
            DECLARE retval jsonb;
        BEGIN
          select coalesce(raw_user_meta_data->'tenant_id', null) from auth.users into retval where id = auth.uid();
          return retval::integer;
        END;
    $$;
    The policy I'm using is as follows:
    Copy code
    DROP POLICY IF EXISTS "Enable tenant-based access" ON test;
    CREATE POLICY "Enable tenant-based access" ON test USING (tenant_id = current_tenant_id());
    ALTER TABLE test ENABLE ROW LEVEL SECURITY;
    When subscribing to all changes, the only events that fire are those for
    delete
    (which bypasses RLS). If I temporarily disable RLS from the dashboard I get events for
    insert
    and
    update
    too, but only until I reenable RLS. This is driving me nuts as I really need both real-time updates and RLS. Any help gratefully received. Thanks, Geoff
    g
    s
    • 3
    • 15
  • SAML 2.0 SSO With MS Azure AD and Supabase - How to Query Microsoft Graph after successful Login?
    r

    Razoth

    05/23/2023, 12:33 PM
    i've implemented SAML 2.0 SSO with Azure AD for my companies intranet application, which is writting in nextjs 13. It works flawlessly and finaly gives to ability to get the optional claims right, for seamless authorization based on User Department. The Problem that remains is, how would i query the Microsoft Graph API after the successfull Login? I would love to implement a Dashboard Inside the Application but for that, i need to fetch more data from different Microsoft endpoints and have the credentials for that. I've found a solution with the msal-browser library, using the instance.ssoSilent function to get a token, to query Graph with. But that is basicly 2 Auth's within the Website, which seems unnessesary and comes with problems. do you guys have any other idea, am i missing something? this is basicly the only remaining problem for this Application to finally have a solid enough base to build amazing features on top of. All through slightly off topic. thank you.
    g
    t
    • 3
    • 20
  • returning empty data with variable
    f

    formigueiro

    05/23/2023, 12:58 PM
    Copy code
    sql
    select subscriptions->'FREE'
    from config
    order by created_at desc
    limit 1;
    when i run this query, is cathing data from database, but if i put
    into whatever_variable
    im getting empty row
  • Postgres error logs not loading
    b

    bdz

    05/23/2023, 1:49 PM
    I am trying to debug an issue and the error logs are timing out.
    Copy code
    {
      "code": 504,
      "errors": [],
      "message": "Backend query timeout! Optimizing your query will help. Some tips:\n\n- `select` fewer columns. Only columns in the `select` statement are scanned.\n- Narrow the date range - e.g `where timestamp > timestamp_sub(current_timestamp, interval 1 hour)`.\n- Aggregate data. Analytics databases are designed to perform well when using aggregate functions.\n- Run the query again. This error could be intermittent.\n\nIf you continue to see this error please contact support.\n",
      "status": "TIMEOUT"
    }
    I have the default "last hour" checked however when I limited it to just an hour, i get the same error.
    s
    r
    • 3
    • 7
  • refresh token
    t

    Thiago

    05/23/2023, 2:37 PM
    Hello everyone, I have an expired token issue when I log aut, I am sending the prints of my method, and the dio interceptor, to try to refrsh, but I still get a 401 error.

    https://cdn.discordapp.com/attachments/1110577344239910983/1110577344374120538/image.pngβ–Ύ

    https://cdn.discordapp.com/attachments/1110577344239910983/1110577344629968906/image.pngβ–Ύ

    https://cdn.discordapp.com/attachments/1110577344239910983/1110577344869056542/image.pngβ–Ύ

    g
    • 2
    • 20
  • Realtime events returns 401
    a

    AstroBear

    05/23/2023, 3:12 PM
    I'm trying to use realtime on a table inside the public schema like so:
    Copy code
    ts
        supabaseServiceClient
          .channel('postgres_changes')
          .on(
            'postgres_changes',
            {
              event: 'INSERT',
              schema: 'public',
              table: 'ChatMessage',
            },
            (payload) => {
              console.log(payload);
            }
          )
          .subscribe();
    But when an event occurs, the payload contains the following:
    Copy code
    ts
    {
      schema: 'public',
      table: 'ChatMessage',
      commit_timestamp: null,
      eventType: 'INSERT',
      new: {},
      old: {},
      errors: [ 'Error 401: Unauthorized' ]
    }
    g
    • 2
    • 9
  • seed.sql auth.uid()
    m

    mdc405

    05/23/2023, 4:08 PM
    Is there a way to set the logged in user context when the seed file is run when working locally? I have several triggers that depend on the auth.uid() being set - but as far as I can tell when the seed.sql is run there's no value for the auth.uid(). If this isn't possible, has anyone found a way to seed data or disable the triggers during the seeding process?
    n
    g
    • 3
    • 14
  • [RESOLVED] When running edge functions locally: Cannot assign requested address (os error 99)
    m

    mdc405

    05/23/2023, 4:15 PM
    When running an edge function locally that makes a connection to my local supabase database, I get this error: Error: error sending request for url (http://localhost:54321/rest/v1/foo?select=id&id=abc): error trying to connect: tcp connect error: Cannot assign requested address (os error 99) In my edge function I'm setting up a regular supabase connection:
    Copy code
    const supabase = createClient<Database>(supabaseUrl, supabaseAnonKey, {
          global: {
            headers: { Authorization: req.headers.get('Authorization')! },
          },
        })
    This function works fine if I don't make this supabase query.. but that query is important πŸ™‚ Help!
    • 1
    • 1
  • Database storage sizes confusion
    k

    kevlust

    05/23/2023, 4:47 PM
    Hi all! I'm in the process of putting together a social app that I'm hoping to scale big time, and Supabase has been a massive help in this. But I'm running into a bit of a head-scratcher. My table rows seem to be taking up way more space than I expected. Does anyone have any advice on how to optimize this? Take this for an example: I've got a
    new_users
    table set up with 4 columns: 2 bigints, 1 timestamp, and 1 uuid. From my understanding, these should be pretty lightweight, right? But according to Supabase, each row is taking 24kb. I was thinking more like 48 bytes total for all this, so I'm intrigued as to how we arrive at the 24kb figure, which is about 500 times larger than my original estimate. While testing, my app has been storing some pretty basic data, and I've seen that my database space usage has already hit about 100mb. If I carry on at this pace, I'll reach 10gb with just 100 average users like me. Now when I look at the Pro plan, with its 8gb database and room for 100,000 monthly active users, I'm left scratching my head a bit. With the way things are going, how would it be possible to house 100,000 average users within that 8gb limit? Looking forward to your insight on this. If there's a way I can be more efficient with my data storage, I'm all ears! Appreciate any advice you guys can share. Cheers! πŸ™Œ
    n
    g
    • 3
    • 12
1...223224225...230Latest