https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Prevent Deletion in UI
    t

    tsnakejake

    05/25/2023, 4:34 PM
    Hello! I was wondering if there is a toggle of sorts that prevents batch deletion in the Supabase UI, to prevent things like accidentally deleting a ton of rows

    https://cdn.discordapp.com/attachments/1111331534327263262/1111331534528581745/image.png▾

    g
    • 2
    • 1
  • Unable to access project
    p

    prashant

    05/25/2023, 4:41 PM
    Hoping I can get some help from folks here... - Been developing on Supabase for about 6 weeks... - This morning, get a pop-up/message in browser saying no projects found... - Refresh - same result - Log out and try to log back in - invalid credentials - Try to get reset email - been waiting for > 20 min - no email Completely DoA right now... Thanks so much for your help in advance
    j
    g
    • 3
    • 8
  • can't get the code from resetPasswordForEmail
    m

    microbinson

    05/25/2023, 4:45 PM
    Hi. I'm using resetPasswordForEmail, which is sending me an email as expected. The link takes me to my nominated callback function, but const code = url.searchParams.get('code') gets me nothing. Although the docs state that "The query parameter is always code" there is no such query parameter on the url that I am seeing. const next = url.searchParams.get('next') returns my next function ok. There is a long hash tag - "#access-token=". Can anyone help/advise me? Thanks!!
    s
    m
    • 3
    • 13
  • Why supabase auth not provide this in session?
    v

    vikay

    05/25/2023, 5:03 PM
    Hello, why are the supabase auth discord scope guilds data of the user not exist in session?
    g
    • 2
    • 1
  • JS Api DB select types
    j

    Jaba

    05/25/2023, 5:03 PM
    Hi I'm doing a nested query that looks like this ``.select(, lesson:lesson_id(, course: course_id(*))); `` But i'm getting a typeScript error later in my code that is saying course can be of type single or array. How do I either tell typescript or supabase that this is a many to one relationship and course will should always be a single instance rather than an array?
  • i created this function, but im getting ``"No operator matches the given name and argument types. Yo
    f

    formigueiro

    05/25/2023, 5:23 PM
    Copy code
    sql
    DECLARE
      slash_position INT;
      value int;
      entry_id int;
    BEGIN
      -- Encontra a posição da última ocorrência do caractere '/'
      slash_position := strpos(reverse(new.short_url), '/');
      
      -- Extrai o valor após a última ocorrência do caractere '/'
      value := reverse(substring(reverse(new.short_url) from 1 for slash_position - 1));
    
      select id 
      from url_data 
      into entry_id
      where slug = value;
    
      update public.report_data
      set id = entry_id
      where id = new.id;
    
      RETURN new;
    END;
    erro :
    "No operator matches the given name and argument types. You might need to add explicit type casts."
    g
    • 2
    • 33
  • Run SQL editor with API?
    m

    MarkeD

    05/25/2023, 6:19 PM
    Hello Supabasers 🙂 I wondered if it was possible to run the SQL I use in the webUI via SQL Editor > New Query via the API? Python preferably. I don't want to insert data, but programmatically setup a table and search function. Is it possible?
    g
    • 2
    • 8
  • how to make sure that only the user which uploaded the file can access it from the bucket?
    h

    harshcut

    05/25/2023, 6:26 PM
    is there a way to store user information on files? or vice versa?.
    g
    • 2
    • 1
  • app.supabase.com - fetching tables -Error: [500] An error has occurred: Failed to fetch
    j

    justifi

    05/25/2023, 6:28 PM
    I am unable to use the dashboard/supabase studio. Whenever I go to any of the pages under the 'Database' icon (https://app.supabase.com/project/my_project_id/database/), there are a number of API calls to the
    pg-meta
    service They all work fine except for
    /tables
    , e.g https://api.supabase.io/platform/pg-meta/my_project_id/tables I consistently get the same error. Using the logs, I identified the query that's called from
    pg-meta/tables
    ( see below ) When I run it in my SQL editor, its taking >30 seconds - is the 500 Error caused by a timeout on the query? I played around with the last line of the query, excluding various schemas to identify the bottleneck. I am using supabase as my database for a Strapi instance (headless CMS with lots of relations), and that schema is taking nearly 15 seconds on its own. What are my options here? I'd like to be able to use the supabase dashboard - I use Supabase Webhooks to notify external systems of changes to my CMS.

    https://cdn.discordapp.com/attachments/1111360080433139783/1111360080697372722/image.png▾

    https://cdn.discordapp.com/attachments/1111360080433139783/1111360081775304744/message.txt
    g
    • 2
    • 3
  • iPhone Flutter App Connection refused with local Supabase CLI
    b

    bmahr

    05/25/2023, 7:23 PM
    Since today I can’t connect my flutter app anymore to, on my Mac hosted, local dev supabase instance. I get a connection refused error. iPhone is coupled via cable. URL is http://localhost:54321 and the anonkey is also correct. This was always working before. Not sure if the flutter upgrade today could be the reason but I doubt it a bit Anyone who knows how to fix this?
    • 1
    • 1
  • Failed Enrollment in Multi-Factor Authentication for SvelteKit App
    t

    terrxo

    05/25/2023, 7:43 PM
    I'm currently working on adding multi-factor authentication to my SvelteKit app, but I've encountered an issue. I'm not sure how to handle the situation when a user leaves or refreshes the site before completing the verification of the MFA challenge by scanning the QR code and inputing the verification code for enrollment. In my code, I need a way to determine whether the user has left or refreshed the site before successfully verifying the MFA challenge. The problem is that when I call the enroll function to add another factor, it doesn't automatically remove the previous unscanned factor. So, I'm looking for an effective way to handle this situation and detect if the enrollment process has failed. Could anyone please provide some guidance on how to approach this?
  • If I trust the API key holders is it okay to disable RLS?
    s

    Sebsa

    05/25/2023, 8:01 PM
    The tables are only acsessed by a discord bot hosted on a single instance that I control personally. I'm not afraid anyone will steal the api key. Is it then okay for me to disable RLS, knowing nobody else can acsess the databse, or are there any threats I do not know about?
    • 1
    • 1
  • Using `current_date` in Supabase JS
    z

    zerefati

    05/25/2023, 8:38 PM
    Is it possible to use below query in supabase JS select * from visas where current_date - country_arrival_date >= 30;
    g
    • 2
    • 4
  • Having trouble with Auth on Next.js 13 app router
    f

    f41z37

    05/25/2023, 8:44 PM
    I have followed the guide pretty much to the tee and still having a problem, when I am trying to sign a user up with the supabase.auth.signInWithPassword(), I am getting a 500 error on client console. I am trying to do this in a client components but perhaps it's my lack of knowledge, but would really like help on it.
  • Schema is not correctly loaded
    f

    floitsch

    05/25/2023, 8:54 PM
    When starting the database with
    supabase start
    the schemas are not correctly loaded. I used to get
    FAILED: 500 - Database error querying schema
    when accessing the database the first time after a restart. That wasn't a huge problem, as the next call would then usually work. (I'm guessing the error triggered a reload). However, since I added an edge function to my setup, I can't access the functions through the usual RPC calls anymore. (Interestingly, the edge function has full access to all functions). Only when I reload the cache (either using
    docker kill -s SIGUSR1 <container>
    or using
    NOTIFY pgrst, 'reload schema'
    from studio) can I access the functions again. I tried to add
    NOTIFY pgrst...
    to my seed script, but that didn't help. Does anyone have a tip on how I could easily reload the schema? I'm running the self-hosted supabase as part of testing, and I would need to do this in an automated way. Setup: - Supabase version 1.50.12 - Archlinux (fully up to date) - the supabase instance has non-standard ports.
  • Following managing environments docs immediately results in failed migrations
    f

    francis

    05/25/2023, 9:02 PM
    The docs in question: https://supabase.com/docs/guides/cli/managing-environments Running
    supabase db remote commit
    immediately generates a migration which cannot be applied (EDIT: to an instance started via the supabase cli) and fails. The offending line is:
    CREATE EXTENSION IF NOT EXISTS "supabase_vault" WITH SCHEMA "vault";
    This fails in the type generation CI with:
    Error: ERROR: extension "supabase_vault" is not available (SQLSTATE 0A000)
    .
    • 1
    • 2
  • Uploading a csv via API
    h

    Hugo Peran

    05/25/2023, 9:09 PM
    Hello, csv import is not working for me, so i had to use the API for importing. Here's a part of my code. process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY); fs.createReadStream('transformed-results-test.csv') .pipe(csv()) .on('data', async (row) => { const newCompany = { first_name: row.first_name || 'N/A', last_name: row.last_name || 'N/A', job_title: row.job_title || 'N/A', reworked_job_title: row.reworked_job_title || 'N/A', skills: row.skills || 'N/A', past_company: row.past_company || 'N/A', company_city: row.company_city || 'N/A', company_linkedin_url: row.company_linkedin_url || 'N/A', revenues: row.revenues ? parseInt(row.revenues) : null, funding: row.funding ? parseInt(row.funding) : null, company_description: row.company_description || 'N/A', company_secondary_industry: row.company_secondary_industry || 'N/A', tags: row.tags || 'N/A', }; const { data, error } = await supabase.from('prospects').insert(newCompany).select(); if (error) { console.log(
    Error inserting data: ${error.message}
    ); } else if (data && data.length > 0) { data.forEach((record) => { console.log(
    Inserted company data: ${JSON.stringify(record)}
    ); }); } else { console.log('No data inserted'); } }) .on('end', () => { console.log('CSV file successfully processed'); }); Terminal response in the first comment
    g
    s
    • 3
    • 7
  • Anyone else not able to connect to their project?
    b

    bennettcolecohen

    05/25/2023, 10:10 PM
    Not sure if anyone else is having this issue, but I'm unable to connect to my project ... tried a few different networks
    g
    • 2
    • 1
  • There is a way to enable unstable flag to Edge Functions?
    t

    thαwαn

    05/25/2023, 10:17 PM
    I need to make authenticated fetch API calls through TLS using certificates, the only way that I found to make it is to use the unstable
    Deno.createHttpClient
    function. It works locally, but when I deployed to supabase at runtimes it throws an error
    Deno.createHttpClient is not a function
    . My guess is that it may be that supabase edge functions by default do not come with the
    unstable
    flag as
    true
    . Is there a way to make this work?
    o
    • 2
    • 5
  • Nextjs Auth helpers code in url after middleware redirect
    d

    D3R1K

    05/25/2023, 10:35 PM
    I'm following the example code from auth-helpers nextjs server components example, after successful google authentication the app redirects to my dashboard page from a middleware function . The thing is, I can see the auth code in my url search params. Is there a reason why this happens? I would like to avoid this if possible. Any help would be appreciated import { createMiddlewareSupabaseClient } from '@supabase/auth-helpers-nextjs'; import { NextResponse } from 'next/server'; import type { NextRequest } from 'next/server'; `// this middleware refreshes the user's session and must be run // for any Server Component route that uses
    createServerComponentSupabaseClient
    export async function middleware(req: NextRequest) { const res = NextResponse.next(); const supabase = createMiddlewareSupabaseClient({ req, res }); const { data: { session } } = await supabase.auth.getSession(); if (!session && req.nextUrl.pathname.startsWith('/required-session')) { // Auth condition not met, redirect to home page. const redirectUrl = req.nextUrl.clone(); redirectUrl.pathname = '/dashboard'; redirectUrl.searchParams.set(
    redirectedFrom
    , req.nextUrl.pathname); return NextResponse.redirect(redirectUrl); } return res; }` https://github.com/supabase/auth-helpers/blob/main/examples/nextjs-server-components/middleware.tsx

    https://cdn.discordapp.com/attachments/1111422411062124594/1111422411338944592/image.png▾

    u
    s
    • 3
    • 3
  • How do I use supabase_admin in local development? I need superuser in local dev.
    o

    ostoto

    05/25/2023, 10:41 PM
    See subject
  • Billing by Database Write?
    g

    Grantly

    05/25/2023, 11:11 PM
    I am trying to make an architectural decision and I cannot figure out if Supabase bills by Database write (as firebase did). Will "Database Egress" be modulated by Database writes? 💵
    g
    • 2
    • 5
  • problems with foreign key query
    u

    .Volxen

    05/25/2023, 11:32 PM
    i am trying to select a user row from a users table that has a column with an id in it that refrences to an id in another table which has name column and etc. How do i fetch the user from users table and have the name values of the other table using the foreign key

    https://cdn.discordapp.com/attachments/1111436686153486439/1111436686610661376/image.png▾

    https://cdn.discordapp.com/attachments/1111436686153486439/1111436686946209902/image.png▾

    u
    • 2
    • 1
  • PostGres Function to update table.
    x

    xdcx18

    05/26/2023, 1:01 AM
    So I want to update a column ("quantity") in the table grocerystores anytime there is an insert, update ,or delete on the grocerystoreitems. Right now the first query does successfully return the SUM of the quantity field in the grocerystoreitems. However when I run this I get an error "Invalid SQL query" error. Right now I just want to make sure the function works by calling it in the SQL editor and then I am going to set up a trigger on it.
    Copy code
    sql
    CREATE OR REPLACE FUNCTION update_quantity(storeId bigint)
    RETURNS void
    LANGUAGE plpgsql
    AS $$
    BEGIN
      BEGIN;
        SELECT SUM(quantity) AS total_quantity
        INTO total_quantity
        FROM public.grocerystoreitems 
        WHERE "storeId" = storeId AND quantity > 0;
    
        UPDATE grocerystores
        SET quantity = total_quantity
        WHERE Id = storeId;
    
        COMMIT;
      END;
    $$;

    https://cdn.discordapp.com/attachments/1111459092783968317/1111459093224378388/Screenshot_2023-05-25_at_7.58.09_PM.png▾

    u
    g
    • 3
    • 23
  • Storage v3 resumable uploads on localhost?
    s

    scook

    05/26/2023, 1:07 AM
    Hello! Recently I reached out to support and got our project enabled for early access to storage v3 resumable uploads. I tested out the simple Uppy example from the blog post (https://supabase.com/blog/storage-v3-resumable-uploads) in our app. On the staging environment, which is the project that was enabled by support, it's been working great! However, the same code is not working on local. Here's the relevant snippet:
    Copy code
    const uppy = new Uppy()
      .use(Webcam, {
        modes: ['video-audio', 'audio-only']
      })
      .use(Audio, {
        showAudioSourceDropdown: true
      })
      .use(Tus, {
        endpoint: `${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/upload/resumable`,
        headers: {
          authorization: `Bearer ${process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY}`
        },
        chunkSize: 6 * 1024 * 1024,
        allowedMetaFields: [
          'bucketName',
          'objectName',
          'contentType',
          'cacheControl'
        ]
      });
    On staging,
    NEXT_PUBLIC_SUPABASE_URL
    is
    https://<my-project-id>.supabase.co
    , whereas on local it is
    http://localhost:54321
    . Locally, the upload results in
    net::ERR_CONNECTION_REFUSED
    . Is it possible to get the local instance to support the same? Am I able to do whatever it is support did for the staging instance but for my local? Thanks.

    https://cdn.discordapp.com/attachments/1111460646131875892/1111460646744240228/Screenshot_2023-05-25_at_5.56.21_PM.png▾

    s
    • 2
    • 1
  • Supabase Auth Handler to temporarily fix the Supabase Python module's broken token and auth issues
    k

    kal

    05/26/2023, 1:10 AM
    Hey fellow Python Supabase enjoyers (TLDR: skip to bottom for fix), I was tired with Supabase-py's poor documentation and getting a working solution for proper auth that doesn't break constantly so I made a custom class that should hopefully help solve these issues: https://github.com/supabase-community/supabase-py/issues/272 https://github.com/supabase-community/supabase-py/issues/185 https://github.com/supabase-community/supabase-py/issues/247 https://github.com/supabase-community/supabase-py/issues/440 I haven't added a workaround for https://github.com/supabase-community/supabase-py/issues/395, but if anyone would like to adapt it into the code on the gist you can see a workaround for it here: https://github.com/supabase-community/supabase-py/issues/399. This also won't solve the issue with redirect_to, as that is an issue with python gotrue's base64 encoding/decoding (https://github.com/supabase-community/gotrue-py/issues/246), but that should hopefully 🤞 get fixed soon since a fix was just merged to gotrue-py's main branch. __**TLDR: auth_handler function to Depend on https://gist.github.com/0xDeadcell/884fc080b9fd49a9721cffec09ef95c3**__
  • wrong result on plpgsql
    f

    formigueiro

    05/26/2023, 1:28 AM
    Copy code
    sql
    DECLARE
      entry_count int;
      total_urls integer;
      current_type url_type;
    BEGIN
    
      -- Obtém o subscription_tier do usuário associado à nova URL
      select COUNT(*) - 1
      into entry_count
      from url_data e
      where e.user_id = new.user_id AND e.type = 'free';
    
      -- Verifica se o total de URLs é menor ou igual a 10
      IF total_urls <= 10 THEN
        current_type = 'free'::url_type;
      ELSE
        current_type = 'payed'::url_type;
      END IF;
    
      -- raise exception 'total_urls %', total_urls;
    
      update public.url_data
      set type = current_type
      where id = new.id;
    
      RETURN NEW;
    END;
    i checked total_urls value so even that i have less 10 im getting payed on the table
    g
    • 2
    • 2
  • Questions about when a user's email is considered "confirmed"
    d

    da newb

    05/26/2023, 2:26 AM
    We are using Supabase with Next.js as an admin dashboard and an API server. I want to use Supabase's auth system for 2 things: 1. I can pre-create a user's account by supplying an email address and some long random password. Then I can send them a password reset link for them to claim their account. 2. I can detect whether a user has confirmed their email address My questions are: (A) Can I send a user an email confirmation and have that set their
    email_confirmed == true
    , while still allowing them to sign in with their account even before email confirmation? (B) What columns in the database are set when a user confirms their email address? If I were to check just one DB column, which one should I check? (C) Can I consider the database table for
    auth.users
    (or a view of that table) stable in terms of an API? AKA can I rely on it for important auth decisions, or must I rely on Supabase SDKs? (C) If a user changes the email address for the
    auth.user
    entry, does the new email become "unconfirmed"? (D) Do OAuth signups automatically set the underlying email address as confirmed? (E) Can I have a successful password reset move an email address from unconfirmed to confirmed? This would be necessary for goal (1) that I'm trying to achieve above. Thanks.
    g
    • 2
    • 4
  • database irresponsive
    a

    AD DAB

    05/26/2023, 6:33 AM
    anyone know why would this happen? my database is dead and not responsive, i tried restarting the database and even the whole project but no luck, been this way for an hour or so rn, any help??

    https://cdn.discordapp.com/attachments/1111542491452297226/1111542491586510888/image.png▾

    s
    r
    • 3
    • 2
  • How to create a parameterized View?
    i

    Indic Software

    05/26/2023, 6:48 AM
    Hi, I want to create a parameterized view in which when it is called one has to pass it parameters that will be used for filtering data in where clause. How can we create a parameterized view?
    s
    • 2
    • 1
1...226227228229230Latest