https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • supabase installation give Typescript error
    r

    ReactingMe

    05/26/2023, 11:15 PM
    Hello, I'm trying to install supabase on our repo, but running the cli installation codes resulted in an error:
    Copy code
    admin@AFVFHGQBRQ6L7 AIKnowledgebase % npm install -S @supabase/supabase-js
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE could not resolve
    npm ERR! 
    npm ERR! While resolving: class-variance-authority@0.4.0
    npm ERR! Found: typescript@5.0.4
    npm ERR! node_modules/typescript
    npm ERR!   typescript@"5.0" from the root project
    npm ERR!   peerOptional typescript@">=3.3.1" from eslint-config-next@13.2.4
    npm ERR!   node_modules/eslint-config-next
    npm ERR!     eslint-config-next@"13.2.4" from the root project
    npm ERR! 
    npm ERR! Could not resolve dependency:
    npm ERR! peerOptional typescript@">= 4.5.5 < 5" from class-variance-authority@0.4.0
    npm ERR! node_modules/class-variance-authority
    npm ERR!   class-variance-authority@"^0.4.0" from the root project
    npm ERR! 
    npm ERR! Conflicting peer dependency: typescript@4.9.5
    npm ERR! node_modules/typescript
    npm ERR!   peerOptional typescript@">= 4.5.5 < 5" from class-variance-authority@0.4.0
    npm ERR!   node_modules/class-variance-authority
    npm ERR!     class-variance-authority@"^0.4.0" from the root project
    npm ERR! 
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    npm ERR! 
    npm ERR!
    Can you help resolve this? Thanks in advance
    x
    o
    • 3
    • 5
  • Row-level security
    s

    seeinplays

    05/26/2023, 11:18 PM
    How do I add an update policy for my app?
    g
    • 2
    • 3
  • nextjs 13 supabase cookie can be read with javascript
    n

    nobyf

    05/26/2023, 11:49 PM
    Hi, I am trying to set up an app with nextjs 13 (with app router) and supabase, and setting up authentication for log in/log out with private page routes. I managed to set up a basic POC app using @supabase/auth-helpers-nextjs and @supabase/supabase-js. The problem is that when I log in, the cookie created is readable by javascript on the browser. (i.e. type "document.cookie" in the console.). Where can I change the cookie options such as httpOnly, secure, maxAge, etc. so that the cookie cannot be read by the front end,etc.? I am not sure if this is nextjs or supabase settings. Just for your refence, here is my repo https://github.com/nfabacus/supabase-nextjs13-example-app. Thank you in advance. 🙂
    g
    j
    • 3
    • 5
  • Supabase Unwanted egress data
    k

    kaswan24

    05/27/2023, 7:19 AM
    I am new to Supabase. Just now migrated from Firebase. As i am trying it out on free plan. I saw that unwanted egress data is seen in the Supabase console its way more than the amount of data i have in my database. Please help me out here
    g
    • 2
    • 1
  • Writing Rate Limits
    s

    skofff

    05/27/2023, 8:19 AM
    I'm trying to implement an app and am worried about supabase's scalability -- specifically pertaining to inserts, updates, and deletions. What are the practical write rate limits I should expect with a pro account on this platform? or with an enterprise account? For clarification, my concerns stem from the fact that supabase uses postgres, a relational db whereas I understand document based dbs to be generally faster due to ease of horizontal scaling and the nature of eventual consistency.
    g
    • 2
    • 2
  • How to create a "not contains any" filter in flutter
    w

    Wizzel

    05/27/2023, 9:15 AM
    I am trying to create a filter where the returned rows don't contain any of the provided values. The documentation https://supabase.com/docs/reference/dart/not says I need to provide raw postgrest syntax for the
    not
    filter. This is what I currently have:
    Copy code
    dart
         return baseQuery
                .select()
                .not('my_column', 'cs', '{"value1", "value2"}')
                .select();
    but this returns rows where any of the following statements are true: 1. contains "value1" and not "value2" 2. contains "value2" and not "value1" 3. does not contain "value1" and not "value2" How do I change the query so that I only get the 3. result? Replacing the
    cs
    operator with
    in
    throws an error:
    Copy code
    PostgrestException(message: "failed to parse filter (not.in.{"value1","value2"})" (line 1, column 5), code: PGRST100, details: unknown single value operator not, hint: null)
  • problems with uploading blob with expo
    u

    .Volxen

    05/27/2023, 11:17 AM
    I am trying to upload a blob to my avatars storage bucket but i keep getting POST ERROR 500 and am trying to make sure if its not a problem from my side

    https://cdn.discordapp.com/attachments/1111976451638562857/1111976542969532416/image.png▾

    g
    • 2
    • 9
  • How to mock storage service on flutter when performing integration - e2e tests
    b

    brt

    05/27/2023, 12:55 PM
    I'm writing a flutter app which uses Supabase as its backend. I'm using the bucket and messaging functionalities the following way, a quite standard one:
    Copy code
    dart
      await Supabase.initialize(
          url: dotenv.get('SUPABASE_URL'),
          anonKey: dotenv.get('SUPABASE_ANON_KEY', fallback: ''),
          debug: false);
      FirebaseMessaging messaging = FirebaseMessaging.instance;
    
      NotificationSettings settings = await messaging.requestPermission(
        alert: true,
        announcement: false,
        badge: true,
        carPlay: false,
        criticalAlert: false,
        provisional: false,
        sound: true,
      );
    
    ...
    
        final downloadedTraining = await Supabase.instance.client.storage
            .from('general')
            .getPublicUrl('trainings/2023-04-17.pdf');
    ...
        final dt = await Supabase.instance.client.storage
            .from('general')
            .download('/trainings/2023-04-17.pdf');
    ...
    And now I would like to mock the storage in order to always return an expected result when performing the e-2-e tests with patrol. Is it possible mocking just what I need i.e. storage.from('...').download? How can I achieve it? The two ways I've figured out are: - create a mock client you can give it to supabase when
    initialize
    is called (slow and complicated: you should check all the API calls and mock them) - adopting Dependency Injection, creating an interface and implement it one with Supabase, and another one with a mock (mockito or so) Supabase's IA talks about a
    supabase_flutter_test
    library, but I think it's totally wrong 😅
  • I can't install supabase
    k

    kameHame HA

    05/27/2023, 1:10 PM
    OS: Ubuntu 22 Node: 18.16.0 Error: https://ale.kto-pytal.pl/u/3BujEM Full response is in file https://cdn.discordapp.com/attachments/1112004885773299802/1112004885932671076/message.txt
  • Get object id for uploaded file
    y

    Yuu

    05/27/2023, 1:52 PM
    I upload a file:
    Copy code
    ts
            const { data, error } = await supabase.storage.from('attachments').upload(`attachments/${uniqueString}`, file.bytes, {
                contentType: file.type,
            })
    How I get the id of the storage object uploaded?
    g
    • 2
    • 49
  • Prisma trashed my database permissions
    d

    darksim

    05/27/2023, 2:32 PM
    Hi there, I ran a prisma db reset and forgot that it trashes the permissions on supabase and I was unable to create new users as there was permission denied on schema auth. The app also stopped working due to permission denied on public. I followed some guides online but they are all out of data and don't account for supabase_admin role not being modified and the presence of supabase_auth_admin. Is there an up to date guide or SQL command to fix and then verify the permission?
    g
    n
    • 3
    • 8
  • RLS policies defined in code
    d

    darksim

    05/27/2023, 2:42 PM
    Hi there, I want to define the RLS policies in code instead of using the UI. I saw that the feature is not yet in Prisma but is being worked on (https://github.com/prisma/prisma/issues/12735). Is there a better way to define these without using Prisma or the UI for now? I could always write some .sql files but that is kind of a kludge.
    d
    j
    g
    • 4
    • 6
  • system user? Policy
    d

    dmayo2

    05/27/2023, 2:44 PM
    Good Day. I have a trigger that calls a function which updates a table row. I'm having issues figuring out the policy. It works when RLS is off. Only the system, which I thought would be
    postgres
    but that doesn't work (the way I'm using it). I'd also like a policy that will let my app select that table. public.grammar_stats This table get's updated when a user checks the grammar. With this new row inserted, the Trigger fires to update: public.grammar_count which has one row with two columns .id and .total
    Copy code
    CREATE OR REPLACE FUNCTION update_grammar_count()
    RETURNS TRIGGER AS $$
    BEGIN
      UPDATE grammar_count
      SET total = total + NEW.char_count
      WHERE id = 1;
    
      RETURN NEW;
    END;
    $$ LANGUAGE plpgsql;
    
    DROP TRIGGER IF EXISTS grammar_count_insert_trigger ON grammar_stats;
    
    CREATE TRIGGER grammar_count_insert_trigger
    AFTER INSERT ON grammar_stats
    FOR EACH ROW
    EXECUTE FUNCTION update_grammar_count();
    and this is not allowing an update when RLS is enabled:
    Copy code
    -- Create a policy to allow system updates and inserts
    CREATE POLICY allow_system_update_grammar_count ON grammar_count
    FOR ALL
    TO postgres
    USING (true);
    g
    • 2
    • 2
  • Auto format string dates from Supabase to Javascript Dates?
    u

    49Ryann

    05/27/2023, 3:41 PM
    So any dates coming into my angular app from Supabase are just a string as follows:
    Copy code
    created_at: "2022-12-18T10:56:09+00:00"
    Is there a way to auto format these through Supabase HTTP settings? or intercept them some how to make them into dates? Currently I'm doing things like this to format nested strings into dates and it's becoming smelly! 💩
    Copy code
    findAll$ = () => super.findAll$().pipe(
        map(({data, ...others}) => ({
          ...others,
          data: data && data.map(item => ({
            ...item,
            last_message: {
              body: item?.last_message?.body,
              dateCreated: item?.last_message?.dateCreated ? new Date(item.last_message.dateCreated) : null
            }
          }))
        })
        )
      )
    Maybe even if this is something I can set in Postgres?
    g
    • 2
    • 1
  • Log in Is not possible with react and supabase with simple email and password without confirm email
    b

    Bibin

    05/27/2023, 3:49 PM
    I have installed supabase and provided the url and api key . I correctly imported it in the following way:
    Copy code
    import { createClient } from "@supabase/supabase-js";
    const supabase = createClient(supabaseURL,supabaseKEY);
    export default supabase;
    where the parameters are my URL and KEY assigned to variables I actually wanted a successful login implementation when I click the login button with the email and password it should verify it with the table in the database called User where I have attributes namely, a username and password. I dont' need a new user registeration or a signup , just a basic login function. And if the user entered credentials is equal to that of the ones in the User table then it should be redirected to another page (/homePage). When I ran npm start in the terminal, site loads and in the login page when I click the login button ,it says "invalid credentials" which is written in the following logintrial.js although I provided the same username and password as of in the table. The file called logintrial will be put as an image next to this due to word limit Please provide a good help. Looking forward for the fast reply.Following is each component code : --------fetchUserCredentials.js-----------
    Copy code
    import supabase from "../config/client";
    const fetchUserCredentials = async () => {
    const { data, error } = await supabase.from("User").select("*");
    if (error) {
    console.error("Error fetching user credentials:", error);
    }
    return data;
    };
    export default fetchUserCredentials;

    https://cdn.discordapp.com/attachments/1112044804776394812/1112044805019684884/problem_Edited.jpg▾

    https://cdn.discordapp.com/attachments/1112044804776394812/1112044805917249597/table.jpg▾

    https://cdn.discordapp.com/attachments/1112044804776394812/1112044806475108392/Screenshot_20.png▾

    g
    • 2
    • 2
  • How to filter `IS NOT NULL` with the Python library?
    l

    laubonghaudoi

    05/27/2023, 5:43 PM
    I checked the Python doc and it seems to have no
    .is()
    api like the JS library. How to you do that in Python?
    g
    • 2
    • 1
  • Auth + React + FastAPI — possible to verify token on backend?
    o

    oracle

    05/27/2023, 5:59 PM
    Can I use Supabase Auth in React and verify the user's token using Python/FastAPI?
    g
    • 2
    • 2
  • How to turn off update on table
    и

    иuғe

    05/27/2023, 6:34 PM
    I have rpc to update user table I add RLS to turn off update on user table for not making users to update their information , it's work fine but the rpc I have doesn't update table anymore why ?

    https://cdn.discordapp.com/attachments/1112086537308479539/1112086537434312846/image.png▾

    g
    c
    • 3
    • 8
  • AuthApiError: hCaptcha verification process failed
    a

    Aarush

    05/27/2023, 7:30 PM
    I'm using
    supabase.auth.signInWithOAuth
    in SvelteKit with redirectTo set to an api route which does
    Copy code
    ts
    const code = url.searchParams.get("code");
    
    if (code) {
      await supabase.auth.exchangeCodeForSession(code);
    }
    with hCaptcha enabled in the auth settings, but I'm getting a
    AuthApiError: hCaptcha verification process failed
    error whenever someone runs that particular api route (despite the signInWithOAuth method not having any captchaToken parameter in the options)
    s
    • 2
    • 4
  • custom email
    f

    formigueiro

    05/28/2023, 1:15 AM
    Is it possbile to use css to style my template email?
    g
    • 2
    • 3
  • Is it possible to disable email/password auth in the supabase/config.toml file?
    w

    wepsree

    05/28/2023, 2:38 AM
    I wish to only allow GitHub and OTP auth in my Supabase app
  • google oauth login
    a

    alana

    05/28/2023, 3:30 AM
    is there a way to change what gets shown here from dgnvviqfnfrqdxuwuyrm to the base URL or something more recognizable?

    https://cdn.discordapp.com/attachments/1112221280075264051/1112221280217866240/CleanShot202023-05-2720at2014.15.482x.jpg▾

    g
    • 2
    • 3
  • rewriting set_claim suggested by supabase community repo
    v

    ven

    05/28/2023, 3:45 AM
    So I tried this approach - https://github.com/supabase-community/supabase-custom-claims/blob/main/install.sql and discovered that since the set_claim function does not return a trigger it wouldn't show up in the studio. so I rewrote it
    Copy code
    CREATE OR REPLACE FUNCTION set_claim() RETURNS TRIGGER AS $$
    BEGIN
      NEW.raw_app_meta_data = NEW.raw_app_meta_data || jsonb_build_object('role', 'USER');
      RETURN NEW;
    END;
    $$ LANGUAGE plpgsql;
    any thoughts on the pros/cons of the new rewrite. seems to get the job done.
    g
    • 2
    • 7
  • Chrome Google Login sticks
    a

    alpi

    05/28/2023, 3:52 AM
    Once I login with my google account there is no way changing it. Clicking on login with google button logins my previous google account and I do not see accounts selection page again. Firefox works fine. Deleting cache and cookies did nothing. Any idea? I am on next js 13.4.4
  • createSignedUploadUrl using service_role
    a

    ash

    05/28/2023, 11:42 AM
    Should it be possible to generate a signed upload url using a service_role key on the server without any particular policies defined? The following code on a NextJS server side route fails with error
    StorageApiError: The resource was not found
    .
    Copy code
    const { data, error } = await supabase.storage
        .from("user-files")
        .createSignedUploadUrl(filename);
    supabase
    is an instance of the Supabase client initialized with the service role key as follows...
    Copy code
    import { createClient } from '@supabase/supabase-js'
    
    const supabase = createClient(supabase_url, service_role_key, {
      auth: {
        autoRefreshToken: false,
        persistSession: false
      }
    })
    Looking at the error logs for the Supabase Storage container running locally on Docker I see the following error...
    Copy code
    DatabaseError: failed to retrieve bucket
        at new DatabaseError (/app/dist/storage/errors.js:22:28)
        at Database.<anonymous> (/app/dist/storage/database.js:105:35)
        at step (/app/dist/storage/database.js:33:23)
        at Object.next (/app/dist/storage/database.js:14:53)
        at fulfilled (/app/dist/storage/database.js:5:58)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
      status: 406,
      postgresError: {
        code: 'PGRST116',
        details: 'Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row',
        hint: null,
        message: 'JSON object requested, multiple (or no) rows returned'
      },
      metadata: { bucketId: 'upload' }
    }
    Weird because the list operation on the same bucket works fine, not sure why bucketId is "upload" in the metadata section above either. Anybody have any ideas?
  • Put an upload limit per account with storage and auth?
    s

    salzar

    05/28/2023, 12:07 PM
    Hi everyone, I’m trying to put a storage limit on users’s accounts, so that they can only upload a certain amount of items until their space runs out. And I’m trying to make that amount free up when they delete items. I know I can make a column with how many gigabytes they have in their plan, but how can I actually enforce it with storage? The way it’s currently setup, every user only has access to a folder with their user Id on it. Thanks in advance for the help!
  • Next.js App Router Github Login Session Control
    o

    onurhan1337

    05/28/2023, 12:10 PM
    Hello everyone, I need help that. I've added github login on my website but can't find how can i create a condition with session. I use typescript btw my github login component:
    Copy code
    ts
    "use client";
    import { createClientComponentClient } from "@supabase/auth-helpers-nextjs";
    import { Session } from "@supabase/supabase-js";
    import { useRouter } from "next/navigation";
    
    async function AddCommment() {
      const supabase = createClientComponentClient();
      const router = useRouter();
    
      async function signInWithGitHub() {
        const { data, error } = await supabase.auth.signInWithOAuth({
          provider: "github",
        });
      }
    
      const handleSignOut = async () => {
        await supabase.auth.signOut();
        router.refresh();
      };
    
      return (
        <div className="mt-10">
          <button
            onClick={() => {
              signInWithGitHub();
            }}
          >
            Sign In
          </button>
          {/* if user logged in */}
          <button onClick={handleSignOut}>Sign Out</button>
        </div>
      );
    }
    
    export default AddCommment;
  • Restoration in progress is taking too long
    e

    elhe26

    05/28/2023, 12:48 PM
    Hi, As the title implies, the restoration process is taking almost a day to restore the project and the amount of data is really low. I don't want to delete the project since I've defined schemas, triggers, etc... What do I do?
    n
    • 2
    • 2
  • authentication setup for backend services
    u

    ぴんく

    05/28/2023, 1:21 PM
    Hi, new user here 👋 I am trying to setup a project with a single table such that * any user accessing my project from their browser can perform a
    SELECT
    (they do not need to login) * users will never write to the database * there is a GCP Cloud Function that performs a
    DELETE
    and
    INSERT
    to my table Given this setup, should I use the
    service_role
    API key for my Cloud Function? Or would it make more sense to setup a custom role? If the latter is the case, I suppose I would have to setup a policy that checks for a predefined
    email
    field, and also handle refreshing the JWTs every once in a while. I didn't really see a section for service accounts in the docs, so I wanted to know how other people would handle this setup. Thanks in advance 🙏
    j
    • 2
    • 2
  • problem with auth
    u

    .Volxen

    05/28/2023, 2:38 PM
    am getting this error that i cant seem to find a solution for [AuthRetryableFetchError: Network request failed]
    g
    • 2
    • 13
1...226227228229230Latest