https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Trying to get filter by dates
    f

    formigueiro

    05/19/2023, 3:02 PM
    Hi, im trying to get data by date, but im getting this error
    Copy code
    js
    
      const startOfMonth = spacetime().startOf('month').format('iso');
      const endOfMonth = spacetime().endOf('month').format('iso');
    
          const { data: statisticsData } = await supabase
            .from('url_data')
            .select('*, clicks(*)')
            .eq('slug', slug)
            .filter((query) => {
              return query
                .gte('clicks.created_at', startOfMonth)
                .lte('clicks.created_at', endOfMonth);
            })
            .single();

    https://cdn.discordapp.com/attachments/1109133886346235904/1109134192895336498/image.png▾

    g
    • 2
    • 14
  • Supabase image transformations for multiple sizes needed
    m

    magenta

    05/19/2023, 4:04 PM
    Hi I'm using svelte and supabase with a multi-user blogging CMS site. The images are stored (and user-uploaded) in Supabase. I have a single component that displays the image differently depending if it's in the post view/edit, or in the grid of cards. Is it possible to use supabase image transform to pull two different image sizes? Currently I have this - is it possible to add another transform there, or do I need to make a different function for the other size? export const getImage = async (url: string) => { const { data, error: downloadError } = await imageBucket('images').download(url, { transform: { width: 320, height: 144 } }); if (downloadError) { throw downloadError; } return URL.createObjectURL(data); };
    g
    • 2
    • 1
  • supabase failed to create pg.tables: permission denied for schema public
    o

    owodunni

    05/19/2023, 4:14 PM
    Hello, I'm trying to create a new table in the public schema. But it seams I'm not allowed. I don't think I have done anything in particular regarding permissions to mess it up. If I create a new project it all works as expected. I'm using the hosted version Any help would be much appreciated.
    g
    h
    • 3
    • 13
  • API Response sending empty packages
    h

    Hugo Peran

    05/19/2023, 4:26 PM
    I'm trying to upload data with a single script that updates one table with another table. For this to work I need an id common to both tables. So I make 1first call to my "companies" table, and the results are uploaded. Rows are created But no id **is returned to me via response package (**so I could use the table ID as joint for my next call). Actually it seems that no Data is returned. This is what my terminal is sending back (node:5836) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification. (Use
    node --trace-warnings ...
    to show where the warning was created) { error: null, data: null, count: null, status: 201, statusText: 'Created' } I did follow the instructions and tried either .single() or .select() to have a response back. But nothing came Here is my trial code for a single row insertion, that **DOES create a new row in my Supabase table But gives me no response in terminal.** const fs = require('fs'); const csv = require('csv-parser'); const { createClient } = require('@supabase/supabase-js'); const SUPABASE_URL = "" const SUPABASE_ANON_KEY = ""; process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY); async function insertSingleRecord() { const newCompany = { name: 'Test Company', country: 'Test Country', company_website_url: 'https://testcompany.com', founded: 2000, industry: 'Test Industry' }; const { data, error } = await supabase .from('companies') .insert(newCompany) .single(); if (error) { console.log(
    Error inserting data: ${error.message}
    ); } else if (data) { console.log(
    Inserting company data: ${data}
    ); } else { console.log(
    Unexpected response: ${JSON.stringify({data, error}, null, 2)}
    ); } } insertSingleRecord();
    g
    • 2
    • 28
  • "Passed nonce and nonce in id_token should either both exist or not." React Native
    a

    alphaboy

    05/19/2023, 4:48 PM
    I am facing this issue when try to sign in user using
    signInWithTokenId
    (google). Anyone has any idea? I am using this package to login my user via google and get the `idToken`: https://github.com/react-native-google-signin/google-signin
    • 1
    • 1
  • supabase sesumable
    m

    Mhamad Othman

    05/19/2023, 5:01 PM
    hello everyone , i have a problem with resumable method , this is my code and the file gets uploaded to supabase but it shows this error to console , the error:- HEAD https://myprojectid.supabase.co/storage/v1/upload/resumable/Y29udGVudC9sZWN0dXJlLnBuZy8zZThhYmQ2Yy0yMWM3LTQ4ZmItOTFlZi1hMDNlZGFhYWQ3M2Q 500 my code:- const uppy = new Uppy().use(Tus, { endpoint: supabaseUploadURL, headers: { authorization:
    Bearer ${userJWT}
    , }, uploadDataDuringCreation: true, chunkSize: 6 * 1024 * 1024, allowedMetaFields: [ "bucketName", "objectName", "contentType", "cacheControl", ], }); my rls for the bucket is this:- CREATE POLICY "dw 1tghu4n_0" ON storage.objects FOR UPDATE TO authenticated USING (bucket_id = 'banners'); idk what the error is but my file gets uploaded but i dont want any console error
    g
    • 2
    • 2
  • Supabase setting up incorrect reset password redirect URL
    b

    bombillazo

    05/19/2023, 6:31 PM
    Hello, I am trying to reset password form our app using the client:
    Copy code
    tsx
       const { error } = await supabase.auth.resetPasswordForEmail(email, {
          redirectTo: '/update-password',
        });
    But this is the link we get in our email:
    Copy code
    https://PROJECT.supabase.co/auth/v1/verify?token=ABCD&type=recovery&redirect_to=https://our.domain.com/
    We expect to see
    &redirect_to=https://our.domain.com/update-password
    We have setup in the supabase auth/email section these emails: Site URL: - https://our.domain.com/ Redirect URLs - https://our.domain.com - https://our.domain.com/** Why would supabase not respect the
    redirectTo
    parameter?
    g
    • 2
    • 3
  • SessionContextProvider constantly re-rendering
    n

    nlarusstone

    05/19/2023, 9:35 PM
    All of a sudden, I started seeing a massive number of re-renders (see screenshots) and it seems like this is due to the session getting invalidated consistently. Not quite sure where to start debugging this, so any pointers would be helpful here! Versions:
    Copy code
    "@supabase/auth-helpers-nextjs": "^0.5.2",
        "@supabase/auth-helpers-react": "^0.3.1",
        "@supabase/auth-ui-react": "^0.3.5",
        "@supabase/gotrue-js": "^2.13.0",
        "@supabase/supabase-js": "^2.2.0",

    https://cdn.discordapp.com/attachments/1109232958960832523/1109232959451562034/Screen_Shot_2023-05-19_at_2.31.57_PM.png▾

    https://cdn.discordapp.com/attachments/1109232958960832523/1109232959820664832/Screen_Shot_2023-05-19_at_2.31.08_PM.png▾

  • dart edge function environment variable
    a

    Agon

    05/19/2023, 10:27 PM
    how to get env vars in edge functions with dart?
  • Problem with OAuth login with flutter web
    z

    zwarag

    05/19/2023, 10:30 PM
    Copy code
    dart
    import 'package:flutter/foundation.dart';
    import 'package:flutter/material.dart';
    import 'package:flutter_riverpod/flutter_riverpod.dart';
    import 'package:spacevault_cash/constants.dart';
    import 'package:supabase_flutter/supabase_flutter.dart';
    import 'package:supabase/supabase.dart' as supabase_;
    
    import '../services/supabase_service.dart';
    
    class TestPage extends ConsumerWidget {
      const TestPage({Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context, WidgetRef ref) {
        final user = ref.watch(userProvider);
        print(supabase.auth.currentSession);
    
        // Use the user variable here
        return ElevatedButton(
          onPressed: () {
            ref.read(supabaseProvider).auth.signInWithOAuth(
                supabase_.Provider.github,
                redirectTo: kIsWeb ? null : authRedirectUrl);
          },
          child: Text(user != null ? 'Logged in' : 'Login'),
        );
      }
    }
    I'm having trouble authenticating users when using the web client. When clicking on the button, the user gets redirected to github. After entering valid credentials, the users gets sent back to the application, however
    supabase.auth.currentSession
    prints
    null
    . However, I can see the access_token in the url bar, so it should actually have everything it needs. Any Ideas? PS: This works fine for iOS and Android
  • AuthApiError: null value in column "username" of relation "profiles" violates not-null constraint
    h

    Hugos

    05/19/2023, 11:33 PM
    I'm a bit confused on how to pass meta data into postgres functions because I keep getting null value's, for context this is a supabase project using sveltekit auth helpers.
    Copy code
    js
            const { error } = await supabase.auth.signUp({
                email: form.data.email,
                password: form.data.password,
                options: {
                    data: {
                        username: form.data.username
                    }
                }
            });
    
            console.log(error);
    Copy code
    sql
    create or replace function public.handle_new_user()
    returns trigger
    language plpgsql
    security definer set search_path = public
    as $$
    begin
      insert into public.profiles (user_id, username)
      values (new.id, new.raw_app_meta_data->>'username');
      return new;
    end;
    $$;
    • 1
    • 2
  • Graphql not working with table moved from another schema
    t

    truongsinh

    05/20/2023, 1:50 AM
    If I created a new table in another schema, then move this table to "public" schema, GraphQL does not know this table exists. Worse, if I delete the exisiting
    public
    schema, and rename another schema to
    public
    , then nothing works.
    select graphql.rebuild_schema()
    is no longer availalbe
  • many to many
    m

    mitchmeister

    05/20/2023, 2:56 AM
    Hi. I'm trying to connect to Supabase vis Tableplus and I'm getting this error
    Copy code
    connection to server at "db.XXXX.supabase.co" (9.9.9.9), port 5432 failed: Connection refused
    Is the server running on that host and accepting TCP/IP connections?`
    I've changed nothing since I last logged in a week ago. Any ideas why this might be? (API access is working)
    • 1
    • 1
  • using app_metadata for properties in RLS
    a

    AdamJensen

    05/20/2023, 4:34 AM
    Hi, I am writing a policy to only allow users whose roles (a string[]), inside the
    app_metadata
    property, contains a string 'internal-admin'. I have written the following so far, but am unsure as to check if that array contains one property (it can contain many properties btw).

    https://cdn.discordapp.com/attachments/1109338215288164425/1109338215770488883/rls.PNG▾

    g
    • 2
    • 2
  • I have this image url, i want to upload the image from this url to supabase storage...how do i do it
    a

    Arinji

    05/20/2023, 7:03 AM
    pls help lmao
    • 1
    • 1
  • Integrating Supabase auth users into Prisma
    o

    O2K

    05/20/2023, 7:17 AM
    Im using supabase DB with prisma, and also supabase auth for the users. I want to integrate the Supabase auth users /schema into my prisma. I found this: https://supabase.com/docs/guides/integrations/prisma#using-supabase-auth-with-prisma But I didnt find it informative enough. For example, how can I develop in my localhost DB if my users only exist remotely in supabase auth? Should I run supabase locally? Basically looking for an extensive guide to integrate Prisma with Supabase Auth so I can connect my user table with my other tables. Thanks!
    n
    • 2
    • 3
  • Access supabase from any file in Sveltekit project
    s

    Sanctus

    05/20/2023, 8:09 AM
    I went back to an older project and proceeded to migrate from 0.8 to 0.9 of the @supabase/auth-helpers-sveltekit library. I see much better now the advantages brought by the 0.9# version. However, I have a question about what is the best practice to access the DB from a component or any .ts file. For example, before I used to do the following:
    Copy code
    ts
    import { supabase } from '$lib/db/supabase'
    import type { BrdElem } from '$lib/types'
    
    export async function updateBrdElemPos(brdElem: BrdElem): Promise<void> {
        const { error } = await supabase.from('element').update({ pos: brdElem.pos }).eq('id', brdElem.id)
    
        if (error) console.log(error)
    }
    However now supabase is defined in the +layout.ts file. It makes it really easy to access via
    load
    in the "+" files, but I don't know how to access it from regular .svelte or .ts files.
    s
    • 2
    • 1
  • How to set the cookie expiry date in nextjs 13 in the app folder
    u

    useless

    05/20/2023, 8:33 AM
    i am using nextjs 13 with
    /app
    ,
    supabase auth
    &
    supabase/auth-helpers-nextjs
    . when i log in, the
    user data
    and
    session
    are being stored in the
    local storage
    and i don't want them visible for the user in the console. Moreover, how can i increase the
    cookie's max-age/ expiry date
    .
    s
    • 2
    • 3
  • Problem with OAuth login with flutter web
    z

    zwarag

    05/20/2023, 9:32 AM
    Copy code
    dart
    import 'package:flutter/foundation.dart';
    import 'package:flutter/material.dart';
    import 'package:flutter_riverpod/flutter_riverpod.dart';
    import 'package:spacevault_cash/constants.dart';
    import 'package:supabase_flutter/supabase_flutter.dart';
    import 'package:supabase/supabase.dart' as supabase_;
    
    import '../services/supabase_service.dart';
    
    class TestPage extends ConsumerWidget {
      const TestPage({Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context, WidgetRef ref) {
        final user = ref.watch(userProvider);
        print(supabase.auth.currentSession);
    
        // Use the user variable here
        return ElevatedButton(
          onPressed: () {
            ref.read(supabaseProvider).auth.signInWithOAuth(
                supabase_.Provider.github,
                redirectTo: kIsWeb ? null : authRedirectUrl);
          },
          child: Text(user != null ? 'Logged in' : 'Login'),
        );
      }
    }
    I'm having trouble authenticating users when using the web client. When clicking on the button, the user gets redirected to github. After entering valid credentials, the users gets sent back to the application, however
    supabase.auth.currentSession
    prints
    null
    . However, I can see the access_token in the url bar, so it should actually have everything it needs. Any Ideas? Just for context: This works fine for iOS and Android
  • useUser crashes tab when switching between tabs
    u

    0xMatei.nft

    05/20/2023, 10:52 AM
    Seems like using the useUser hook in Nextjs 13 with pages dir causes a crash on any browser (Firefox, Brave) when i keep it at the top of the component. So something like:
    Copy code
    typescript
       export default function Dashboard() {
        const supabaseClient = createBrowserSupabaseClient();
        const [loading, setLoading] = useState(true);
        const router = useRouter();
        const user = useUser();
    causes the tab to crash when switching between any tab and the Supabase app tab
    • 1
    • 1
  • Oauth redirectTo not working with persistent hash
    f

    Franck

    05/20/2023, 11:07 AM
    I am really struggling getting my oauth redirect to work. Context: Nextjs (pages directory) I18next for localization using auth helpers having my redirect urls setup. I want my users to sign in/up through a modal, once they sign, they should be redirected to
    baseurl/locale/dashboard
    before clicking on sign in with google the url looks like this:
    baseurl/locale
    once signed in the url is
    baseurl/locale#
    It never goes to
    /dashboard
    , despite having it setup properly in my redirect URLs with and without wildcards Any idea how I could solve this? Could it be because the auth occurs in a modal? Could it be because of the locale being loaded a soon as the page refresh? Thanks
    p
    • 2
    • 2
  • "null" and "method not found" errors in snack bar when INSERT operation is successful
    j

    Johnny Robert

    05/20/2023, 11:18 AM
    Hello, I have setup a waitlist table with 4 policies, the users are supposed to only have access to insert themselves into the table, however I couldn't find a way to do it without also offering them public read access in my policies, so I need some help with the function & policies. I am also trying to trigger an error message if the user email is already on the waitlist, for that I had to use a rethrow so that my " if (e is PostgrestException && e.code == '23505') { _isEmailAlreadyRegistered = true;" works, otherwise it will not get triggered but that causes the user to always receive a snackbar error upon succesful signing up for the waitlist.

    https://cdn.discordapp.com/attachments/1109440067736457320/1109440068197810216/Screenshot_at_May_20_14-14-03.png▾

    https://cdn.discordapp.com/attachments/1109440067736457320/1109440068558524548/Screenshot_at_May_20_14-14-32.png▾

    n
    • 2
    • 30
  • Support for Column Level Security?
    c

    Corrupted

    05/20/2023, 12:29 PM
    Is there a way we achieve this kind of functionality? I have an “updated_at” column that should get updated by a service role, or some automated process, but the user should not be able to manually update this column, only read them. Any ideas?
    n
    • 2
    • 2
  • Email and Phone OTP
    s

    shnoman

    05/20/2023, 12:34 PM
    Hi team, How we can add both email and phone for the same user and verify both with otp. And user can log in with otp if he adds either an email or phone number. This means both are passwordless. Thanks
    c
    • 2
    • 3
  • How to config the super user role setting at self-host?
    w

    Weykon

    05/20/2023, 12:51 PM
    I want to know, when I build a project using supabase and self-host. as a owner of project I got a super user having ability read all of users data. I think some private data of users even though the super user can not read that. I find the option named "user bypasses every row level security policy", I want to turn off for super user which user I enter the supabase local studio .

    https://cdn.discordapp.com/attachments/1109463407075262495/1109464223878238208/image.png▾

    • 1
    • 1
  • Serving functions with legacy supabase/deno-relay
    a

    Agon

    05/20/2023, 12:51 PM
    Copy code
    Serving functions with legacy supabase/deno-relay:v1.6.0... Run functions serve instead to use Edge Runtime.
    why is it saying legacy?
    s
    • 2
    • 4
  • Create a public.users row after a auth.users row
    j

    Jessy

    05/20/2023, 1:09 PM
    Hello, I tried to create a user after the auth automatically. I write this function: handle_new_user, Schema public, return type trigger BEGIN IF NOT EXISTS (SELECT 1 FROM users WHERE id = NEW.id) THEN INSERT INTO users (id, email) VALUES (NEW.id, NEW.email); ELSE UPDATE users SET email = NEW.email WHERE id = NEW.id; END IF; RETURN NEW; END; And I create a trigger: on_auth_users_created, schema auth, table user, function handle_new_user, event : After insert, Enabled mode : Origin Do you know why it doesn't work?
    g
    • 2
    • 1
  • Best Way to upload over a million rows of data
    c

    cbunge3

    05/20/2023, 2:41 PM
    I have at least 10 - 30 tables anywhere between 500,000 rows to 2.5 million rows of data and doing it through the graphical interface in Supabase keeps failing either due to "Too Many Request" or an encoding error. The Too many requests makes sense but than is there a way to combat that? where i can automatcially get it to sync up with the correct filed types like Supabase does ? But the encoding error boggles me - is there a best way to encode to make uploading this amount easier and more efficient ?
    n
    t
    • 3
    • 2
  • function/trigger not working and no errors shown
    u

    .Volxen

    05/20/2023, 5:16 PM
    I am trying to insert information to a public.users table on every signUp so i added a trigger and a function but am getting an error after signing up
    g
    • 2
    • 8
  • Edge function fails bundling
    m

    Motz

    05/20/2023, 5:16 PM
    There was already a post in here regarding this issue, https://discord.com/channels/839993398554656828/1098545559926739098. The problem now is that it seems to have stopped working again. The error I'm getting looks like this:
    Copy code
    Version 1.30.3 is already installed
    Bundling verbesserer
    Error: Error bundling function: exit status 1
    file:///D:/Users/Matthias/Desktop/Development/web/verbesserer/supabase/functions/import_map.json
    error: Uncaught (in promise) Error: Error: Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch. (os error 123)
          const ret = new Error(getStringFromWasm0(arg0, arg1));
                      ^
        at __wbg_new_8d2af00bc1e329ee (https://deno.land/x/eszip@v0.35.0/eszip_wasm.generated.js:513:19)
        at <anonymous> (https://deno.land/x/eszip@v0.35.0/eszip_wasm_bg.wasm:1:1522549)
        at <anonymous> (https://deno.land/x/eszip@v0.35.0/eszip_wasm_bg.wasm:1:1398157)
        at <anonymous> (https://deno.land/x/eszip@v0.35.0/eszip_wasm_bg.wasm:1:1895031)
        at __wbg_adapter_40 (https://deno.land/x/eszip@v0.35.0/eszip_wasm.generated.js:229:6)
        at real (https://deno.land/x/eszip@v0.35.0/eszip_wasm.generated.js:213:14)
    Which is more or less similar to the post linked, but even though the update to eszip v0.35.0 is in, it still doesn't work. Maybe there is something wrong on my end? I'm running the latest version of supabase-cli (
    1.62.3
    )
    • 1
    • 1
1...220221222...230Latest