https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • signInWithOtp sends OTP code even if the user does not exist
    y

    yog

    03/06/2023, 10:29 PM
    I am trying to set up a simple React Native app that lets a user sign in with a Phone Number and then sends them a OTP to complete the sign in process. I was expecting this method of sign in to avoid the user having to sign up since if their account does not exist then we can use create one for them since we have all of the information we need. However I noticed that I am unable to sign in with
    signInWithOtp
    and would receive an error saying:
    This account does not exist
    . I can work around this issue by calling a signUp method if
    signInWithOtp
    fails because the user doesn't have an account, but it sends the OTP so it would be very confusing to the user (and to me) why they are receiving a password to log in when they don't even have an account registered. I guess my question is how can I check if a user has an account or not before I let them sign in?
  • Next 13 not getting user already registered error
    r

    Rake

    03/06/2023, 10:47 PM
    I'm using the next js auth helpers and when signing up with an email that was used in an account created 3 days ago, I'm not getting the user already registered error like I used to when not using next. Can anyone give me a hand? I also received a sign up confirmation email for each time I ran this function. Could this be the reason? This is how I'm signing up.
    Copy code
    tsx
        const { data, error } = await supabase.auth.signUp({
          email: event.target.email.value,
          password: event.target.password.value,
          options: {
            data: {
              username: event.target.username.value,
              pro: false
            }
          }
        });
    I've also noticed this doesn't actually sign me in... I would appreciate some help with that too
    g
    d
    • 3
    • 8
  • Are functions by default, transactions that can be rolled back?
    d

    DYELbrah

    03/06/2023, 10:51 PM
    When I define a procedure, I can specify points of roll back, save points and so on. After noticing that the supabase generated types don't support stored procedures, I switched my procedure to a function. Now I'm curious if by default functions are transactions, meaning that if a step in the middle of the function fails, zero changes will be applied?
    g
    • 2
    • 9
  • extending Supabase API routes, or creating new ones?
    s

    ShashanKaf

    03/06/2023, 10:53 PM
    I need to create an endpoint to check Stripe payment intent, right now I've done that through an express server while I have a Supabase backend as well. Is there a way to create an endpoint in Supabase for that so I won't need an extra server? If so how ? I'm using React Native in the frontend. Thanks
    • 1
    • 1
  • Authentication -> Settings not available (NOT self hosted project)
    z

    zciwor

    03/07/2023, 1:01 AM
    I am trying to set up SMS OTP log in for an existing project, but having trouble enabling the feature. I am following this guide in the documentation: https://supabase.com/docs/guides/auth/phone-login/twilio My dashboard does not have the Authentication -> Settings option available for some reason. Do I need to be on a higher pricing tier? (currently on a free tier). I attached a screen shot of my authentication settings page. It does not match what is shown in the documentation. Am I missing an obvious setting somewhere? I am NOT self hosting, my project is configured in the cloud based solution.
    g
    • 2
    • 5
  • Infrastructure as Code or at least something that comes close to
    p

    pax

    03/07/2023, 1:07 AM
    I would like to describe and provision my managed Supabase.com services (db, functions, buckets, etc) using Terraform or somehow else. Also I'd like to configure these services, like being able to enable Row Level Security or setting up secrets using code. I don't think it's possible yet out of the box. A solution for me would be to write a custom bash / nodejs script that uses Supabase CLI + Supabase Management API to achieve this. Do you have any suggestions how i should approach this problem? I would gladly open source the result. I'm trying to pitch Supabase to a client and he asks for stupid-simple IaaC, like just replacing project name, db name, token, etc, then
    ./do-supabase-up
    . Whatever user action is available in the supabase admin UI, i want to access that through code Thanks
  • Usage limits, scaling, constraints, locks. Supa as alternative to event-driven architecture
    p

    pax

    03/07/2023, 1:34 AM
    I'm trying to pitch Supabase to a client, as an alternative to a pure cloud event-driven architecture. I'm trying to find documentation on how Supabase could handle load. I imagine that I can just call the Supabase JS client each time i want to do a read or write. So no pub/sub/queues involved. Can I hit any walls? Thanks
  • My project's API url isn't working due to invalid certs -- "Connection reset error" :(
    s

    Spidey

    03/07/2023, 2:00 AM
    Unfortunately, users for my project can no longer login due to my Supabase project URL not working (seems like an expired cert on Supabase's end that is causing the connection reset error), and I already filed a support case for this. I'm also a Pro subscriber. Is there anything I can do for this? 😭
    s
    • 2
    • 1
  • signInWithOAuth not using redirectTo option
    t

    th_m

    03/07/2023, 4:42 AM
    Has anyone experienced this / have a work around?
    g
    a
    • 3
    • 8
  • Authentication question "Waiting for verification.." Is it possible to approve from Flutter?
    t

    Tonkatsu

    03/07/2023, 5:29 AM
    I'm working on flutter and superbase. I am using email & password login and have "Confirm email" enabled. Is it possible to approve a user in the "Waiting for verification.." state from Flutter? I want to save the trouble of preparing and authorizing email addresses when debugging. But I want to enable "Confirm email".
  • supabase.auth.signOut() Freezing React App
    y

    Yu

    03/07/2023, 6:30 AM
    Hello, I just started learning Supabase today and am having some trouble. I am able to login to my web app, but when I press the signout button, it causes the entire app/tab to freeze. The logout works properly, because once I create a new tab, it shows that I am logged out and can no longer access the protected page. Here is my code:
    s
    • 2
    • 10
  • CASL implementation
    n

    NJ™

    03/07/2023, 6:43 AM
    I am trying to use supabase with CASL but i don't know if the library supports postgres db. Has anyone used CASL with supabase before i am unaware on where to start #1006358244786196510
    g
    n
    • 3
    • 22
  • How do I swap supabase remotes for a migration
    d

    Drip

    03/07/2023, 7:08 AM
    I have a dev and prod env that are represented as different projects in Supabase. I'm able to apply my migrations to dev, but when I try to apply them to prod, I see "Linked project is up to date.". How can I change my remote project via the cli so that I can run
    supabase db push
    on prod as well to keep it in sync
    s
    ł
    • 3
    • 7
  • select query on rows that have null in a certain column
    a

    awucado

    03/07/2023, 7:33 AM
    i was trying a query like this but its not fetching anything,
    s
    g
    • 3
    • 2
  • error: duplicate key value violates unique constraint "cartItems_pkey1"
    a

    Amara

    03/07/2023, 8:23 AM
    I save data on my database that has an RLS feature of authenticated users can only insert, update, and delete their data, this works well. When I save data on the database, I check if any data with that id exist; if it does, increase the quantity, if it doesn't create on the database. This works great, however, I realise that if an authenticated user saves an item with an id on the database, another user cannot save the same data with the id on the database, because it looks like it is a duplicate even though this is from another user. How can I combat this please?
    g
    • 2
    • 3
  • How to import nodemailer package to edge function?
    l

    lake_mattiato

    03/07/2023, 8:42 AM
    Cant find out how to import packages to supabase edge functions
    c
    g
    • 3
    • 10
  • sign up on fresh install of edge function examples app returns 'invalid authentication credentials'
    d

    debrijja

    03/07/2023, 9:02 AM
    Email address is valid and password has capitals and punctuation if thats even necessary (i tried a bunch of different passwords and email combinations), but still no luck. My end goal is to locally test my edge functions with authentication/rls enabled so i can get the user id, generate some data, and then read/write to the database accordingly. Shouldn't be this hard even for supabase noobs like me. skip the rest if u dont care how i got here Forgive me if I'm a bit frustrated but I've been trying to test my edge function for a week now. I can easily run an edge function that doesn't require authentication but as soon as I added that development came to a screeching halt. The docs have many dead ends, the tutorial playlist doesn't even have the [invoke video](

    https://www.youtube.com/watch?v=7JEzp21Zi-8▾

    ) (this is what im following along with) in it so i didn't even know there was a pre-made project to try out these examples, and then the react app has broken dependencies which i had to fix myself. And now I can't even get the example code to work bc the sign up seems broken also, let alone test the edge function that I'm writing for my job. I think the straw that broke the camels back was having to wait 10 mins for no reason to post my question in this server. apologies again but I'm at my wits end and any help would be appreciated. i just want to test a 40 line edge function with rls pleeeeease.
    g
    • 2
    • 3
  • Container ID 1389985163 cannot be mapped to a host ID
    k

    kaaloo

    03/07/2023, 9:07 AM
    I keep getting the following error when running
    supabase start
    with recent versions of the CLI (1.42.1 in this case installed via npm)
    Copy code
    failed to register layer: Error processing tar file(exit status 1): Container ID 1389985163 cannot be mapped to a host ID
    Retrying after 8s: public.ecr.aws/supabase/storage-api:v0.29.1
    v0.29.1: Pulling from supabase/storage-api
    • 1
    • 1
  • Structure JSON return to be one nested object instead of multiple
    v

    Vimes

    03/07/2023, 9:09 AM
    I have a query where I return user data, hours used in projects and audits (I sell audits) a customer has bought. Ideally I want to show all of this on one page and I'm trying to write a query to get all of it. But because I have to audits for my test user I get two results with a bunch of duplicate data. Can I structure the SQL/Query in some way that I get first_name last_name audits { {audit_name, audit_slug} {audit_name, audit_slug} } instead of two seperate objects returned My query:
    Copy code
    sql
    CREATE VIEW kundeportal as
      SELECT 
        audits.audit_name, 
        audits.slug as audit_slug, 
        timepott.name as timepott_name, 
        taas.description,
        profiles.first_name,
        profiles.last_name,
        profiles.organization,
        profiles.id,
        organizations.slug
      FROM profiles
      RIGHT JOIN timepott
      ON profiles.organization = timepott.organization
      RIGHT JOIN taas
      ON profiles.organization = taas.organization 
      RIGHT JOIN audits
      ON profiles.organization = audits.organization 
      RIGHT JOIN organizations
      ON profiles.organization = organizations.slug 
      WHERE profiles.organization = organizations.slug 
      AND profiles.id = auth.uid();
  • Cant send email from multiple smtp clients via Edge function, but can send from python.
    l

    lake_mattiato

    03/07/2023, 10:49 AM
    Getting the following error:
    Copy code
    "Connection refused (os error 111)"
    This is the code:
    Copy code
    js
    import {serve} from "https://deno.land/std@0.131.0/http/server.ts"
    import {createClient} from 'https://esm.sh/@supabase/supabase-js@2'
    import { SmtpClient } from "https://deno.land/x/smtp/mod.ts";
    
    const corsHeaders = {
      'Access-Control-Allow-Origin': '*',
      'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey'
    }
    
    const getUser = async(supabase, email) => {
      let { data, error } = await supabase
          .from('user_data')
          .select("*")
          .eq('email', email)
    
      if (error) return null
    
      return data
    }
    
    
    serve(async (req) => {
      const supabase = createClient(
          Deno.env.get('SUPABASE_URL') ?? '',
          Deno.env.get('SUPABASE_ANON_KEY') ?? '',
          { global: { headers: { Authorization: req.headers.get('Authorization')! } } }
      )
    
      try {
        const data = await req.json()
    
        const targetEmail = data.target_email
        const userData = await getUser(supabase, data.source_email)
    
        const code = userData[0].invitation_code
    
        const client = new SmtpClient();
    
        await client.connectTLS({
          hostname: "smtp.gmail.com",
          port: 587, // tried port 465 aleady
          username: "wasta.noreply@gmail.com",
          password: "password",
        });
    
        await client.send({
          from: "wasta.noreply@gmail.com", // Your Email address
          to: "example@mail.com", // Email address of the destination
          subject: "Mail Title",
          content: "Mail Content,maybe HTML",
        });
    
        await client.close();
    
        await client.close();
    
        return new Response(
            JSON.stringify(message),
            { headers: { "Content-Type": "application/json" } },
        )
      } catch (error) {
        return new Response(JSON.stringify({ message: error.message }), {
          headers: { ...corsHeaders, 'Content-Type': 'application/json' },
          status: 400
        })
      }
    })
    Any idea how to fix this?
    s
    g
    • 3
    • 8
  • Create a database webhook via the API
    a

    AndreMiras

    03/07/2023, 11:08 AM
    I'd like to store my webhooks as code and version it. So I'm wondering if there's a way to create/update webhooks using the API or at least export/import them.
  • Use a trigger to set another column value
    s

    schmay

    03/07/2023, 11:15 AM
    Hello, i'm struggling to figure out how to take one columns value and then do a replace or even multiple replaces on that column value and then set that value to another column. Scenario: Lets say I have a business name field and then want to create a friendly url for that name. I want to replace the & and any spaces. How would I go about doing that? Thanks!
    s
    • 2
    • 6
  • @supabase/auth-helpers-nextjs not working with offline_access scope on Azure
    r

    Razoth

    03/07/2023, 11:24 AM
    Still having the Issue that after Updating User's Metadata i am unable to login, is there any way to debug
    Copy code
    @supabase/auth-helpers-nextjs
    ?
    s
    • 2
    • 31
  • How to best do multiple queries on same page
    v

    Vimes

    03/07/2023, 11:25 AM
    I can't combine data from a join in a way that makes sense to me, so I thought i'd run two queries instead of one. currently doing this,
    Copy code
    js
    const { data: profile, error } = await supabase
        .from("profiles")
        .select(
          `id, first_name, last_name, organization(name, umbraco_id, umbraco_url, slug)`
        )
        .single();
    
        const { data: taas } = await supabase
        .from("taas")
        .select(
          `*`
        );
    But using this method I Cannot access error more than once, so I can only get error from the first query. how can I handle this?
    s
    • 2
    • 2
  • How does the mapping work in Storage .
    k

    killerthief

    03/07/2023, 1:04 PM
    So I am creating an web3 application where there is not authentication required , it is taken care from the wallet providers . I want to have an avatar(profile picture) option where the user choose's to upload an image and upon logging in with his wallet he gets to see his avatar the time he time he set
    i
    • 2
    • 3
  • RLS policy for inserting new item
    j

    joaquimley

    03/07/2023, 1:09 PM
    Before my question, I know this can be done with a "function" but due to business rules I can't leverage it. I'm trying to create an item in
    table_b
    that has to match two values:
    table_a.id = id
    (new item in
    table_b
    will have the same
    id
    as in
    table_a.id
    Tried to ref:
    new.id
    and simply
    id
    but both fail, Here's the failing insert in
    table_b
    CHECK:
    Copy code
    sql
    EXISTS(
      SELECT table_a.id, table_a.user_id
      FROM table_a
      WHERE (table_a.user_id = auth.uid())
      AND table_a.id = <table_b.id|id|new.id>
    )
    The last condition is of showing all the options I've tried, not that is is a valid check.
  • SQL error => column reference \"created_at\" is ambiguous
    k

    kresimirgalic

    03/07/2023, 1:17 PM
    Hey, i have custom function with select query and i got an error "column reference \"created_at\" is ambiguous". Any help with it?
    Copy code
    CREATE OR REPLACE FUNCTION get_threads(userId uuid) 
    RETURNS TABLE (
        id uuid,
        user_id uuid,
        whom uuid,
        subject TEXT,
        created_at timestamp with time zone
    ) AS $$
    BEGIN
        RETURN QUERY 
            SELECT 
                DISTINCT ON (t.id)
                t.id, 
                t.user_id, 
                t.whom, 
                m.message AS subject,
                t.created_at AS thread_created_at
            FROM 
                threads t
                JOIN threads_message m ON t.id = m.thread_id
            WHERE 
                (t.user_id = userId OR t.whom = userId)
                AND m.created_at = (
                    SELECT 
                        MAX(created_at)
                    FROM 
                        threads_message
                    WHERE 
                        thread_id = t.id
                )
            ORDER BY 
                t.id, m.created_at DESC;
    END;
    $$ LANGUAGE plpgsql;
    g
    • 2
    • 1
  • Not able to Set up Project in Local to contribute in open source for Supabase
    v

    Vishruta Patil

    03/07/2023, 2:28 PM
    I'm currently working on an issue of Supabase repository for which I need to set up the project (dashboard) in the local. But on local, default project is not getting connected. Due to which I'm not able to work on the dashboard. Permission is disabled as shown in the attached image. Also in the networks tab I checked, rest API is getting 404 error and query is giving 400 error Can someone please help me in this so that I continue working on the issue?
    h
    k
    • 3
    • 24
  • Failed to get project subscription: Subscription not found
    s

    Saylessss

    03/07/2023, 2:56 PM
    In Dashboard settings, I get this error toast when I enter the billing page
    Failed to get project subscription: Subscription not found
    This is not limited to just the billing page as other features also do not load because the subscription endpoint returns a 404. This impairs me from using Auth providers as well as many other features. I do not know what the problem is. I am on a free tier but have put my card on file. I wanted to make a support request, but it wouldn't even let me do that because of this error! ![image](

    https://user-images.githubusercontent.com/38445041/223458122-84b60a9f-b1cc-48b4-9f11-bb4f948ac702.png▾

    )
    g
    • 2
    • 9
  • signInWithOAuth - where are `options. queryParams ` documented
    t

    th_m

    03/07/2023, 4:32 PM
    Is there a standard that defines what queryParams would do in relation to OAuth? The other options here https://supabase.com/docs/reference/javascript/auth-signinwithoauth I can reason about, but queyrParams is so broad and generic I am wondering what it is even for or what I could do with it. If someone can point me to some reading that would be extremely helpful
    s
    • 2
    • 2
1...157158159...230Latest