https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • SQL snippets - get data from another project
    n

    Nostro

    09/28/2022, 10:32 AM
    Hi everyone, I'm wondering if there's a way to run snippets from one project to another. Basically I have ProjectA in prod, and have other data that I have uploaded in ProjectB that are on a different schema (and split in a differnt way of organizing tables) so will need some transformation to populate this data into ProjectA. So is there a way to work cross-project in the SQL Editor in my dashboard? As in duplicate a table, or fill some rows? Or would the way to go be to either: - replicate my ProjectB tables into ProjectA and run the SQL queries there - or build a simple Node App that would fetch data from ProjectB, do the transformation in the app and then write into ProjectA ? thanks !
    g
    • 2
    • 1
  • Select from joining table returns wrong data
    t

    theSimon

    09/28/2022, 11:13 AM
    I use the @nuxtjs/supabase module. I have a table "challenges" and two join tables "profile_challenge" (to assign the challenge to a profile) and "challenge_category" (to assign categories to the challenge). Both of these join tables are identical and store only the respective ID's of both reference tables. The respective tables "categories" and "profiles" are very simplistic and only contain an id and some text columns. I make a request like this:
    .from('challenges').select('*, profiles(id, username), categories(title, image_url)')
    While I get the correct category data, the profile data is somehow wrong. For all 5 challenges i** get the same profile data**, even when 2 challenges are assigned (through the join table) to a different profile. How could it be that the categories work fine, and an identical table & request does not? Thanks for your help 🙂 Simon
    s
    • 2
    • 3
  • is there way to version functions?
    s

    sofaking

    09/28/2022, 11:48 AM
    Hi, I made a mistake one of my functions (sql), I wonder is it possible to bring that back ?
    h
    g
    s
    • 4
    • 5
  • Non Expire JWT Tokens
    c

    czypnt

    09/28/2022, 3:52 PM
    I am building a mobile app with React Native and using Supabase as my backend. The problem I am facing is the expiration of the JWT token, since the longest is a week its causing users to have to relogin to refresh the access token. Is there anything I can do to improve this?
    g
    • 2
    • 6
  • hCaptcha issue
    v

    Valdien

    09/28/2022, 4:18 PM
    Working on setting up hCaptcha, but I keep getting "request disallowed". When I look at the hCaptcha site it shows that the captchas are being delivered and solved, but they are **not **being verified. I can see that the captcha token is being generated and sent with the signUp info to supabase.
    Copy code
    const { error, user } = await supabase.auth.signUp(
          {
            email: data.email,
            password: data.password,
          },
          { data: { username: data.username, team: data.team }, 
            captchaToken: captchaToken  }
        );
    everything else is set up exactly as shown in the guide here: https://supabase.com/docs/guides/auth/auth-captcha Sign ups work just fine with out captcha. Any suggestions? And yes..I have checked the secret key, several times=)
    s
    i
    m
    • 4
    • 5
  • Backup on free-tier
    s

    SimonP

    09/28/2022, 4:32 PM
    Is it also possible to do a backup on the freetier? This would be the inly feature I need from the Pro-Tier but 25$ is quite a big jump in my eyes.
    s
    n
    • 3
    • 5
  • Strange caching...
    d

    db

    09/28/2022, 4:43 PM
    Hello, I'm seeing odd behavior when using the Supabase js client from inside an api page in NextJS. When calling the NextJS api route, I get stale query data. Does anybody know if there is caching happening on the NextJS side or on the Supabase REST API side, which would cause stale data? Thank you very much!
    s
    n
    • 3
    • 3
  • Subscribing to broadcasted events and sending them on the same page!
    j

    JOCKER

    09/28/2022, 6:06 PM
    Hello everyone! I'm currently trying to subscribe to events and broadcast them on the same page ! but seems like not working , so is this a limitation on supabase ? or should I handle that differently thanks in advance!
    s
    • 2
    • 13
  • Supabase React Clerk giving 403
    l

    LordKeebler

    09/28/2022, 6:26 PM
    Keep getting API key not found when trying to insert into supabase. I am certian my token is correct.
    s
    • 2
    • 2
  • Add Properties to Auth.User
    b

    BoogersLLC

    09/28/2022, 8:16 PM
    Hello, for context I'm currently using the svelte-kit auth helper 0.7.1 I know that Supabase suggests creating a public.profiles table to manage additional user data. However, one thing I'm confused on. The
    LayoutServerLoad
    only pulls back the
    auth.user
    as far as I understand. -- I want to grab additional properties like
    theme
    so that I can have that user's theme during SSR.
    LayoutServerLoad
    blocks rendering the corresponding svelte layout/page until it completes. Wouldn't hitting the supabase API to grab profiles add to this time to finish? i.e. I'm looking for a way to grab custom fields/columns from the user without having to make a second trip to the server. More context, this is essentially what I'm trying to achieve:
    Copy code
    ts
    export const load: LayoutServerLoad = async ({ locals }) => {
            // locals.session.user <-- Already has user's data.
        return {
            session: locals.session,
            theme: 'night' // <-- Get user's theme from locals.session.user
        };
    };
    n
    g
    • 3
    • 7
  • How to fetch single rows randomly?
    l

    Lukas V

    09/28/2022, 8:19 PM
    Hello, I have a situation where I need to fetch recipes 1 by 1. Correct me if I'm wrong but so far it seems that If was to fetch unique recipes like this:
    Copy code
    supabase
        .from('recipes')
        .select(
          `*`,
          { count: 'exact' }
        )
        .limit(1)
        .not('id', 'in', `(${fetchedRecipeIds})`);
    10 queries would simply return results in this id sequence - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 correct? As you can see from the picture first 4 results are recipes with tuna, which would result in bad UX for users who want to fetch recipes 1 by 1. How can I make it random or at least group them so that I know that the next recipe user fetches won't be from the same "group". Ideally result sequence would looks something like this: Tuna..., chicken..., pizza..., tuna..., chicken and so forth...
    g
    • 2
    • 3
  • How to multiply same value across all records?
    h

    helena

    09/28/2022, 8:48 PM
    Hi! What's the best way to update all values in a db from a user? Imagine a DB with a person and the amount of fruits they hold. John holds 100 apples and 10 bananas. I want to update all of John's records to be 1/2 such that the records say John holds 50 apples and 5 bananas. Is this easily possible without looping requests? ex:
    Copy code
    const { data, error, status } = await supabase
        .from("user_apples")
        .update({ // multiply by 0.5?? // })
        .match({ name: "john" });
    g
    • 2
    • 4
  • is there any way to count rows by group?
    v

    vjoohov

    09/28/2022, 9:50 PM
    is there any way to count rows by group? I want something returning like this: { “Group_1”: 38, “Group_2”: 19, “Group_3”: 20 }
    g
    • 2
    • 1
  • How to locally serve multiple edge functions?
    o

    oliverbytes

    09/28/2022, 10:02 PM
    When I sever another one, the other one stops automatically. I wanted to test multiple functions but it seems tedious to jump back and forth. Any help is appreciated. ♥️
    g
    • 2
    • 2
  • Where do I insert a DB function to? getting syntax errors
    b

    Blobby

    09/28/2022, 10:04 PM
    Trying to insert the following function and getting syntax errors
    Copy code
    sql
    
    create or replace function "CreateScrapedUpload" (
      _filename text,
      _record_count int,
    ) returns table (
      id uuid,
      filename text,
      storage_key text
      record_count int,
      notes text,
      checkbox boolean
    ) as $$
      insert into rr_upload (
        filename,
        storage_key,
        record_count,
        notes,
        checkbox,
      )
      select
        filename,
        extensions.uuid_generate_v4()
        _record_count
        _filename,
        "",
        false
      from public.rr_upload rr
      returning id, filename, storage_key;
    $$ language sql volatile;
    Error:
    Failed to create function: failed to create pg.functions: syntax error at or near ")"
    g
    • 2
    • 2
  • Vercel Can't Find type Deno?
    t

    tdhyunk

    09/28/2022, 11:00 PM
    Hey all. I'm having some trouble deploying a function onto Vercel. It seems like the issue is Deno cannot be found. Has anyone experienced something similar?
    g
    • 2
    • 2
  • Error using my function in production
    f

    Fainaru

    09/28/2022, 11:28 PM
    When uploading the function it gives me an error which in local does not happen to me
    • 1
    • 4
  • Email templates API?
    c

    CanRau

    09/29/2022, 1:26 AM
    Hey there supabasians is it possible to change auth email templates via api?
    o
    g
    • 3
    • 6
  • How secure is Supabase in general?
    a

    AllYourSupabase

    09/29/2022, 1:46 AM
    Just curious what is the general synopsis of architecture that Supabase sitting on and how secure is it when it comes to individual instances? If I were to transfer my app to use this BaaS (supabase), how "secure" is it?
    a
    • 2
    • 4
  • Realtime not sending future updates [solved]
    a

    AmusedGrape

    09/29/2022, 3:31 AM
    (for reference, I'm using overseedio/realtime-go) Hey there! I'm having an issue where if I update a row, it only triggers my OnUpdate function once. It doesn't continue to trigger the functions. I've confirmed heartbeats are still sent. Not sure if this is something with my code, or if Supabase is having issues with realtime. (willing to bet its my code but i can't see anything wrong with it)
    j
    • 2
    • 3
  • Base64URL encode
    w

    wei

    09/29/2022, 3:47 AM
    Is there a base64url encode available in supabase postgres? I tried looking online, and could only find a base64 encode one using the encode function. Thanks!
    j
    • 2
    • 1
  • Where to get access token for CICD?
    j

    juniorco

    09/29/2022, 5:20 AM
    Following this doc https://supabase.com/docs/guides/cli/cicd-workflow#configure-github-actions Where do I get the
    SUPABASE_ACCESS_TOKEN
    from?
  • user_metadata
    f

    flotTopz

    09/29/2022, 5:50 AM
    return is only like this one
  • I need a Message Broker
    d

    Draz

    09/29/2022, 6:36 AM
    I want to be able to publish events that edge functions would react too like AWS SNS and SQS I feel I could in theory write to DB and react to the write, but that feels like reinventing a Log Based Message Broker ie. and inefficient Kafka
    n
    h
    g
    • 4
    • 4
  • select
    g

    ghm

    09/29/2022, 7:18 AM
    Hello everone, I want to join two tables in different schemas. Creating a reference works fine but querying the table from the js client doesn't really work. The docs don't mention anything about schemas https://supabase.com/docs/reference/javascript/select#query-foreign-tables I'm getting this error: "Verify that 'table1' and 'table2' exist in the schema 'schema1' and that there is a foreign key relationship between them." I could probably use rpc instead of select but I have the same problem with subscribing to events, I only get data from table1.
    m
    g
    • 3
    • 2
  • Auth email error when inviting user from dashboard
    h

    Homemadesteam58

    09/29/2022, 8:45 AM
    I am getting an error in my browser address bar from supabase when I try to use the invite link that I sent myself from the supabase console. I invited my email address from the Supabase console and when I open the link I get this attached to the end of my url [image1]. I have disabled the email confirmation in the dashboard, but I still keep getting this error and can't see anything that would resemble a solution. Any ideas? Help would be very much appreciated.
    • 1
    • 1
  • How to specify an exact PostgreSQL version of the local supabase instance? 14.X
    d

    dmytro.eth

    09/29/2022, 12:08 PM
    Hi. My production PostgreSQL version is 14.1, while the local instance is 14.3. I want my local to be 14.1 as well. There is a setting for the major version number in
    /supabase/config.toml
    but no setting for the minor. How can I specify a minor version there as well? I tried adding
    minor_version = 1
    but it didn't work
    k
    • 2
    • 2
  • Issue using postgres to export csv to GBQ
    w

    Wee

    09/29/2022, 4:29 PM
    The csv getting exported is generating a new row due to the the text within a specific column.
    g
    • 2
    • 2
  • How do I login via token with supabase v2 auth?
    l

    lewisd

    09/29/2022, 8:50 PM
    In react native, I need to login via redirect and with a token.
    Copy code
    Linking.addEventListener('url', event => {
        let urlString = event.url.replace('app#', 'app?');
        let url = new URL(urlString);
        console.log({url});
        let refreshToken = url.searchParams.get('refresh_token');
        console.log({refreshToken});
        if (refreshToken) {
          supabase.auth.getUser(refreshToken).then(res => {
            setCurrentUser(res.data.user);
          });
        }
      });
    I don't think
    getUser
    is the right thing to be using here? This is using the Google provider btw. It worked using
    1.5
    but auth has obviously changed and the docs aren't completed yet.
    g
    • 2
    • 2
  • Client-side data fetch with RLS
    b

    BoogersLLC

    09/29/2022, 9:08 PM
    Hello, I'm following the 0.7.0+ Svelte-Kit Auth implementation and I've followed this documentation quite closely: https://supabase.com/docs/guides/auth/auth-helpers/sveltekit#client-side-data-fetching-with-rls ^^ Even though I check for
    user
    and it is populated, the
    supabaseClient
    call will still make my call with my
    anon
    key and not the user's token. Thus, every time I refresh the page, all queries return an empty array.
    Copy code
    typescript
    async function loadData() {
      const { data } = await supabaseClient
               .from('test')
               .select('*');
      loadedData = data;
    }
    
    $: if ($page.data.session.user) {
      loadData(); // <-- This returns [] on load
    }
    Unless, I wrap the supabaseClient call in
    setTimeout(()=>{},0)
    . This feels like a hack and I'm wondering what I'm missing?
    Copy code
    typescript
    $: if ($page.data.session.user) {
      setTimeout(() => loadData(), 1);
      // ^^ -- This works but feels hacky
    }
    --- I saw someone made a similar post but using nextjs, that post said not only do you have to look for the user, but also
    isLoadingUser
    . Looking through the documentation I don't see any mention of that or understand if that's a purely nextjs/react thing?
    g
    • 2
    • 8
1...343536...230Latest