https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Dynamic Routing with Supabase Auth Helpers
    n

    NicoY

    12/21/2022, 6:02 AM
    Hi ! I am actually making an article website and trying to make a dynamic routing when I click on an article to make is content appear on an [id].js page. I am using Auth Helpers with the hook useSupabaseClient() but I can't figure out how to retrieve the info about my article in this dynamic page, as long as I can't use the hook in getStaticPaths :/ Thank you very much ! 🙂
    n
    m
    • 3
    • 5
  • Cannot integrate supabase OAuth in a react native android app
    s

    saadsiddiqui7

    12/21/2022, 6:44 AM
    Hello! I want to integrate Sign In with Google authentication with a react native application but I am not sure how it really is done. I tried many ways but did not work, is there any other way to integrate it?
    s
    • 2
    • 5
  • Is there another tier to get more default instances?
    g

    gaIaxy

    12/21/2022, 9:12 AM
    Like pay 10$ per month and you can have x amount of new projects. Would really like to see that. (I know that you can pause one project and start another one.)
    j
    s
    a
    • 4
    • 15
  • Unable to send password recovery through the dashboard (hosted)
    e

    Elon Salfati

    12/21/2022, 9:25 AM
    Hi there 👋 I created an auth user through the supabsae dashboard (hosted version), since I can't provide a password, I assume that the way to provide a user with a password is by sending them a password recovery email. However, whenever I try to send password recovery, I get a notification that the email was sent but I never get it
    s
    • 2
    • 2
  • Error Failed reading config Invalid db.major_version 15.
    a

    ak4zh

    12/21/2022, 11:02 AM
    supabase link
    suggests to change major_version to 15.
    Error: Remote database Postgres version 15 is incompatible with db.major_version 14. If you are setting up a fresh Supabase CLI project, try changing db.major_version in supabase/config.toml to 15.
    When you change it to 15 it says 15 is invalid version.
    Error Failed reading config Invalid db.major_version 15.
    s
    h
    • 3
    • 5
  • self hosting requirements
    d

    Delfini

    12/21/2022, 11:12 AM
    Hey, is there anything I need to consider when hosting Supabase on my own server? Approximately how much memory should I have, with about 100 active users uploading images on a regular basis? And how much memory should I plan for?
    • 1
    • 1
  • Unable to deploy previously working edge function
    a

    ak4zh

    12/21/2022, 11:36 AM
    I am trying to deploy this edge function in supabase https://github.com/dijonmusters/happy-days/blob/main/supabase/functions/create-stripe-customer/index.ts It used to work fine but I created a new project today with Postgres v15 And deploying above edge function results in following error:
    Copy code
    bash
    Bundling create-stripe-customer
    Error: Error bundling function: exit status 1
    file:///src/import_map.json
    file:///src/index.ts
    error: Uncaught (in promise) Error: Relative import path "http" not prefixed with / or ./ or ../ and not in import map from "https://esm.sh/v99/@types/node@16.18.3/http.d.ts"
          const ret = new Error(getStringFromWasm0(arg0, arg1));
                      ^
        at __wbg_new_8d2af00bc1e329ee (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:312:19)
        at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:79439)
        at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:1388039)
        at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:1862894)
        at __wbg_adapter_18 (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:146:6)
        at real (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:130:14)
    
    Try rerunning the command with --debug to troubleshoot the error.
    t
    • 2
    • 4
  • innerJoin JS Client
    i

    iStun4Fun

    12/21/2022, 12:10 PM
    Ive got this query and it may seems that innerjoin is not working?
    Copy code
    export function tracklistOfRelease(stringId) {
      return useQuery(
        ["tracks", { stringId }],
        () =>
          supabase
            .from("tracks")
            .select()
            .innerJoin('releases', 'releases.string_id', 'tracks.string_id')
            .eq('releases.string_id', stringId)
            .order("createdAt", { ascending: false })
            .then(handle)
      );
    }
    What can may be wrong here?
    g
    • 2
    • 19
  • Supabase C-sharp How to use join?
    m

    Makne

    12/21/2022, 12:20 PM
    I need to convert this query to supabase c-sharp posgrest: SELECT tblfsicbusinesspermit.BIN, tblbplo.NameOfEstablishment, tblbplo.Owner, tblbplo.BusinessAddress, tblbplo.ContactNumber, tblbplo.Type, tblbplo.NatureOfBusiness, tblbplo.OccupancyType, tblfsicbusinesspermit.ControlNumber, tblfsicbusinesspermit.Year, tblfsicbusinesspermit.DateIssued, tblfsicbusinesspermit.AmountPaid, tblfsicbusinesspermit.ORNumber, tblfsicbusinesspermit.DatePaid, tblfsicbusinesspermit.Remarks FROM tblbplo RIGHT JOIN tblfsicbusinesspermit ON tblbplo.BIN = tblfsicbusinesspermit.BIN ORDER BY tblfsicbusinesspermit.DateIssued DESC
  • Question regarding auth helpers.
    i

    izurugi

    12/21/2022, 12:35 PM
    Hello I am using nextjs auth helpers and I noticed that after signing in. I'm getting a supabase-auth-token cookie. So from what I notice from previous versions, signing in returns two cookies which is sb-access-token and sb-refresh-token which has secure and httpOnly set as true. The question is, is what the supabase new js auth helpers currently return is better? Security and usability wise.
    j
    • 2
    • 4
  • Updating Partial JSON Entry?
    s

    Sentry

    12/21/2022, 1:04 PM
    Copy code
    javascript
    const { error } = await supabase
    ('sites')
    .update({ 'settings->enable_customevents': toggle })
    .eq('id', currentSite.id)
    Example doesnt work, but is a good example of what I'm trying to do, updating a single entry of a JSON object without disturbing the others. Is this possible? Firebase handles it really nicely by using
    settings.enable_customevents
    g
    • 2
    • 3
  • Cloudflare Pages Deployment + Sveltekit + Supabase Auth Help
    c

    CheapSmokes

    12/21/2022, 1:12 PM
    Has anyone had any luck deploying to Cloudflare Pages using Supabase Auth and Sveltekit? I seem to be be running into this issue. Works just fine on local dev and also using Wrangler on my local as well but not when deployed to CF Pages. Output is below when visiting the site. "outcome": "ok", "scriptName": "pages-worker--743414-production", "exceptions": [], "logs": [ { "message": [ "TypeError: Cannot destructure property 'supabaseUrl' of 'getConfig(...)' as it is undefined.\n at getRequestSupabaseClient (worker.mjs:6102:11)\n at getServerSession (worker.mjs:6160:20)\n at load2 (worker.mjs:6263:24)\n at load_server_data (worker.mjs:34004:42)\n at worker.mjs:35001:24" ], "level": "error", "timestamp": 1671628233144 } ],
  • Edge function executes both if and else blocks of code
    l

    lake_mattiato

    12/21/2022, 1:52 PM
    So i have a predefined object:
    Copy code
    js
    let buttons = {
      'connected': false,
      'pending': false,
      'nothing': true,
      'accept_or_decline': false
    }
    and i have to change the values in this object depending on the results of a query. so i have the following block of code:
    Copy code
    js
    console.log(buttons)
    console.log('Before the if statement')
    
    if (response.is_accepted === true) {
          console.log('is_accepted == true')
          buttons.connected = true
          buttons.nothing = false
    } else if (response.is_accepted === false){
          console.log('is_accepted == false')
          buttons.pending = true
          buttons.nothing = false
    }
    
    console.log(buttons)
    console.log('After the if statement')
    Which should only set the connected key or pending key to true. This works when i deploy the function and call it for the first time. But every other time it somehow sets both of them to true. Any idea why? PS: Also when i check the log the buttons object is changed even before the if statement is executed
    g
    • 2
    • 2
  • Postgres query and function return different results
    l

    lake_mattiato

    12/21/2022, 3:26 PM
    so i have the following sql function
    Copy code
    sql
    CREATE or REPLACE function get_list_of_connected_users(user_id uuid)
    RETURNS users_data
    AS
    $func$
    
    SELECT * FROM users_data
    WHERE id 
    IN
    (
      SELECT target_id as id FROM connections
      WHERE 
      source_id = $1
      AND is_accepted = true
    
      UNION 
    
      SELECT source_id as id FROM connections
      WHERE
      target_id = $1
      AND is_accepted = true
    )
    
    $func$
    language sql;
    but when calling the function i only get one result. However when i execute this
    Copy code
    sql
    SELECT * FROM users_data
    WHERE id 
    IN
    (
      SELECT target_id as id FROM connections
      WHERE 
      source_id = 'some_uuid'
      AND is_accepted = true
    
      UNION 
    
      SELECT source_id as id FROM connections
      WHERE
      target_id = 'some_uuid'
      AND is_accepted = true
    )
    i get 3 results I test the function like this
    Copy code
    sql
    select * from get_list_of_connected_users('some_uuid')
    g
    • 2
    • 2
  • Does the JS client library refresh the JWT automatically?
    f

    Florian

    12/21/2022, 4:18 PM
    The default expiration time for the auth JWT is 1h. I noticed that I'm still logged in on localhost coming back much later. Does the JS library automatically handle the re-authentication process and if yes, where can I read up on how this process works?
    g
    • 2
    • 4
  • Sign in with Apple for Expo app
    c

    csmithxc

    12/21/2022, 4:19 PM
    Hey all - Trying to integrate Sign in with Apple in my react native / expo app. I am aware that
    supabase-js
    can generate a redirect url and have seen the guide, but it's a bit suboptimal for me. It makes sense that Supabase would use a redirect url here, but I would much rather directly use the native Apple sign-in popup than have to redirect the user through a web url. My current idea: 1. User signs in with Apple through Expo
    AppleAuthentication
    2. I pass the credential result to a Supabase edge function 3. The edge function uses the user email and some identifying part of the jwt token as a password So basically this is a thin veil over an email/pass sign in. I'm aware this is hacky though, and am concerned about security implications. Has anyone figured out how to use Supabase auth with Apple signin, without having to go through the redirect url? Ideally I'm looking to use a combination of this Expo module (https://docs.expo.dev/versions/latest/sdk/apple-authentication/#appleauthenticationcredentialstate) and a
    supabase-js
    method.
    r
    k
    • 3
    • 5
  • is it a good practice to store refresh-tokens after authenticating using oAuth Providers?
    h

    happy-sean

    12/21/2022, 4:26 PM
    I'm using gitlab as my oAuth provider and I need to access it's REST api... So I have user that registers using Email / Password, then after that they have the ability to authenticate their gitlab account as well... Multi-Provider Auth works when Email is the same in provider and supabase, the problem I have is that I'm only able to have access to the
    provider_token
    after the user authenticates to gitlab... if the user logout then login again (using email and password), the
    provider_token
    is
    null
    ... As a temporary fix what I do is to re-authenticate the user every-time they try to access features that access gitlab REST API... I reauthenticate them using
    supabase.auth.signInWithOAuth()
    j
    • 2
    • 5
  • I bit confused on how to perform sign up in a flutter project
    g

    goldyman

    12/21/2022, 5:17 PM
    I have read a tutorial from very good ventures which is using gotrue library. While in the official docs I see we can use supabase.auth.signup to create a new user. which one is correct?
    i
    • 2
    • 2
  • supabase test db - pgtap xunit style tests
    i

    Illia

    12/21/2022, 6:07 PM
    Hello hello 🙂 I wanted to check whether supabase test db supports pgtap xunit style tests? I did some tests but it doesn't look like it does. Attaching excerpt from pgtap on xunit style tests:
  • Instantiate a serverSupabaseServiceRole that will query a schema other than public?
    b

    Bralz

    12/21/2022, 6:20 PM
    I can't find anything in the docs about calling the Nuxt3 service role (https://supabase.nuxtjs.org/usage/services/server-supabase-service-role) with an option for targeted schema. When using createClient() I can specify my private schema, but not with this service role because it only takes the event parameter. How can I perform queries on a private schema with the service role?
    • 1
    • 1
  • Best way to specify type for rpc call response data in TypeScript?
    x

    xvvvyz

    12/21/2022, 6:51 PM
    Copy code
    javascript
    const { data } = await supabase.rpc(
      'upsert_subject_with_observations',
      // ...
    );
    
    // Property 'id' does not exist on type 'string[]'.
    console.log(data?.id);
    Function signature looks like this:
    Copy code
    sql
    public.upsert_subject_with_observations(
        in observation_ids uuid[],
        in subject subjects,
        out id uuid)
    u
    • 2
    • 6
  • Access to function invoker in Database functions
    d

    deviloversaad

    12/21/2022, 7:06 PM
    Hi 👋 Thanks for helping in advance 🙂 I need help with following scenario: 1. I have a table
    TableA
    and on the
    INSERT
    event I want to trigger a DB function which will
    insert
    a new column in
    TableB
    but I need to save the invoker
    id
    in that column along with the
    new.id
    of the
    TableA
    column. I can do it with function hooks too but I was just wondering if it's possible with functions only 🤔 - LMK please if it's possible like some magic
    auth.id
    🥲 variable. Thanks. ❣️ #1006358244786196510
    j
    g
    • 3
    • 4
  • Webhook not triggering
    m

    mlc

    12/21/2022, 7:09 PM
    Hi, I have 2 webhooks triggering off the same event (Creation/Update to a row in the same table). Only one of them seems to be triggering. (similar to the youtube video, it's hitting a nextjs api endpoint). Vercel is only showing one of them being triggered. Am I doing something wrong?
    • 1
    • 1
  • Realtime issues, Auth & Usage with tRPC and Prisma
    m

    matt-j-stevenson

    12/21/2022, 8:02 PM
    TLDR: - Do I need to use Supabase Auth in order to use Realtime, and subscribe to DB changes? - Is tRPC worth using when using Next.js/Supabase? If not tRPC, do you still use React Query? - Is Prisma "needed" when using Next.js/Supabase Hi folks, new around here. I've been building a new fullstack app in Next.js, with tRPC, Prisma and a Supabase Postgres instance. Prior to choosing Supabase as the DB for this app, I was on the hunt for a service that could "listen" to my Postgres DB, and fire off an event or make a request when an INSERT took place. It was only yesterday, after prior being aware of the Auth module Supabase provides, that you can do exactly that with Realtime. While the app is mostly a CRUD dashboard with some bells and whistles, I've redesigned it to incorporate some automation, mostly for Form generation with Typeform; but recently decided I should add an automation workflow for a new User, saving time of manually doing this in v1 of the project (this is v2). When I tried to use 'channels' and specifically the 'on' method, I was met with a 401, which led me to believe either I need a JWT like the docs mention (my Auth is session based currently with NextAuth), or I need to use Supabase Auth in order to use RLS and Realtime. Could anyone tell me if that's the case? Also, while I love this "stack" which is becoming all the more popular these days for people wanting to concentrate on the development as whole, rather than write backend NestJS (and connecting it to a frontend), or use GraphQL in the same form as tRPC with mounds of Type generation. Simply put, I'm wondering if using tRPC with Supabase utilised to it's full potential is even worthwhile if Supabase can send updates directly to the client from the DB? How does Prisma fit into this stack in your opinion? Love to hear peoples thoughts, Thanks MS
    g
    • 2
    • 1
  • Issue with INSERT requests
    t

    Thomas.

    12/21/2022, 8:45 PM
    Hey, i'm having an issue with isnert requests in my supabase database: i'm using the
    @supabase/auth-helpers-nextjs
    package for my Next.js project and as i see, it does not completely works because i'm logged in as i can see my informations and access protected places, but i cannot insert new data.... any idea?
    g
    • 2
    • 25
  • What is the syntax for an empty array containing a single empty jsonb object?
    j

    jopfre

    12/21/2022, 9:22 PM
    I have created a jsonb[] column (defined as an array). I want to set the default value to a single empty object inside an array
    [{}]
    . `'{}'::jsonb[]`just gives an empty array, and I have tried multiple permutations of
    {}
    and
    ''
    nested in different ways but nothing seems to be working. Any ideas?
    g
    • 2
    • 2
  • RLS Policy with Join
    k

    Kris Niles

    12/21/2022, 11:40 PM
    Howdy! I'm a designer by trade, and a newbie dev - so apologies in advance. But I've been banging my head against this for a few days now, and SO and googling have failed me. Here's my problem: I have two Supabase tables, and I am looking to create a RLS policy that returns rows from one table when a column value matches between the two tables. It seems like a simple
    join
    , but I just can't get it to work. Here are the details: Table 1:
    user_details
    This table contains my user's details, and has two important columns: `id`: This column contains the
    auth.uid()
    for the user. `token`: this is a "friendly" token that is unique to each user. Example:
    JON-123
    . The user includes this token when saving a highlight to their account, because the endpoint they save through is not authenticated. This table has a simple RLS Policy for update and select, which is:
    (auth.uid() = id)
    Table 2: `highlights`: This table contains all highlights submitted by all users. It has several columns: `token`: This is the same value as the
    token
    column above. `highlight_text`: text of the highlight.. `highlight_url`: url of the highlight.. and a few more columns.. This table currently has no RLS policies - and I need to make one for it, that will allow users to see only their own highlights - i.e. only rows with their token. Essentially, I need to get the
    token
    for the current user from the
    user_details
    table, and then only return rows from
    highlights
    table that have a matching value in the
    token
    column. It seems like this would be a simple join of the
    user_details
    table with the
    highlights
    table, but everything I tried returns zero results. Here's my most recent try (which returns zero rows):
    Copy code
    ( auth.uid() IN ( SELECT user_details.id AS uuid
       FROM (highlights JOIN user_details ON ((user_details.token) = (highlights.token)))))
    I'm not sure what I'm doing wrong - any help would be greatly appreciated!
    s
    g
    • 3
    • 27
  • Is it possible to run a clock on server and update client using realtime?
    y

    yxgen4

    12/22/2022, 12:14 AM
    https://supabase.com/blog/supabase-realtime-with-multiplayer-features#extensions This example is specifically mentioned in a realtime blog post, but I can't find anything to help build it.. Any advice? I've also seen that vercel does not support websockets. Is it possible to use Supabase realtime while also hosting on vercel?
  • Unhandled JS Exception Can't find variable SharedArrayBuffer after polyfilling URL library
    d

    Drip

    12/22/2022, 12:18 AM
    Trying to configure supabase-js locally to run with react-native in expo and running into this error. I've been banging my head against the wall trying to resolve this for a week. Would love some pointers if possible
    s
    • 2
    • 14
  • How can I query a table that matches any of the given Id?
    g

    garyaustin

    12/22/2022, 1:39 AM
    .in
    like you show is the way.
    o
    • 2
    • 6
1...757677...230Latest