https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How to migrate tables scheme created from local UI
    m

    MaheshtheDev

    12/29/2022, 6:54 AM
    I am creating tables and buckets from the local studio UI. How can i migrate this updated data schemas to production?
    h
    g
    • 3
    • 36
  • Unable to get subscribe to work
    s

    Shawn Conecone

    12/29/2022, 8:50 AM
    Hi, I have this simple code below:
    Copy code
    const listener = supabase
        .channel('*')
        .on(
            'postgres_changes',
            {
                event: '*',
                schema: '*'
            },
            (payload) => {
                console.log({ payload });
            }
        )
        .subscribe();
    I'm currently using the anon key to connect. Testing this with making updates to a row of a table that has its RLS disabled doesn't trigger the callback function. Any idea why? Thanks!
    g
    • 2
    • 7
  • How to send and email to confirm the email address?
    m

    moroshko

    12/29/2022, 9:42 AM
    Is it possible to resend the email that asks to confirm the user's email address after a sign up using
    @supabase/auth-helpers-nextjs
    ?
  • RLS insert policy, based on users custom claims.
    c

    Cheqo

    12/29/2022, 10:22 AM
    Hello, I have created "is_admin" custom claim that is in auth users table in raw_app_meta_data column. I am now in RLS policy dashboard and I need to provide expression, but how do I actually structure this statement. It seems fairly simple in english:
    Allow insert if "is_admin" = true
    , however what is the SQL equivalent?
    u
    g
    • 3
    • 3
  • How to update a UUID column to null.
    l

    lake_mattiato

    12/29/2022, 10:24 AM
    So i have a column organization_id in a users table, and i want to add a feature to remove the user from an organization. Its a foreign key and it is nullable. When trying to set to NULL, null, '' i get a
    Copy code
    invalid input syntax for type uuid ...
    g
    • 2
    • 1
  • Manually refresh token
    m

    Mihai Andrei

    12/29/2022, 12:12 PM
    Hello! Is there any way to manually refresh the token using the supabase client? Or only by making a post request to
    /auth/v1/token?grant_type=refresh_token
    with
    { refresh_token: "the-refresh-token" }
    I'm using supabase only on the server, and I need to create an endpoint to refresh the token.
    j
    • 2
    • 2
  • Get all columns of a table
    t

    TheCodeMonkey

    12/29/2022, 1:17 PM
    Hi There, I currently have a db function that gets all the table names, I want to have a function that will return all the columns for a specific table without returning an entry is this something that I can do with the SQL
    g
    a
    • 3
    • 11
  • Proper way for handling relations fill
    o

    oleg

    12/29/2022, 1:38 PM
    I have table with projects and i want to fill user_id field automatically after insert based on authorized user, what is proper way for this? thanks
    g
    • 2
    • 2
  • storage getPublicUrl returns json with error instead of image
    h

    Hermes

    12/29/2022, 1:44 PM
    Just as title says, I'm trying to use getPublicUrl to get url for an image. It works fine in local environment but not in production build. Instead it returns a json object representing an error.
    Copy code
    JSON
    {
      "statusCode": "403",
      "error": "FeatureNotEnabled",
      "message": "feature not enabled for this tenant"
    }
    g
    b
    • 3
    • 9
  • GroupBy PostgREST
    i

    iStun4Fun

    12/29/2022, 1:47 PM
    I would like to execute this one without falling into RPC (i found they are kinda slow and insecure, maybe im wrong?)
    Copy code
    // Fetch all royalties by Label and Time, Group by Date and Type
    
    export function useRoyaltiesByLabel(labelId) {
      return useQuery(
        ["royalties", { labelId }],
        () =>
          supabase
            .from("royalties")
            .select(`date, label_id, SUM(total_revenue) as total_revenue, type`)
            .eq("label", labelId)
            .groupBy (["type", "date"])
            .order("createdAt", { ascending: false })
            .then(handle),
      );
    }
    g
    c
    s
    • 4
    • 58
  • Does filtering by a join table work in SupabaseJS v1?
    a

    Alon

    12/29/2022, 2:15 PM
    I have this query:
    Copy code
    const { data, error } = await client
          .from('custom-messages')
          .select(
            `id, content, show_in_all_groups, updated_at, created_at
             profile:profile_id (
               id,
               full_name,
               avatar_url
             ),
             groups:groups_custom-messages (
               group_id
             )
           `
          )
          .eq('groups.group_id', groupId)
    However I still get back ALL customMessages without consideration for filtering by
    group.group_id
    I am on Client v1.3 because there were issues with RedwoodJS Auth when updating.
    g
    • 2
    • 9
  • Limit return data on getUser
    c

    CherterB

    12/29/2022, 2:46 PM
    Like the title said, how do i limit data or change the return data when using getUser method? How do I get only the raw_user_meta_data? Or just partial of the raw_user_meta_data.
    g
    s
    • 3
    • 7
  • How to increase file storage token timeout?
    u

    19

    12/29/2022, 4:43 PM
    https://www.reddit.com/r/Supabase/comments/zy9rcw/increase_storage_token_timeout_time/ File URL's coming from supabase storage have a JWT token in the URL with a timeout of 60 seconds. If I try accessing that URL after the timeout period has expired I get this response
    {"statusCode":"400","error":"Invalid JWT","message":"jwt expired"}
    Is there any way to increase the timeout period for file storage URLs?
    g
    • 2
    • 1
  • Migrating users form Firebase to Supabase
    o

    organicnz

    12/29/2022, 5:55 PM
    [SOLVED] Hi folks, Apologies for asking. Could you pls help with this error? I've been encountering it while tried to migrate users from Firebase to Supabase. ```> node import_users.js ./users.json 1000 loading users from ./users.json insertUsers: 1000 node:events:491 throw er; // Unhandled 'error' event ^ Error: Parser cannot parse input: expected ',' at Parser._processBuffer (/Users/organic/work/firebase-to-supabase/node_modules/stream-json/Parser.js:291:76) at Parser._transformBuffer (/Users/organic/work/firebase-to-supabase/node_modules/stream-json/utils/Utf8Stream.js:24:10) at Transform._write (node:internal/streams/transform:175:8) at writeOrBuffer (node:internal/streams/writable:392:12) at _write (node:internal/streams/writable:333:10) at Writable.write (node:internal/streams/writable:337:10) at Chain._write (/Users/organic/work/firebase-to-supabase/node_modules/stream-chain/index.js:134:18) at writeOrBuffer (node:internal/streams/writable:392:12) at _write (node:internal/streams/writable:333:10) at Writable.write (node:internal/streams/writable:337:10) Emitted 'error' event on Chain instance at: at Chain. (/Users/organic/work/firebase-to-supabase/node_modules/stream-chain/index.js:128:71) at Chain.emit (node:events:525:35) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) Node.js v19.3.0
  • Magic Link Redirect & Next JS Page Flash
    j

    jakeAnon

    12/29/2022, 6:10 PM
    Hello fellow Supabase users, I am using supabase auth helpers and I want my magic link to redirect to /form upon verification. However it is currently, (very briefly but annoying) showing /# endpoint then redirecting to end point. I have additional code in place to check if session exists then it will redirect to /form .
    Copy code
    await supabaseClient.auth.signInWithOtp({
            email,
            options: {
              emailRedirectTo: "http://localhost:3000/form",
            },
    Ive tried using above as well as
    Copy code
    const { isLoading } = useSessionContext();
    to try and let the session load in but the page still flickers before redirect. I would appreciate any help, thank you!
    c
    • 2
    • 1
  • Postgres connection with prisma
    d

    DarthJarJar

    12/29/2022, 7:20 PM
    I'm trying to connect the postgres db with prisma following the quickstart guide but i'm getting this error
    c
    • 2
    • 6
  • How to run EXPLAIN query on a PostgREST upsert call?
    g

    gtims123

    12/29/2022, 7:27 PM
    I am doing batch upsert queries using PostgREST api. They are extremely inefficient and I would like to run an EXPLAIN query on one of these inefficient queries. I am having trouble using the EXPLAIN command. I tried adding the 'Accept': 'application/vnd.pgrst.plan+json' as a header to my upsert POST request, as mentioned in this supabase article: https://supabase.com/blog/postgrest-v10. I am getting this 415 error message 'None of these media types are available: application/vnd.pgrst.plan+json'. Are there any suggestions anyone can give me? @garyaustin perhaps you have run into this before?
    g
    • 2
    • 6
  • How to check if a file with a specific name exists in a bucket or folder?
    w

    Wizzel

    12/29/2022, 9:09 PM
    I guess this can be done by functions but I haven't found much documentation about my case.
    • 1
    • 1
  • retrieving users email, created_at date for analytics
    l

    Lukas V

    12/29/2022, 11:25 PM
    Hi, I have a users collection in my public in my database, I store various info there such as avatar_url, full_name, username etc. If I wanted to track users email and created_at date for myself, do I need to add those fields, I'm asking this since there is
    auth.users
    table which I assume is created automatically by supabase. Can I use auth.users table to query for this info - email, created_at date or should I add it to my public users table as well?
  • having method in Supbase
    u

    usamichizuru

    12/30/2022, 4:32 AM
    So I try to filter using Supbase filter method and I want count of something compare with some of value:
    Copy code
    js
    const {data,error} = await supabase.from("table").filter('foreign_table.count', 'eq', 2);
    and got error aggregate functions are not allowed in WHERE. Now I know that count has to use in having method so how am I going to query this. Also rpc is my last option.
    g
    • 2
    • 1
  • RLS is great for data access control but not for general purpose application access control.
    m

    mingfang

    12/30/2022, 5:29 AM
    I've used https://cerbos.dev in another non-Supabase project. Are there plans to offer a Supabase solution?
    s
    j
    +3
    • 6
    • 15
  • Postgres PgCytpto function doesn't seem to exist on function hook call
    n

    Nilu

    12/30/2022, 6:37 AM
    Hi, I'm trying to add a nanoid to my project, the universe table has a nanoid() function as the default value and it seems to execute the function call fine, however, I get this error: function gen_random_bytes(integer) does not exist. gen_random_bytes is a pgcrypto function that is installed in my supabase machine. The nanoid function comes from nano-id postgres: https://github.com/viascom/nanoid-postgres Running SELECT nanoid(); works fine on the SQL editor. and give's something like this: Rqp4czaGvyVy6JhwJ5Nqx Also generating it via UI works I also added SECURITY DEFINER to the function to see if it was a problem with the anon user that's calling it, but that failed too.
    k
    • 2
    • 3
  • Twitter auth - missing sub claim
    n

    Neki

    12/30/2022, 7:00 AM
    I'm just trying to authenticate my users with twitter, but I always get a "AuthApiError: missing sub claim" error. This only happens with Twitter auth since I'm able to authenticate with email, discord, and google.
    g
    • 2
    • 3
  • Is it ossible to track when and how often and over a time period how a value has changed in a table?
    r

    rchrdnsh

    12/30/2022, 7:58 AM
    Starting to explore making an Ads Component so I can create custom ads. I was thinking about it and I would probably want to be able to track views and clicks, among other things, but I would also need to show clients how many views and clicks over time, maybe weekly, monthly, etc.. not sure how to go about doing that or if that would be possible to do with supabase and my framework of choice, which is currently svelte and kit. Any thoughts would be appreciated 🙂
    s
    • 2
    • 4
  • How can i ready data from discord oauth
    m

    maniak

    12/30/2022, 10:19 AM
    Hi there, im trying to understand how Discord oauth provider works here. I'm writing a website in Flutter and I would like to know how I can do a Discord-only login and how to save user data such as name, avatar url, email, guilds in the database and then be able to display them on the website.
    s
    • 2
    • 13
  • Avoiding CAST errors in database
    c

    ccssmnn

    12/30/2022, 1:43 PM
    I want to check, if a text is larger than a float / int, but only if it is convertible to float / int. The query
    select true or cast('bla' to int) > 4;
    throws a cast error. I was expecting the cast to be skipped, since it should not be evaluated because of the
    true
    before the
    or
    . That assumption is wrong. Context: I store form submissions in a table where each field of the submission is its own row. Fields can be of type
    text
    ,
    number
    , ... and their value is always a string just like HTML fields. I want to check if the submitted number is greater than the minimum value, but only if it is a number field.
    g
    • 2
    • 1
  • default_transaction_read_only is turned on automatically
    g

    Gonza

    12/30/2022, 2:30 PM
    My app is down and not being able to serve users because the database is in read-only mode. default_transaction_read_only is set to on and even if I turn it off it gets set back to on immediately. Any help?
    g
    • 2
    • 5
  • Password Settings
    m

    Martacus

    12/30/2022, 3:00 PM
    When I am trying to register myself as a user it gives me the signup requires valid password. I cannot find any settings related to what the password requires etc. Is there a setting? Or documentation on what the password should be like?
    g
    • 2
    • 2
  • Nextjs middleware - Auth.getSession() returning null
    c

    CRSHR21

    12/30/2022, 5:00 PM
    Hi all, I followed the authentication guide from the official documentation (https://supabase.com/docs/guides/auth/auth-helpers/nextjs#auth-with-nextjs-middleware), and when I'm trying to check the user's session by using auth.getSession() I'm getting null. Initiation at the _app.tsx:
    Copy code
    ts
    export default function App({
      Component,
      pageProps,
    }: AppProps<{
      initialSession: Session;
    }>) {
      const [supabase] = useState(() => createBrowserSupabaseClient());
      return (
        <SessionContextProvider
          supabaseClient={supabase}
          initialSession={pageProps.initialSession}
        >
          <Provider store={store}>
            <Component {...pageProps} />
          </Provider>
        </SessionContextProvider>
      );
    }
    Here's the middleware code (it's basically copied from the docs):
    Copy code
    ts
    export async function middleware(req: NextRequest) {
      const res = NextResponse.next()
      const supabase = createMiddlewareSupabaseClient({ req, res })
      const {
        data: { session },
      } = await supabase.auth.getSession()
    
      console.log("sess",session); // -> returns null
    
      // rest of the logics...
    }
    Any ideas?
    s
    • 2
    • 4
  • Sign In With Multiple Sessions
    a

    Askar

    12/30/2022, 5:01 PM
    Hi, I'm creating an account page on a site where we to just verify that the twitter and discord login of a user is valid. We don't even want to use their social media logins as the main site's login - as we have our own login in system. So! How do I sign in with Twitter and Discord and remember that login with exposing that information on the client side?
    p
    g
    • 3
    • 26
1...828384...230Latest