https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • I don't understand this chart
    n

    nateland

    03/22/2023, 3:53 PM
    It says I have 98% of budget
    remaining
    . But then I get a notification to upgrade my instance. What on earth is going on?
    g
    o
    n
    • 4
    • 94
  • Data is not being fetched on Next 13 App folder
    r

    rbravo

    03/22/2023, 4:44 PM
    The result of the queries are super inconsistent, have anyone noticed this? Maybe I'm doing something wrong but this looks super weird...
    g
    m
    +2
    • 5
    • 7
  • insert array limit
    a

    Ari

    03/22/2023, 4:58 PM
    Hi, using the JS sdk I was wondering if there is a limit to the size of the array being passed to the insert function when inserting rows to a table
    o
    • 2
    • 2
  • Storage new row violates row-level security policy
    n

    Nokorbis

    03/22/2023, 5:38 PM
    Hello, I'm trying to insert a new image in a supabase storage but I'm having an issue with the security policies.
    Copy code
    ts
    const fileName = profile.user_id + '/avatar' + extension;
    
    let { data: storageData, error: storageError } = await supabase.storage
                .from('avatars')
                .upload(fileName, file, { upsert: true });
    The response :
    Copy code
    json
    {"statusCode":"403","error":"","message":"new row violates row-level security policy for table \"objects\""}
    I've checked all the storage policies but I don't get what isn't working. First there was a check on the
    authenticated
    role and the folder name, but I've set everything to true and still nothings work. The
    avatars
    bucket is a public one. I'm logged in as a user and I'm using Sveltekit + Auth UI helper. Does anyone see what is wrong ?
    • 1
    • 1
  • cron timezone?
    s

    sudoramen

    03/22/2023, 5:48 PM
    New to scheduling cron jobs in postgres and I need to schedule one at a specific time during the day (8am PT). What timezone would this be run in? I'd like to know what to adjust the schedule to. Thanks!
    • 1
    • 1
  • Syntax for default value array with auth.uid()?
    j

    jopfre

    03/22/2023, 7:54 PM
    I have a column with type uuid[]. I want the default value to be an array containing the current user's user id. I have tried various permutations around {auth.uid(}} but I always get a syntax error. If I put auth.uid() as a default value in a non array column it works. And so does putting {} as default value in my column. How can I combine the two syntaxes?
    g
    • 2
    • 2
  • Job queue?
    s

    shiftkeyisbroke

    03/22/2023, 7:57 PM
    My project needs a queue and my default option is to use AWS SQS. I don't have high throughput needs, but I do need to be able to inspect the queue length to trigger resource rebalancing on the consumption end. Most of my project lives on Supabase, so I'm curious if there's an easier way to get a queue set up maybe using Postgres? I was looking at maybe
    pg-boss
    , but not sure how easy that will be to set up in Supabase's Postgres instance.
    a
    • 2
    • 1
  • NextJS Service Role Row level security
    c

    Clariityy

    03/22/2023, 8:11 PM
    I have a users table, with an allow all policy attached for service_role. I have a nextjs serverless function that is trying to insert into that table. I have created a client in the following way:
    Copy code
    import { createServerSupabaseClient } from "@supabase/auth-helpers-nextjs";
    ...
    const supabase = createServerSupabaseClient(
        {
          req,
          res,
        },
        {
          supabaseUrl: process.env.NEXT_PUBLIC_SUPABASE_URL,
          supabaseKey: process.env.SUPABASE_SERVICE_KEY,
        }
      );
    On execution I'm still getting the error:
    new row violates row-level security policy for table "users"
    g
    a
    • 3
    • 6
  • .Net 6 Blazor not using CustomAuthStateProvider
    g

    genesisisamazing

    03/22/2023, 8:16 PM
    Hi, I can't seem to get C# Blazor (.Net 6) to work. It doesn't seem to use CustomAuthStateProvider so
    .User.Identity.IsAuthenticated
    always returns false. if I change AuthenticationStateProvider in AuthService.cs to CustomAuthStateProvider, it can authenticate but then the pages can't detect it so returns unauthenticated.
    Copy code
    builder.Services.AddScoped<AuthenticationStateProvider, CustomAuthStateProvider>(
        provider => new CustomAuthStateProvider(
            provider.GetRequiredService<ILocalStorageService>(),
            provider.GetRequiredService<Supabase.Client>(),
            provider.GetRequiredService<ILogger<CustomAuthStateProvider>>()
        )
    );
  • Limit results of a foreign table ?
    v

    vexkiddy

    03/22/2023, 8:23 PM
    Consider the following code:
    Copy code
    let builder = supabaseInit.from('drops').select(`*,
        collectibles (*),
        attendance (*, profile(*)),
        profile ( profile, profileImage )
        `)
    How would we limit the results / rows of the foreign table
    attendance
    in the above example ?
    • 1
    • 1
  • Nextjs 13.2 issues with supabase server root rendering on some pages (will pay someone to help)
    c

    coop

    03/22/2023, 8:25 PM
    Since updating from 13.1.6 to 13.2.4, My build works locally but when deployed on Vercel it doesn't render with SyntaxError: "undefined" is not valid JSON at JSON.parse () at 455-9ec651f86fca52fe.js:17:2502 at x (455-9ec651f86fca52fe.js:17:3359) at t (455-9ec651f86fca52fe.js:17:5826) My set up is pretty much identical to the supabase auth helper (some pages are login gated, other are note ) https://github.com/supabase/auth-helpers/tree/main/examples/nextjs-server-components Its hard to debug without being able to recreate locally so I am willing to hire someone as a contractor to help me debug - adding
    import 'server-only'
    to server files seemed to help partially but thats confusing because I thought all app folder things are default server side - Wondering if its a key issue for a public database?
    • 1
    • 1
  • Brand new database starting size 75~mb ?
    m

    MusashiGarami

    03/22/2023, 8:28 PM
    I'm not saying anything is wrong, but just out of curiosity, is this normal to have a brand new DB with 1 table, practically nothing in it, and DB is 75mb ? I'm assuming it's system tables, logs, etc. etc. etc. Just incase I'm doing something stupid would be cool to have confirmation this is normal.
    g
    n
    • 3
    • 6
  • Listing all the buckets returns empty list
    m

    mostly_harmless

    03/22/2023, 9:19 PM
    I've created a bucket called 'photos' in my storage but calling listBuckets() always returns an empty list. Are there any policies that need to be set to get this working? my code is: const user = await getUserId(); console.log("user", user); const {data, error } = await supabaseClient.storage .listBuckets(); console.log("buckets", data, error); im getting a user which means I am authenticated but still getting no bucket returned
    g
    • 2
    • 3
  • Unable to get Insert updates on a table
    g

    goldyman

    03/22/2023, 9:48 PM
    I'm using flutter. I use rpc to get my data from the db. But I want to know when i have new items in a table to make another rpc request. here is my code for a bloc that starts listening to a table inserts.
    Copy code
    dart
    class GiftsRealtimeBloc extends Bloc<GiftsRealtimeEvent, GiftsRealtimeState> {
      GiftsRealtimeBloc({
        required SupabaseClient supabaseClient,
      })  : _supabaseClient = supabaseClient,
            super(GiftsRealtimeState.initial()) {
        on<UpdateData>(_onUpdateData);
        channel = _supabaseClient.channel('public:gifts');
        channel.on(
          RealtimeListenTypes.postgresChanges,
          ChannelFilter(event: 'INSERT', schema: 'public', table: 'gifts'),
          (payload, [ref]) {
            log(payload.toString());
            log(ref.toString());
            add(UpdateData(payload as List<Map<String, dynamic>>));
          },
        ).subscribe();
      }
    
      final SupabaseClient _supabaseClient;
      late final RealtimeChannel channel;
    
      void _onUpdateData(
        UpdateData event,
        Emitter<GiftsRealtimeState> emit,
      ) {
        emit(state.copyWith(data: event.data));
      }
    
      @override
      Future<void> close() async {
        await _supabaseClient.removeChannel(channel);
        return super.close();
      }
    }
    the callback never fires
    Copy code
    dart
    (payload, [ref]) {
            log(payload.toString());
            log(ref.toString());
            add(UpdateData(payload as List<Map<String, dynamic>>));
          },
    I'm sure the channel is instantiated.
    g
    • 2
    • 1
  • Returning Row Type from Function
    m

    mansedan

    03/22/2023, 10:21 PM
    Hey team (gary?), How can I set this function to return rows from my events table? (All Columns)
    Copy code
    sql
    CREATE OR REPLACE FUNCTION find_event_by_team(
        team_name TEXT,
        event_time TIMESTAMP,
        sport_name TEXT
    )
    RETURNS SETOF events%ROWTYPE AS $$
    BEGIN
        RETURN QUERY
        SELECT e.*
        FROM events e
        INNER JOIN sports s ON e.sport_id = s.sport_id
        INNER JOIN teams t1 ON e.away_team = t1.team_id
        INNER JOIN teams t2 ON e.home_team = t2.team_id
        WHERE e.date_event = event_time
        AND s.sport_name = sport_name
        AND CONCAT(t1.name, ' ', t1.mascot, ' @ ', t2.name, ' ', t2.mascot) = team_name;
    END;
    $$ LANGUAGE plpgsql;
    When I go to create this I get the following error: > Failed to validate sql query: syntax error at or near "%"
    g
    • 2
    • 3
  • How can you check if a user confirmed their email through the magic link upon signup (in Flutter)?
    h

    heedongcho-xyz

    03/23/2023, 12:04 AM
    I'm building an app and I want the user to have confirmed their email before going to the home screen. That's why I need a way to check whether or not the user clicked on the magic link (I have Confirm Email enabled)
  • Is in() operation guaranteed to return values based on order in array
    m

    maglev

    03/23/2023, 12:12 AM
    Hi ,for the in() operation in the supabase-js client, if I were to search based on id like:
    Copy code
    const { data, error } = await supabase
      .from('contacts')
      .select()
      .in('id', ['id1', 'id2', 'id3'])
    are the results returned guaranteed to be in the order of [id1, id2, id3] and if not is there a way to returned the ordered results? Thanks.
    g
    • 2
    • 10
  • Existing Enterprise Users? What larger companies use Supabase?
    b

    baocin

    03/23/2023, 12:53 AM
    Hi, I'm justifying Supabase to my business as the foundation for a new project and it would help immensely to have a few references to larger companies using Supabase (externally or internally). The best I've found is the graphic of companies on the Supabase blog - https://supabase.com/blog/supabase-enterprise but details are lacking. Existing case studies are all relatively smaller companies - https://supabase.com/blog/tags/case-study. Thanks!
  • RLS Between Two Tables
    b

    BoogersLLC

    03/23/2023, 3:03 AM
    I'm having an issue with shared data / user management in RLS 😦 Given two tables: -
    x
    -
    x_users
    x
    has any arbitrary values which would be shared 1-to-many-users To determine if
    x
    can be seen by someone other than it's owner, it must exist in
    x_users
    Thus, important columns in
    x_users
    are - x_id - user_id So to SELECT
    x
    where you have a user
    Copy code
    sql
    (EXISTS ( SELECT 1 FROM x_users WHERE ((x_users.x_id = x.id) AND (auth.uid() = x_users.user_id))))
    to see
    x_users
    where you can see
    x
    Copy code
    sql
    (EXISTS ( SELECT 1 FROM x WHERE (x.id = x_users.x_id)))
    You end up with an infinitely recursive pair of RLS rules. How could I adjust my structure to: - Allow users access to a row in
    x
    - Allow other users to see what
    x_users
    have access to that row in
    x
    g
    • 2
    • 5
  • Auth Password Reset Python
    s

    Sniped137

    03/23/2023, 4:17 AM
    I've had a decent look through the doc and the python supabase doesn't have anything as far as I can see for sending a password reset or email verification on demand. Is there a way I can pass in a specified email similar to the sign in function and it'll reset the password from that?
  • roblox to supabase
    j

    Jinx

    03/23/2023, 4:28 AM
    Trying to connect roblox to supabase
    n
    • 2
    • 4
  • Fetch issues
    s

    sam the monkey

    03/23/2023, 5:17 AM
    Hello! I'm trying to get data from my public database with a table called
    clotho_dataset
    . I've wrapped my
    _app.tsx
    in a supabase
    SessionContextProvider
    component and I've passed in my
    supabaseClient
    (created using my SB key and SB endpoint url). Then, in a child component I tried to access my SB client like so: 1. I create a variable
    const supabaseContext = useSessionContext()
    . 2. I get my SB client as:
    const supabaseClient = supabaseContext.supabaseClient as SupabaseClient;
    . In the next line I get my error:
    console.log(supabaseClient.from("clotho_dataset").select("*"));
    The error shown in chrome is:
    TypeError: supabaseClient.from is not a function
    . I'm inexperienced with Next.js and supabase, any help as to whats going is appreciated. Thank you!
  • Is it possible to execute this query using supabase-js
    r

    rajamaka

    03/23/2023, 5:28 AM
    SELECT data, path FROM document WHERE data @@ '$.foo != "bar"'; the data column is jsonb and @@ is a jsonpath operator https://www.postgresql.org/docs/12/functions-json.html
    s
    g
    • 3
    • 3
  • Moving calculations from the client to supabase backend
    t

    Tiago

    03/23/2023, 7:22 AM
    I have a couple complex calculations on the client side that use data from supabase to show a couple of things to the user. As and example I am calculating the PMT for a mortgage loan in my client with the following function:
    Copy code
    const calculatePMT = (rate, nper, pv, fv) => {
      let pmt, pvif;
      fv || (fv = 0);
      if (rate === 0) return (pv + fv) / nper;
      pvif = Math.pow(1 + rate, nper);
      pmt = (rate * (pv * pvif + fv)) / (pvif - 1);
      return pmt;
    };
    
    export default calculatePMT;
    All the existing variables are stored on supabase. What would be the best approach to make this calculation on supabase? Thank you for the help
    g
    • 2
    • 4
  • A cron job is executed multiple times
    a

    ArdaBasoglu

    03/23/2023, 9:59 AM
    I have noticed that a cron job is being executed multiple times, even though the "SELECT * FROM cron.job" command only shows one instance of it. Specifically, it appears to be running twice according to its schedule. When I tried to remove the job using the "SELECT cron.unschedule('my_cron_job')" command, one instance of the job persisted and continued to run. Ultimately, I resorted to dropping the pg_cron extension, but one instance of the job still persisted for a period of time. After a few minutes, the cron job finally ceased running altogether.
    g
    • 2
    • 1
  • Create user without email confirmation
    s

    SELIM HÜR

    03/23/2023, 11:38 AM
    Hi friends, i want to create user without email confirmation, i try like below confirmation_sent_at with current date but it gives an error final AuthResponse res = await supabase.auth.signUp( email: email, password: password, data: {'username': username, 'confirmation_sent_at': DateTime.now()}, ); // final Session? session = res.session; // final User? user = res.user; context.showSnackBar(message: 'Please check your inbox for confirmation email.'); } on AuthException catch (error) { context.showErrorSnackBar(message: error.message); } catch (error) { debugPrint(error.toString()); context.showErrorSnackBar(message: unexpectedErrorMessage); }
    t
    g
    • 3
    • 5
  • Edge Functions: error 406 when called from Database trigger
    b

    boeledi

    03/23/2023, 11:39 AM
    Hello. I am totally lost and I am asking for your help. I have written a basic Edge Functions that queries the database, based on an input (say: "user_id") I works perfectly when I am invoking it from curl, for example. But, I would like this Edge Functions to be called by the database (on record insert).
    Copy code
    BEGIN
      PERFORM http((
              'POST',
               'https://<ref>.functions.supabase.co/ef_send_email',
               ARRAY[http_header('Authorization','Bearer <ANON.PUBLIC KEY>')],
               'text/plain',
               '{"user_id": ' || NEW.user_id || '}'
            )::http_request);
     
      RETURN NEW;
    END;
    From the logs, I see that the invocation arrives at the level of the Edge Functions, but as soon as I am launching a query, such as:
    Copy code
    const { data, error } = await supabaseClient
          .from("t_user")
          .select()
          .eq('user_id', user_id )
          .maybeSingle();
    I have NO errors, but data is null. From the logs (API Edge Network), I see a status code 406. Any help more than welcome. Many thanks in advance,
    g
    • 2
    • 6
  • Not able to post to table, even though no policies have been created
    s

    Sheepii

    03/23/2023, 12:03 PM
    I am getting a 403 forbidden despite there being no policies created for this table
    s
    • 2
    • 12
  • Querying inner join in realtime changes
    t

    Talajax

    03/23/2023, 12:04 PM
    Hi, i want to retrieve data in realtime, but my table has a foreign key, so i was trying to query it as this:
    Copy code
    dynamic streamWorkoutExercises(String division) {
    
        String query = '''*
                           , exercise:exercise (*)
                          ''';
        return supabase
            .from('workout_exercises')
            .stream(primaryKey: ['id']).select(query).eq('division', division);
      }
    But i can't use select when streaming. How should i do it?
    g
    • 2
    • 1
  • [Dashboard] Minor UI bug when swapping schema in editor
    n

    NanoBit

    03/23/2023, 12:17 PM
    Hello, I wanted to ask before I report this. I noticed that the Table editor got a slight update. However, I noticed that when swapping schema, it does not refresh/show the tables in that schema. Is anyone else experiencing this? For example: 1. In public schema. 2. Swap to auth schema 3. Tables are still showing from public schema. 4. Need to manually press "refresh" button to show table in the newly select schema. Edit: I notice that it changes after a few second to minute. Maybe due to some auto refresh.
1...176177178...230Latest