https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Can you change supabase generated Json types?
    l

    Lukas V

    12/01/2022, 3:46 PM
    Hello, I generated db types with
    supabase gen types
    and at the moment I'm unsure what to do with
    Json[]
    types. Do I manually change that
    Json
    type to the actual structure that I use, or should I do something in supabase dashboard?
    t
    a
    r
    • 4
    • 15
  • How can I create conditional .eq filters?
    x

    Xki

    12/01/2022, 9:11 PM
    I have a
    .eq
    filter to filter to the ones where the condition is met. But if there is no value, I don't want it to filter. How can I achieve this?
    g
    c
    • 3
    • 4
  • Having trouble uploading a csv file
    m

    MATTI

    12/02/2022, 3:56 PM
    I am building a small app using storage. The only point of the storage is to store a single CSV file in a bucket. Sometimes it uploads correctly, other times it does not. When it doesn't work and I got to the file in the bucket it says that the file is 0 bytes in size. I will add some pictures to explain. Does anyone know why this might be? Feel free to ping me.
    g
    • 2
    • 7
  • Should I authenticate the user with Firebase and Supabase at the same time?
    w

    Wizzel

    12/05/2022, 6:16 PM
    I want to migrate the database part of my Firebase project to Supabase but I need to keep using Firebase Functions so I need to authenticate the user with Firebase. Is it recommended to authenticate the user with both Firebase and Supabase?
    m
    s
    • 3
    • 5
  • How to set claims on trigger supabase.
    i

    izurugi

    12/06/2022, 6:12 AM
    Hi, I'm trying to set the claims of newly registered user on supabase. I have figured I have to use trigger functions to set claims whether a new user is created/registered. Similar to handle_new_user function of user management starter in sql editor. I just thought of adding the line
    select set_claim(new.id, 'claims_admin', 'true');
    inside the handle user function to set the claim/update claims of registered users. But, I'm getting error whenever newly registered with that line added. I'm not sure what's the issue, I can't tell if its type error or the new object is not yet being created. https://github.com/supabase-community/supabase-custom-claims.
    n
    u
    +3
    • 6
    • 63
  • [Resolved] Rename a joined table inside a .select() ?
    a

    AB$TRACT

    12/06/2022, 6:16 PM
    Hi, I have this code that's working just fine:
    Copy code
    js
      const { data: country } = await supabaseService
        .from("country")
        .select("*, city(*)")
        .eq("slug", params!.country)
        .single();
    Is there a way to do something like
    city(*) AS cities
    without renaming my table ?
    g
    l
    • 3
    • 3
  • How to import local code into Deno function?
    d

    drewbie

    12/06/2022, 7:10 PM
    I am no table to import a local file into a Deno / Edge function. It allows me to import a local file as long as its within the supabase directory, but I am using a monorepo and am trying to import files and functions that are used in other places within the app. My example is pretty straight forward and I cant seem to figure out how to reused simple functions in an Edge function.
    packages/app/foo.ts
    Copy code
    export function foo() { return true; }
    packages/backend/supabase/functions
    Copy code
    import { foo } from 'app'; 
    TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'foo'.
    have also tried
    Copy code
    import { foo } from '../packages/app/foo.ts'
    and I get the same error.
    i
    d
    • 3
    • 3
  • Supabase Fetch Count Returns Null
    y

    Yeehawlerz101

    12/07/2022, 7:15 PM
    I'm using svelteKit (after the reactor) and I'm trying to get a count of my total entries in my table. here is the code:
    Copy code
    js
    export default async function load(){
    let { data: count, error } = await supabase
      .from('smsspam')
    // My table is named smsspam
      .select('*', { count: 'planned', head: true })
    // selecting all entries in the table and counting them, using head because I only want the count.
    //the results should look like:
    // {"count": 3,"status": 200, "statusText": "OK" } but returns null.
      console.log("Total Rows",count)
      if (error) {
    console.log(error.message);
    }
    return {
    props:{count}
    };
    }
    g
    • 2
    • 6
  • Export user token to other domain and login
    n

    Neyunse

    12/08/2022, 12:03 AM
    is there any way to login to the user account with the token? i have the form in auth.xxxxx.com and my idea is to login in account.xxxxx.com. I can't find an easy way to make a connection with the npm package in react js. both pages are connected to the same supabase project.
    g
    • 2
    • 20
  • Error api _supabase session 405 in Nuxt3
    m

    Mikemartin

    12/08/2022, 3:59 PM
    I have an error when i try to sign in with google in my app, when i already logged into my google account and i go back to my app with redirect, in browser console i get this error: POST https://mydomain.dev/api/_supabase/session 405 Uncaught (in promise) FetchError: 405 (/api/_supabase/session) at async Object.callback (entry.af57154f.js:5:118018) This only happens when I build my app and deploy it to Cloudflare Page or Netlify, everething works fine locally. The plugin that I'm using is @nuxtjs/supabase 3.0.0 and the Nuxt version is 3.0.0 stable
    p
    s
    s
    • 4
    • 6
  • Could not find storage.search
    l

    legenden

    12/09/2022, 7:19 AM
    When trying to hit the storage api
    storage/v1/object/list/{bucketId}
    With the following body:
    Copy code
    json
    {"limit":100,"offset":0,"sortBy":{"column":"name","order":"asc"},"prefix":"testpath"}
    I get the following error:
    Copy code
    json
    {
        "statusCode": "PGRST202",
        "error": "",
        "message": "Could not find the storage.search(bucketname, levels, limits, offsets, prefix, sortcolumn, sortorder) function or the storage.search function with a single unnamed json or jsonb parameter in the schema cache"
    }
    I run the docker-compose setup that is used in the storage-js repository
  • Know when subscription has been completed on realtime
    m

    MDobs

    12/09/2022, 11:31 AM
    Since yesterday the following only fired once
    Copy code
    .on('system', {}, payload => {
                console.log(payload)
        if (payload.extension === 'postgres_changes' && payload.status === 'ok') {
                    if (initCallback) {
                        initCallback()
                    }
                }
            })
    which allowed me to know when the subscription actually was established. Today it keeps firing continuously thus breaking the logic. Is there some new/other way to know when the realtime subscription has been established?
    g
    • 2
    • 2
  • edge function give body params
    q

    quentin_guerrier

    12/09/2022, 1:56 PM
    Hello, i use edge function for my project but when i call them and give body the variables do not appear..
    Copy code
    const { data, error } = await $supabase.functions.invoke('cluster', {
        body: { foo: 'bar' },
      })
      console.log(error, data)
    this is my function
    Copy code
    try {
        const supabaseClient = createClient(Deno.env.get('SUPABASE_URL') ?? '', Deno.env.get('SUPABASE_ANON_KEY') ?? '', {
          global: { headers: { Authorization: req.headers.get('Authorization')! } },
        })
    
        console.log('body', req.body)
        const { data, error } = await supabaseClient.from(`poi_water`).select('*')
        if (error) throw error
    
        return new Response(JSON.stringify({ ...data }), {
          headers: { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': '*', 'Content-Type': 'application/json' },
          status: 200,
        })
      } catch (error) {
        return new Response(JSON.stringify({ error: error.message }), {
          headers: { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': '*', 'Content-Type': 'application/json' },
          status: 400,
        })
      }
    r
    z
    • 3
    • 36
  • operator does not exist uuid = text
    j

    jameswilliam

    12/09/2022, 3:36 PM
    I'm trying to query a database using the following:
    Copy code
    const { data: invite, error } = await supabase
        .from('invites')
        .select('*')
        .eq('code', params.code)
        .single()
    params.code is a uuid grabbed from the URL, but I run into the following issue. It seems to think it's a mismatch type? Anyone know why this is happening and how to fix it?
    Copy code
    {
      code: '42883',
      details: null,
      hint: 'No operator matches the given name and argument types. You might need to add explicit type casts.',
      message: 'operator does not exist: uuid = text'
    }
    g
    s
    c
    • 4
    • 9
  • Rate Limit
    y

    YokoWasis

    12/10/2022, 11:47 PM
    I am coming from firebase where they don't charge for listening / subscribing on changes, in https://supabase.com/pricing you only get free for 500 connection. Does it mean if I have 10.5K concurrent user I have to pay $100 just for listening connection ?
    g
    v
    • 3
    • 8
  • local development - setting the db URL
    a

    AndersR

    12/11/2022, 4:33 PM
    I am setting up supabase locally. When I run the start command, it automatically defaults to this db URL: postgresql://postgres:postgres@localhost:54322/postgres I don't want to use that for this project. How can I change this to something else? I searched the docs and could not find the answer. Thanks for any help or advice!
    b
    c
    • 3
    • 2
  • Select distinct using supabase-js?
    s

    STILLWATER;

    12/12/2022, 5:44 AM
    Can I select distinct using supabase-js, cannot find in docs?
    g
    m
    • 3
    • 4
  • Login with username instead of email
    a

    alvaro

    12/12/2022, 4:48 PM
    Hi! How can I authenticate my users with credentials, bu instead of using email, using username? Thanks
    g
    a
    +2
    • 5
    • 8
  • Sveltekit Auth helpers
    u

    ローリー Laurie

    12/13/2022, 8:28 AM
    I'm following the tutorial here: https://supabase.com/docs/guides/auth/auth-helpers/sveltekit In the section "Send session to client" the
    LayoutLoad
    and
    LayoutServerLoad
    types don't seem to be there. Also, what file are those code snippets supposed to be in? Code from the tutorial :
    Copy code
    js
    import type { LayoutServerLoad } from './$types'
    import { getServerSession } from '@supabase/auth-helpers-sveltekit'
    
    export const load: LayoutServerLoad = async (event) => {
      return {
        session: await getServerSession(event),
      }
    }
    s
    p
    • 3
    • 6
  • Pull remote db to start local development
    t

    thosta

    12/13/2022, 8:41 AM
    Hi all as I started to implement my first edge functions, I realized it's best to have a local setup running for development. Is there a way to "pull" my existing remote DB, or do I have to manually rebuild it on my local machine? So far I have not found an option in the CLI. Thanks
    g
    k
    • 3
    • 2
  • I am building a chat application that needs to be handling thousands or millions of messages.
    h

    haris2050

    12/13/2022, 8:57 AM
    Currently i am prototyping with supabase free version and i find some lag with postgres replication connected with realtime wss. I have a stream listener for room table and messages table for realtime communication of user chat rooms, and individual messages. But using such approach, i find some lag in realtime update of chat room table last messages, lag in first time connection with realtime streams. Should i use an external layer of message queue, where both the users chat rooms, and room's messages are stored for a session, and that also acts as a message bus, then store it later in postgres. Or, are should i just not freak out now and just optimize where necessary. I am looking for a short-term plan and a long term scalable plan.
    g
    g
    • 3
    • 2
  • Session object triggers useEffect when switching between browser tabs
    j

    Julius

    12/13/2022, 1:53 PM
    I'm following the Next.js quickstart https://supabase.com/docs/guides/with-nextjs and noticed that my Account page keeps triggering the
    getProfile
    function everytime I switch from another browser tab back to my application, or switch between full screen and window mode (in Safari or Chrome on Mac OS). In the quickstart the function is triggered by the session object in the
    useEffect
    hook:
    Copy code
    ts
    useEffect(() => {
      getProfile();
    }, [session]);
    Session is initialized in the home page with the
    useSession
    hook from
    @supabase/auth-helpers-react
    . So the question is, why does this session object keep triggering effects in such a bizarre way? The user will see a loading state every time they switch browser tabs or full screen mode, and I'd like to know if this could be avoided.
    • 1
    • 1
  • How do I query nested selects?
    g

    gaIaxy

    12/13/2022, 5:14 PM
    I had this structure: Group has many to many to events and Group has letter and color Now I wanted to add a separate table for letter with a relationship to group. I thought it would look like this, but it doesn't work that way
    s
    • 2
    • 4
  • Catching new user email verification
    g

    Guy Rozen

    12/13/2022, 7:27 PM
    I am trying to figure out how to trigger a row creation with specific data in a public table whenever a new user verified their email, as I want to create a dedicated public user table with partial user data. I've read the documentation, where it is suggested to use triggers, yet, within the dashboard, it is stated that the database triggers are under an alpha preview and are not suitable for production. Is there a functional replacement for them?
    g
    o
    a
    • 4
    • 41
  • refresh without being logged out?
    d

    Dembe

    12/14/2022, 2:47 PM
    Hello, how could I do so I can refresh the page and not being logged out directly, maybe for an hour, after an hour I will be logged out if not active. Right now as soon as I refresh the page, I'm being logged out. How Can I fix that?
    g
    t
    • 3
    • 9
  • Edge Functions Self hosting
    v

    Valtoo16

    12/14/2022, 3:07 PM
    Good morning ! My question is the following : Is there a way to add the Edge Functions module when we host supabase ourselves with docker? In my case, it would be well used to be able to send push notifications! I couldn't find anything about this (or I didn't search well :/) Thank you if you take the time to answer me!
    g
    d
    n
    • 4
    • 5
  • Console hangs when trying to connec to supabase database with Prisma
    t

    tpc1

    12/14/2022, 6:42 PM
    I am trying to connect my supabase postgresql database to my prisma. When I run npx prisma migrate dev, the console displays this message then timesout after some time. I would appreciate any help . Thanks
    n
    c
    +7
    • 10
    • 44
  • Spotify OAuth returns both a provider_token and an access_token, but neither seem to work?
    z

    zilchg00d

    12/14/2022, 7:22 PM
    I've been attempting to setup an authentication flow with the built in authentication, but I am having some issue making api requests with the tokens returned. It seems like
    access_token
    is the one I want, but then, I'm not clear what the provider token is for. Any guidance here?
    k
    • 2
    • 7
  • Invalid db.major_version 15 in config.toml
    s

    steeze

    12/14/2022, 11:28 PM
    On Supabase sql editor
    SHOW server_version;
    returns 15.1, yet I get the following error when trying to link my remote project to my local
    Error: Failed reading config: Invalid db.major_version: 15.
    Is this a bug?
    g
    t
    +3
    • 6
    • 20
  • Edge function error handling
    f

    funwithtriangles

    12/15/2022, 10:20 AM
    When developing edge functions, it feels like there is something wrong with how errors are handled. If I want to throw an error inside of my function (e.g. the function was not called with the correct parameters), as given with the code examples, I want to throw an error in my main code block, catch it lower down and respond with a HTTP 400 code. I can do this, but then my error message doesn't make it through to the response. Instead the response looks like this:
    Copy code
    data: null,
    error: {
       name: "FunctionsHttpError"
       message: "Edge Function returned a non-2xx status code"
    }
    The best solution I can come up with so far is to respond a 200 OK code, but with an
    error
    object to signify an error, but then my response looks like this:
    Copy code
    error: null,
    data: {
      error: { // whatever }
    }
    So now I have to check for
    error
    or
    data.error
    which feels strange to me 🤷 Anyone else having this problem? Any better solutions?
    s
    • 2
    • 1
1...717273...230Latest