https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • New database starts with 75MB already used.
    a

    AVEN

    02/09/2023, 2:56 AM
    Where would I find and get rid of this if it is not needed. Thanks
    g
    • 2
    • 2
  • Referencing a column from a FK table using .eq()
    e

    Ethanxyz

    02/09/2023, 3:18 AM
    Right now I am getting a user's items using...
    Copy code
    js
      let { data: items, error } = await supabase
            .from("items")
            .select("*, created_by(*), type(*), game(*))")
            .eq("created_by", user.id);
    Now,
    user.id
    is a FK within the
    items
    table and points to a user in the
    profiles
    table. Within my front end, I want my URL too look like
    example.com/[username]
    , but, as you can see, I am not using a
    [username]
    in this query, but rather a
    user.id
    ( which can look quite long and ugly ). That said, I want to pass in
    username
    from the
    profiles
    table, but I am not sure how to obtain it. I want to do something like
    .eq("created_by", profiles: id = created_by)
    . How should I go about this ?
    g
    • 2
    • 3
  • filtering a group by
    j

    JustinT

    02/09/2023, 3:23 AM
    I have a view that contains a group by. For example…
    Copy code
    sql
    select country, sum(sales) from table
    group by country
    But I want to add a filter to filter by age for example. But I also want multiple filters. Is there anyway to do this that doesn’t require creating some SQL function?
    g
    • 2
    • 1
  • Email was sent only in spam box
    s

    sinrabo

    02/09/2023, 3:29 AM
    Hello. I installed MailerSend as Custom SMTP but Email was sent still only in spam box. How can I fix this issue?
  • "Subscribing to PostgreSQL failed: {:error, {:subscription_insert_failed,.."
    r

    rbl

    02/09/2023, 4:06 AM
    I upgraded via brew to the latest supabase:
    Copy code
    ➜  git:(main) ✗ brew info supabase
    ==> supabase/tap/supabase: stable 1.37.1
    After upgrading, my realtime subscriptions in my local supabase instance stopped working: I'm getting the message from the realtime server:
    Copy code
    "Subscribing to PostgreSQL failed: {:error, {:subscription_insert_failed, %{\"event\" => \"*\", \"schema\" => \"public\"}}}"
    And the docker logs for the realtime instance are being spammed by:
    Copy code
    04:04:14.177 project=realtime-dev external_id=realtime-dev [error] Subscribing to PostgreSQL failed: {:error, {:subscription_insert_failed, %{"event" => "*", "schema" => "public"}}}
    a
    • 2
    • 2
  • Cascade on delete not working on user table
    j

    jinsley8

    02/09/2023, 5:04 AM
    I'm getting the following error when trying to delete a table which is supposed to be set to cascade on delete>
    Copy code
    bash
    Failed to run sql query: update or delete on table "users" violates foreign key constraint "users_id_fkey" on table "users"
    
    Failed to run sql query: update or delete on table "users" violates foreign key constraint "profiles_id_fkey" on table "profiles"
    Here are my tables. I thought I had cascade on delete set already. When a user is created in next_auth.users it automatically generates a row in public.users and a row in public.profiles. Anyone see anything wrong with what I have setup here? The id across all three tables is the same for a user.
    Copy code
    sql
    --
    -- Create next_auth.users table
    --
    CREATE TABLE IF NOT EXISTS next_auth.users (
        id                  uuid NOT NULL DEFAULT uuid_generate_v4(),
        address         text NOT NULL UNIQUE,
        provider_id         text NOT NULL UNIQUE,
        aud                 text,
        role                text,
        created_at          timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL,
    
        CONSTRAINT users_pkey PRIMARY KEY (id),
    );
    
    --
    -- Create public tables
    --
    -- USERS
    CREATE TABLE IF NOT EXISTS public.users (
        id                  uuid references next_auth.users (id) on delete cascade PRIMARY KEY,
        address         text references next_auth.users(address) PRIMARY KEY,
        email_address       text UNIQUE,
        email_verified      boolean,
        verify_token        uuid,
        verify_sent_at      timestamp with time zone,
        created_at          timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL,
    );
    
    -- PROFILES
    CREATE TABLE IF NOT EXISTS public.profiles (
        id                  uuid references public.users(id) on delete cascade PRIMARY KEY,
        address         text references public.users(address) PRIMARY KEY,
        name         text UNIQUE,
        logo         text,
        created_at          timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL,
    );
    • 1
    • 1
  • For anyone building in Swift, how did you setup the client?
    v

    Vik

    02/09/2023, 5:29 AM
    Looking for some help here so I can start messing around with the data. I haven't figured out a way to properly setup the client and access types. Has anyone done this before and can maybe give me some pointers?
  • Using realtime for website notifications and chat between users
    u

    Uberzeek

    02/09/2023, 6:11 AM
    Hey, I'm wondering whether the supabase realtime will be strong enough to handle both realtime notifications for users across the app, and live chat between them (the users). Have anyone done that before, or can recommend anything?
  • How To Insert Data
    u

    최지연

    02/09/2023, 6:39 AM
    Hi 😊 I have some question I'm making CRUD Service I want to Insert cocktail_comment table Under Cocktail table related_article_number in cocktail_comment following foreign key relation with public.cocktail.article_number This is My DB.. plz help me. thanks
    r
    a
    • 3
    • 5
  • Creating Storage Bucket using CLI or Migrations
    d

    DeChill

    02/09/2023, 7:59 AM
    Hi all, Is there any way to create new storage buckets using the CLI or specify them in the
    config.toml
    ? I already have the Storage RLS Policies in my Migrations, but I still have to manually to to the Portal and create the Storage Container by hand. I didn't find anything in the docs so far 🫤 Thanks in advance!
    g
    • 2
    • 2
  • Cross Origin Request Blocked when setting up client
    m

    Monimolimnion

    02/09/2023, 8:07 AM
    Hi, I'm trying to set up an
    urql
    client to make a GraphQL request to Supabase. I've included what I think are the right headers, in the right way, but it's still throwing a CORS error in the browser:
    Copy code
    const client = createClient({
        url: 'https://my-endpoint.supabase.co',
        fetchOptions: () => {
            return {
                headers: {
                    apikey:
                        'my-api-key',
                    'Access-Control-Allow-Origin': '*',
                    'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type'
                }
            };
        }
    });
    Any ideas what I'm doing wrong?
  • 'db prisma push' creates sqlite, even though I told it to use postgresql?
    s

    stunna

    02/09/2023, 8:17 AM
    Good morning/evening. I'm using CT3A (createt3app), trying to localhost an app on Supabase+docker, and when I do npx prisma db push - instead of the expected postgresql, I get the deafult sqlite, despite all the code in the project specifying, and pointing to psql. Take a look at the screenshots! What's the deal? Notably I pushed db after spinning up local supabase, not to mention it didn't throw some 'can't find address error' if such exist? The tutorial I'm following:

    https://youtu.be/ZWBYu2yFpDs?t=336▾

    • 1
    • 5
  • How to verify supabase domain for Google OAuth?
    t

    TheBuilderJR

    02/09/2023, 8:48 AM
    Google is asking me to do that...
    t
    g
    • 3
    • 4
  • is Supabase serverless?
    m

    Michal

    02/09/2023, 9:16 AM
    Hello, I just discovered Supabase. Is it a truly serverless service like Firebase?
  • What's the best way to manage postgres functions as they change often
    d

    davetayls

    02/09/2023, 9:19 AM
    At the moment I am creating migrations everytime a postgres function needs to be tweaked. It is becoming hard to manage. I wonder if there is a better way to store these functions as separate files like you might with edge functions. How would you recommend we do this?
    s
    • 2
    • 10
  • How to increase work_mem
    d

    dav

    02/09/2023, 9:31 AM
    I'm trying to increase work_mem
    Copy code
    show work_mem
    >>> "5MB"
    SET work_mem TO '16MB';
    show work_mem
    >> "5MB"
    Despite my command,
    work_mem
    doesn't update. Am I entering the wrong command?
  • Can you populate FK's using realtime INSERT?
    u

    49Ryann

    02/09/2023, 9:55 AM
    I'm in a situation where I want to listen to the changes on INSERT, which works great but I really need to populate the ID's returning, is this an option? Maybe an undocumented one as I cannot find obvious detail about it?
    s
    g
    • 3
    • 7
  • Does supabase have an ODBC Driver ?
    f

    Firebat

    02/09/2023, 10:13 AM
    Does supabase have an ODBC Driver ? If yes, from where can I download it ?
    k
    • 2
    • 8
  • Migrating prisma to supabase, psql throws an error
    s

    stunna

    02/09/2023, 12:00 PM
    Check out the screenshot. What could be the problem? I'm following this tutorial

    https://youtu.be/ZWBYu2yFpDs▾

    g
    • 2
    • 1
  • How do you filter through foreign tables but *not* select it?
    r

    rem

    02/09/2023, 1:05 PM
    I've got a simple
    workspaces
    table and
    workspace_users
    join table. In SQL I want to do:
    Copy code
    SELECT
     w.*
    FROM 
     workspaces w, 
     workspace_users wu
    WHERE
     wu.workspace_id=w.id AND 
     wu.user_id='user_xyz_id';
    i.e. constrain on the join table. Except I can't work out how to do this with the JS library without including fields from the
    workspace_users
    table, which I don't want (mostly to satisfy TypeScript). My code looks like this (but errors):
    Copy code
    let { error, data: workspace } = await client
        .from("workspaces")
        .select("id, slug, name, created_at, type")
        .eq("workspace_user.user_id", user.id)
        .limit(1)
        .maybeSingle();
    I get this error:
    Copy code
    {
      error: {
      code: 'PGRST108',
      details: null,
      hint: 'Verify that \'workspace_user\' is included in the \'select\' query parameter.',
      message: 'Cannot apply filter because \'workspace_user\' is not an embedded resource in this request'
    }
    How do I query without selecting?
    g
    • 2
    • 32
  • Dart auth.admin.createUser returns 'Invalid authentication credentials'
    a

    avalanche

    02/09/2023, 2:07 PM
    Following code returns AuthException(message: Invalid authentication credentials, statusCode: 401) I'm not sure what am I doing wrong here...
    Copy code
    dart
    final supabase = SupabaseClient(supabaseUrl, supabaseServiceRoleKey);
    
    await supabase.auth.admin
            .createUser(AdminUserAttributes(
              email: 'user@example.com',
              password: 'test123'
            ));
    • 1
    • 1
  • Are there examples of onboarding new users ?
    s

    somoni

    02/09/2023, 2:57 PM
    I am launching a new saas and i was wondering if i can use supabase to just collect their emails. I want to see the response by creating a landing page and asking users to sign up to the service.
  • API access to supabase logs?
    j

    Ju Li

    02/09/2023, 3:31 PM
    Is it possible to access supabase logs via API? Specifically the Edge function logs The reason I'm asking is I'm hoping to extract the logs to a service/db so that I can create dashboards and alerts
  • Inconsistent auth
    d

    dev Joakim Pedersen

    02/09/2023, 3:33 PM
    We have been running supabase for some months now and the more I use it the more I like it. But it does really make it hard for me at times, the auth is very simple works great. but sometimes it just decides not to work. often at the most needed times. This time we had a new admin client that is going to manage her store from our admin panel. So we went trough create account with her and she got the mail with a confirmation link. and the link was not a valid one it just returned a 404. so we tried that 2 times. still same result so she just create one account with signup with gmail functionality. So then I tried myself to create an account and it was straigth on no issue at all. We are currently at 78 registered users. and it has worked for most it's only a few that has not authenticated their email. and that may also be other reasons for. So I'm a bit clueless why things like this happens? does anyone experience the same thing?
    g
    s
    • 3
    • 29
  • PDF/Document Indexing
    s

    Santiago

    02/09/2023, 3:37 PM
    Hi, is it possible to use the API to create a full text search bar capable of searching content of PDF/Office files?
    k
    • 2
    • 3
  • Resetting Password with React Native, Supabase, and Auth Flow
    j

    Jannik

    02/09/2023, 3:50 PM
    Hey everyone, I've been having trouble resetting the password in my React Native app that uses Supabase and an auth flow. The App function uses the useUser hook to retrieve a Boolean value called AppStacktrue. If it's true, the app is rendered, and if it's false, the auth Stack is rendered. The issue with password reset is that the user must be logged in to change their password. To resolve this, I created the AppStacktrue value in my user.js file. This hook allows the user to log in, log out, sign up, and verify their OTP, but I also want the user to be able to reset their password. To solve the problem, I created a useEffect that controls the AppStacktrue state. In the verify function (which is used for password reset and sign up), I set a state called Reset to true, but it returns to its initial value automatically. This might be a bug with the onAuthStateChange function. My goal was for the AppStacktrue to be false when the function is active. I'm not sure what the best solution is to handle the password reset in my case. Any suggestions or ideas would be greatly appreciated!
  • docker-compose.yml does not update
    c

    Colors

    02/09/2023, 4:51 PM
    I change some ports for superbase because the default ports (8080 and 8000) are already used. But when I try to start the containers with
    docker compose up
    it still gives me this error:
    Error response from daemon: driver failed programming external connectivity on endpoint supabase-kong (7f09ca72e1d9903fa54f148810c17a1b50638c12649c1ea3429fe74f881a8810): Bind for 0.0.0.0:8000 failed: port is already allocated
    This is my docker-compose.yml file: https://pastebin.com/QJeB5tpm
  • Configure Supabase database settings programmatically?
    s

    SamuelTSO

    02/09/2023, 5:06 PM
    Is it possible to setup supabase database config(RTS rules, set table to Realtime enable, etc..) in code instead of the interface? https://github.com/supabase/supabase/discussions/12295
    g
    • 2
    • 1
  • Security when using service key
    j

    jinsley8

    02/09/2023, 5:31 PM
    I have a custom login function that checks if user exists and if they don't then the next.js API route calls another API route to update some info in a RLS locked users table. Users are only allow to read from their user table and not update or insert so I'm using the Serivce Key in this 2nd route to update a user column. I don't ant anyone to be able to send a request to this 2nd route with the service key. What's the best way to secure this? Is it safe enough to just send a secret key along with the request and check it? That way you can only send a request by logging in on the browser or by knowing the secret.
  • How Do I Interact with Storage Using REST API?
    s

    shoomow

    02/09/2023, 5:32 PM
    My goal is to be able to upload a file to Storage with just the REST API. There are Swagger docs describing endpoints (https://supabase.github.io/storage-api/#/). I'm using Python's
    requests
    package, the test request being like this:
    Copy code
    s.get(f"http://db.[[supabase_host]].supabase.co/storage/v1/object/public/[[bucket_name]]/[[path_to_file]]/pic.png", headers=headers)
    where
    headers
    is a dict containing
    authorization
    key with value of
    Bearer [[supabase_service_key]]
    In response, I get a
    target machine actively refused it
    error, and from the details, I can see that the request goes to port 80 (definitely wrong). I tried setting an additional header
    x-api-port
    , as well as passing the port right in the URL, but former has no effect, and latter results in a different exception. What am I missing?
    g
    • 2
    • 4
1...125126127...230Latest