https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Request that returns random rows
    m

    MaGnezij

    10/27/2022, 7:49 AM
    Hello, im trying to create a GET request that returns 5 random rows from the table. Is there a query parameter that I can use for selecting 5 random rows? Thanks!
    s
    • 2
    • 2
  • question about pg_cron best practice
    f

    flapili (FR, bad EN)

    10/27/2022, 8:23 AM
    Hi, I'm creating a product with a http probe feature each X minutes I must probe urls and insert in a table the http_status and the error for that website
    • 1
    • 2
  • How does Supabase mesh with backends?
    n

    nitehawk

    10/27/2022, 8:55 AM
    Hiya While I'm using Supabase with success for small and easy things, in the long term I want to involve it in more advanced features. For example I'd like to have a backend that will perform a couple of database operations on behalf of a user, collate and transform the results, and return that. I get the feeling that Supabase was designed to be called from frontend and mobile programs and I should approach this differently, but I don't really know how. I thought I would just make requests to my backend with the logged in user's JWT, and use that to authenticate requests to Supabase, but it's hard to pull off. Is this something idiomatic or should I just use postgres-side logic and edge functions for more complicated logic? Are there any examples of using Supabase with backends?
    n
    u
    a
    • 4
    • 6
  • Error using Auth from supabaseauth-ui-react with github provider
    h

    Ham

    10/27/2022, 12:01 PM
    As mentioned, when using the Auth component from supabaseauth-ui-react with github provider throws an error in the console when inspecting the page. See images for code and the error.
    s
    • 2
    • 1
  • pg_cron job_run_details clean up...
    g

    GaryLake

    10/27/2022, 12:29 PM
    Hopefully a quick/easy one – I've enabled pg_cron on platform via the UI – everything is running nicely but I wonder – is there anything set up in the background in terms of a default to clean up the job_run_table – or is this my responsibility? Cheers Gary
    g
    f
    • 3
    • 4
  • What happens to non-verified accounts
    g

    glatocha

    10/27/2022, 1:15 PM
    Hi, I am using email signUp with email verification. What happens when the user never click on the link? I see a setting for OTP email to be valid 24h, but my user is "waiting for verification". Will this user be eventually removed? And most important, will the After Delete Trigger be called? Thanks in advance
    g
    • 2
    • 2
  • 'Direct' Postgres Connection - any way to ensure that access policies apply?
    t

    turner

    10/27/2022, 1:44 PM
    Hi, I want a direct connection from our custom API (built in Python with FastAPI) to Postgres, since it is a lot faster. Is it somehow possible to pass the
    access_token
    or any authentication to the db call's that trigger the policies configured in the Supabase dashboard? Or are the database policies only applied when using the Supabase API? Sorry if that's a dumb question, happy for your help!
    g
    • 2
    • 6
  • Looking for advise on architecture for a public form submission.
    b

    Brian

    10/27/2022, 3:23 PM
    I have a public form on my site for job application. I'm thinking I'll
    insert()
    directly from the client and set RLS to allow anyone to insert (seems dangerous though, even with a honeypot field). The form fields would insert into a temp table with a
    status
    of
    pending_verification
    . I'd then send an email verification to the form submitter (based on the email they supply). Once they click to verify the email, that will trigger a function which sets the
    status
    =
    verified
    . A db trigger can then take the data out of the temp table and
    insert()
    to all of the correct relational tables (application, customer, address, etc). Is this over engineering? How else can I secure this web form from spam? How could I better solve this use case?
    g
    • 2
    • 5
  • Validate Password on Password Update
    j

    James Q Quick

    10/27/2022, 5:22 PM
    I'm looking to do a password update for under a settings page. I want the user to enter their existing password and validate it before letting them update to a new password. However, I don't know how to validate that password. I thought I could just trigger a new sign in, which works if they enter the password correctly BUT if they enter their old password incorrectly it signs them out of the application which prevents them from trying again without having to sign back in.
    g
    • 2
    • 1
  • pgsql-http to GET and POST an image
    g

    GaryLake

    10/27/2022, 5:31 PM
    I need to do some basic image scraping. I will be receiving URLs of image assets from a clients' API and my plan is to park those URLs in the database and move on with things. Later on, I want come back around and using pg_cron and pgsql-http, scrape the images from the URLs I have and put in them into Supabase storage. This would be a doddle in an edge function and I'm already dealing with user uploads from forms in a Vue app using supabase-js – but I don't feel like this is going to work/be practical if I've got a few hundred new images to scrape and upload. Hence doing this in the background later using pg_cron and pgsql-http – in short I need to GET the image from a URL I have on file, and PUT it into Supabase storage, but from a database function called by pg_cron. I'm struggling with it tho. There's an example on the pgsql-http github that brings in a png and gets its content-type and size, and this works as expected when I dump it as is into a new SQL snippet in Supabase. But as soon as I put any other image URL in, it doesn't work.
    Copy code
    WITH
      http AS (
        SELECT * FROM http_get('http://httpbin.org/image/png') -- works, but no other url I does... 
      ),
      headers AS (
        SELECT (unnest(headers)).* FROM http
      )
    SELECT
      http.content_type,
      length(textsend(http.content)) AS length_binary,
      headers.value AS length_headers
    FROM http, headers
    WHERE field = 'Content-Length';
    So my question is two fold: 1) There's a general, "am I going about this the right way?" 2) Then to at least help me along my way, why does the pgsql-http example work with the example URL, but no others I try do?
    f
    m
    • 3
    • 24
  • Script tag inserted into emails
    r

    reed

    10/27/2022, 7:37 PM
    I recently customized the email template for my apps invite email. I noticed that if the email includes a
    <style>
    tag with css
    a bit of code including a script tag (below) gets included right above.
    Copy code
    <script src=3D"/cdn-cgi/apps/head/bnFc2aq0fsRO37Lg0zTgaqOnJ1E.js"></script>=
    Does anyone know why this is? Is it preventable? I think it's contributing to my emails getting caught in spam filters.
    f
    • 2
    • 6
  • How to reload Schema Cache
    l

    louwers

    10/27/2022, 7:40 PM
    Made a typo...
    g
    • 2
    • 1
  • How to show auth screen after user signs up and clicks magic email link.
    n

    nvr

    10/27/2022, 7:53 PM
    how can i "sign in" the user automatically after they click the email link, after i've called signUp()
    g
    d
    • 3
    • 73
  • Getting payload information for row that caused Supabase Database Webhook to execute
    g

    gtims123

    10/27/2022, 8:14 PM
    Hi, is there a way to get the payload information for whatever row caused a Supabase Database Webhook to execute? This article mentions something about the payload https://supabase.com/blog/supabase-functions-updates but I am not sure how to get this payload. The reason I need this info is so that when a row is INSERTed / UPDATEd I can send a push notification via one of my serverless endpoints with custom text related to the row that caused the supabase webhook to run.
    j
    • 2
    • 1
  • [Solved] Email Template in Local
    k

    komagata

    10/27/2022, 9:54 PM
    I know that you can edit the email template at supabase.com. Is there a way to edit the email template in a local environment?
    o
    s
    • 3
    • 3
  • How do i redirect with expo?
    n

    nvr

    10/27/2022, 10:31 PM
    How can I redirect back to my expo site after clicking signUp email link?
  • Fetching user by jwt as admin.
    s

    sudoramen

    10/27/2022, 11:11 PM
    In the docs, an example for Fetch the user object using the access_token jwt. is the same as the code example for Get user by id..
    Copy code
    js
    const { data, error } = await supabase.auth.admin.getUserById(1)
    I tried this with a valid token but get an error
    "user_id must be an UUID"
    . I'm assuming this line of code got copied over without being fixed, how can I get the user calling the edge function? (context: this is being used in an edge function) I also tried
    Copy code
    js
    const { data: { user } } = await supabase.auth.getUser(jwt)
    but get
    { data: { user: null }, error: AuthApiError { name: "AuthApiError", message: "Internal server error", status: 500 } }
    back.
    n
    j
    h
    • 4
    • 7
  • sql Scan error on column index 0, name aal converting NULL to string is unsupported
    h

    hyodo

    10/28/2022, 1:34 AM
    From this morning, when I called the /user endpoint of the auth API, I got the following error. What's causing this? {"component":"api","error":"sql: Scan error on column index 0, name \"aal\": converting NULL to string is unsupported","level":"error","method":"GET","msg":"Unhandled server error: sql: Scan error on column index 0, name \"aal\": converting NULL to string is unsupported","path":"/user"}
    g
    j
    • 3
    • 4
  • [SOLVED] No api key found - despite having api key in params
    a

    Askar

    10/28/2022, 3:21 AM
    I'm trying to create twitter authentication with supabase. I
    console.log
    both of the
    .env
    params and they did show up. So i'm not sure why I'm getting the error `{"message":"No API key found in request","hint":"No
    apikey
    request header or url param was found."}` when I try to authenticate with Twitter. .env
    Copy code
    js
    NEXT_PUBLIC_SUPABASE_URL="supabaseurl"
    NEXT_PUBLIC_SUPABASE_ANON_KEY = "anonkey"
    index.js
    Copy code
    js
    import supabaseClient from "../utils/supabaseClient.js"
    export default function Home(props) {
      async function signInWithTwitter() {
        const supabase = supabaseClient()
        console.log(supabase)
        console.log(process.env.NEXT_PUBLIC_SUPABASE_URL, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY)
        const { data, error } = await supabase.auth.signInWithOAuth({
          provider: 'twitter',
        })
        console.log(data, error)
      }
    return (<TwitterButton/>)
    utils/supabaseClient.js
    Copy code
    js
    import {createClient} from "@supabase/supabase-js"
    
    const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
    const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
    console.log("something", supabaseUrl, supabaseAnonKey)
    // const supabase = createClient(supabaseUrl, supabaseAnonKey); 
    
    export default function supabaseClient() {
        return createClient(supabaseUrl, supabaseAnonKey); 
    }
    j
    g
    v
    • 4
    • 28
  • Noob question do i need signup when using google sign in button?
    t

    Thoth Trismegistus

    10/28/2022, 5:18 AM
    I see that it create a new account when "sign in" with google.
    g
    a
    • 3
    • 4
  • Is it possible to migrate hosted service location?
    s

    Sacha

    10/28/2022, 8:45 AM
    I'm looking to migrate from US to EU my DB cluster, is it possible? Thanks!
    g
    • 2
    • 1
  • resetPasswordForEmail
    d

    Desmond

    10/28/2022, 9:12 AM
    Hi, I'm using Supabase for Flutter (v1.0.1), all functionality works fine, except resetPasswordForEmail. Here are some relevant code snippets:
    Copy code
    Supabase supabase = await Supabase.initialize(
        url: _config.databaseUri,
        anonKey: _config.databaseAnonKey,
    );
    _supabaseClient = supabase.client;
    and
    Copy code
    await _supabaseClient.auth.resetPasswordForEmail(email);
    Pretty much any other auth function works like a charm (our app also does signups, signins, database access, etc.), but
    resetPasswordForEmail
    always gives me a 500 from the server, "Unable to process request". Is there a configuration I'm overlooking? Is this a problem specific to our account? (I can probably make a minimal project to reproduce this issue, if anyone is interested) Many thanks!
  • type question with vscode
    f

    flapili (FR, bad EN)

    10/28/2022, 9:36 AM
    Hi, I generated types with the CLI but I don't know how to use it
    s
    • 2
    • 9
  • Is it possible to stop Supabase from logging so much?
    n

    nitehawk

    10/28/2022, 10:03 AM
    I noticed that Supabase keeps logs that store a concerning amount of data, that I don't want to see. It would be great if the only thing that I could see in the logs was just the fact that a request took place, without the location/IP details. This is both legally demanding, and disappointing from the privacy standpoint.
  • upsert() requires RLS SELECT operation?
    b

    Brian

    10/28/2022, 2:50 PM
    I've got a public contact form that writes directly from client to a table. Since it's public, I allow everyone to INSERT and UPDATE but I'd prefer to disable SELECT. I'm using the
    upsert()
    method since users can update fields (it's a multi-step form with incremental saves). It appears I have to enable a SELECT policy in order for the
    upsert()
    to work. Is this true? Any other way to secure the table data more? I am using
    { returning: 'minimal' }
    in my
    upsert()
    method but it still fails (violates row-level security policy) without the SELECT policy in place.
    g
    • 2
    • 1
  • Magic link sign with homescreen shortcut web apps possible?
    c

    Cheqo

    10/28/2022, 3:09 PM
    Hi, my primary goals was to have mainly passwordless signup, however does it work with PWA or simply home screen shortcut web apps? I have a web app saved to my iphone simulator homescreen and when I request for a magic link, I open my emails, click signin and then instead of signin me back to my "shortcut" app it takes me to a new page in safari instead. So, does it actually work with "shortcut" or native mobile apps?
    g
    • 2
    • 3
  • Twitter Auth with Nextjs tutorial?
    a

    Askar

    10/28/2022, 3:32 PM
    The current tutorial i found https://blog.avneesh.tech/how-to-add-twitter-auth-quickly-with-supabase-to-your-nextjs-site#heading-making-a-supabase-project seems to be out dated. Some of the functions are changed for supabase.auth, so I was wondering if there was an up-to-date tutorial on verifying twitters with supabase on Nextjs
  • how to filter records based on geo location
    s

    Siddharth

    10/28/2022, 4:08 PM
    I am only using the Rest API of Supabase as we query normally is there a way we can filter our records by geo location. Such as get all records whose address is within 100 km of Meow museum. Thanks, #1006358244786196510 #api
    g
    • 2
    • 7
  • google auth - supabase-ui is a must to get user data?
    a

    Aviv

    10/28/2022, 6:00 PM
    Stack: Next.js 12 After I use a google auth provider to sign in, I can't find any way to get the user data. I've tried: supabase.auth.currentSession || currentUser || user Is the problem with next.js, something about ssr and not csr? I've tried to use csr but maybe i did it wrong. It seems like supabase/ui has an "Auth" obj which you can use like this: const { user } = Auth.useUser() Is this the only way? I don't wanna install a whole new UI library just for that
  • supabase cli & SMTP configs
    i

    itisnajim

    10/28/2022, 6:41 PM
    how to add smtp variables while using
    supabase init
    &
    supabase start
    ? variables like user and pass!
    • 1
    • 1
1...555657...230Latest