https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Help with Types (TS)
    g

    gweb

    01/27/2023, 8:44 AM
    Copy code
    ts
    import type { PostgrestResponse } from '@supabase/supabase-js';
    import { getSupabase } from '@supabase/auth-helpers-sveltekit';
    import type { Database } from '$lib/types/database.types';
    import type { PageLoad } from './$types';
    import { redirect } from '@sveltejs/kit';
    
    type Message = Database['public']['Tables']['messages']['Row'];
    
    export const load = (async (event) => {
      const { session, supabaseClient } = await getSupabase(event);
      if (!session) {
        throw redirect(303, '/auth/login');
      }
      const { data: messages }: PostgrestResponse<Message> = await supabaseClient
        .from('messages')
        .select(
          `
        message,
        created_at,
        profiles (
        id,
        username
        )
      `
        )
        .eq('id', event.params.id);
    
      if (!messages) {
        return { messages: [] };
      }
    
      return { messages };
    }) satisfies PageLoad;
    Copy code
    Type 'PostgrestResponse<{ message: any; } & { created_at: any; } & { profiles: ({ id: any; } & { username: any; }) | ({ id: any; } & { username: any; })[] | null; }>' is not assignable to type 'PostgrestResponse<{ created_at: string; id: string; message: string; userId: string | null; }>'.
    • 1
    • 1
  • Using Supabase with Remix for Sign Up and Server Side Logic
    e

    Evostance

    01/27/2023, 9:13 AM
    Does anyone have an example of using Remix for User Sign up and Server Side Logic? I've seen the example in the Remix repo on how to do signIn etc which is fine, but struggling to get my head around how to do sign up and SS logic, whilst keeping the sessions in sync. As an example, I have a sign up form which takes username, password, and some other details. I want to use the SignUp Method from supabase, but then I need to create a row in a profiles table to populate it with that user, some other fields, and then make a call to Stripe.
  • How to change CLI config file directory?
    u

    ! Do you even Vim, bro?

    01/27/2023, 11:16 AM
    Is it possible to change config's directory? So that it's located in
    src
    , maybe?
  • How to display images from Supabase Storage in Retool without signing
    e

    Exa

    01/27/2023, 11:25 AM
    Hi, quick question: I created an internal admin tool in retool. However, images don't load directly as they have to be signed first. This signing process is very slow. The images are not public, but Retool has admin access to supabase. Is there a way to get the images directly or what is the recommended pattern for this?
    g
    • 2
    • 1
  • SvelteKit + Supabase OAuth redirect not working
    j

    Jason Creviston

    01/27/2023, 12:58 PM
    I'm not sure where the issue is here, except it's OAuth related. This is not in regards to the supabase-js
    signInWithOAuth
    redirectTo
    option - I'm just passing in the provider with the test repo. I'm using Sveltekit's
    goto()
    in the
    onAuthStateChange
    function, after events fire, to do my redirect. I've created a repo you can use to test this yourself. https://github.com/j4w8n/sanity (because I'm about to lose mine) Clone, install, npm run dev or whatever. Open a browser and dev tools console at http://localhost:5173 If you click the
    Email Login
    button, it signs you in and properly redirects you to /app. Click
    Logout
    button and you go back to the homepage. All is well. Now try the
    Github Login
    button (I can delete your user later, no problemo). You may notice the browser console log 'Navigating to /app', but it never happens - at least not on my machine. It's being interrupted somewhere. Different browsers do different things. Firefox will show vite reconnecting. Chrome shows it's navigating to the homepage. In both instances, you can usually see that it's trying to go to the "redirectTo" url twice - the supabase project's base url in this case, since we aren't setting it in the signIn function. However, I've passed-in this option while testing in other projects, and that's what shows up twice. Does it work for you? I cannot figure this out. I've even tried a 1.0.0-next.xxx versions of sveltekit which allowed me to downgrade to vite 3.2.0, and supabase-js 2.0.0. Still have issues. Which is strange, because I don't recall having issues with this in the past with supabase-js v2. I've even tried it on my mac, because I've been using a new Windows laptop and thought that had something to do with it.
    s
    m
    • 3
    • 18
  • Query counts?
    a

    AntDX316

    01/27/2023, 1:59 PM
    Is one cell a query? Is one row a query? If you are saying sending code to take a query from like 50 cells does that count towards how many you can do per minute for the rate limit or is each code Query/Mutation together 1 request?
    g
    • 2
    • 31
  • Delete Cascade
    k

    kabaday

    01/27/2023, 2:15 PM
    Example: I have a table called "folder" and another table called "note." Each folder can contain multiple subfolders and notes, and they are connected through a column called "parent_folder_id." My goal is to delete a folder from the "folder" table and have all of its subfolders and subnotes, as well as their respective children, also be deleted. how can i achieve this using Supabase?
    o
    g
    • 3
    • 8
  • Flutter Deep Link with Supabase
    m

    Mateusz27

    01/27/2023, 2:37 PM
    Hello, I 've got a problem with redirtect in reset password. The link received opens in browser instead of my app (local or mobile apk). The response is :
    Copy code
    json
    {
    "message": "No API key found in request",
     "hint": "No apikey request header or url param was found."}
    I made all steps from the official supabase documentation: https://supabase.com/docs/guides/getting-started/tutorials/with-flutter I also put my poc project to git: https://github.com/Mateusz-92/Test-App-Supabase. Here is a part of my anroid manifest file:
    Copy code
    xml
    <!-- Add this intent-filter for Deep Links -->
              <intent-filter>   
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
    
                <data
                   android:scheme="io.supabase.test_app_supabase"
                   android:host="reset-password" />
              </intent-filter>
    and my url configuration from supabase: io.supabase.test_app_supabase://reset-password/ Did anyone have similar problem or has some hints ?
    s
    • 2
    • 2
  • How to check if user is allowed to insert row (RLS)
    l

    lake_mattiato

    01/27/2023, 2:52 PM
    Hello, I have the following tables: contact_tags (id: uuid, client_id: fk uuid, name: text), contacts(id: uuid, name: text, user_id: fk uuid) and user_data(id:uuid). How can I implement a RLS policy where I will check if the inserted client_id is owned by the auth.uid() ? Thanks in advance
  • How to check if user is allowed to insert row (RLS)
    l

    lake_mattiato

    01/27/2023, 3:20 PM
    Hello, I have the following tables: contact_tags (id: uuid, client_id: fk uuid, name: text), contacts(id: uuid, name: text, user_id: fk uuid) and user_data(id:uuid). How can I implement a RLS policy where I will check if the inserted client_id is owned by the auth.uid() ? Thanks in advance
    s
    g
    • 3
    • 7
  • How to apply custom check constraints and foreign keys with on delete ...?
    f

    Florent

    01/27/2023, 4:06 PM
    I am using the cloud version of supabase. Is there a way to connect the cloud postgres db with pgAdmin? I want to be able to inspect the tables, views, materialized views, properly. I could use the SQL-Editor (for creation at least) but it does not really fit all needs I am used to. Any ideas?
    g
    • 2
    • 2
  • User/Session are returned null while using the useUser or useSession hooks in Next JS Auth Helpers
    r

    R3FluX

    01/27/2023, 4:25 PM
    Hi, I followed the authentication guide from the official documentation and when I'm trying to check the user's session in a component, it always returns null even though the user is signed in.
    u
    h
    +2
    • 5
    • 9
  • Prisma on top of Supabase client -
    p

    pickwickian

    01/27/2023, 4:36 PM
    I've learned that the Supabase client doesn't support transactions. I've also had issues with other stuff directly using their client. Do people routinely adopt Prisma for interacting with just the DB mutations aspect of using Supabase? It's starting to feel like I will have to do something. Is there a good guide for this? I've only spent a few hours with Prisma. The idea of having to define my schemas in Supabase and then in an ORM config file seems bad. I'd want there to be one single source of truth either way.
    g
    • 2
    • 6
  • What apps are people building with Supabase?
    s

    soleun (Uiflow)

    01/27/2023, 6:15 PM
    Hi Supabase community! 👋 👋 👋 I am pretty new to Supabase and am building a frontend dev platform which will integrate with Supabase. Just curious what apps(internal? customer facing? admin panels? games? or others?) people are building with Supabase.
    s
    s
    g
    • 4
    • 4
  • Remove - Upload - Update
    e

    Enyel

    01/27/2023, 6:26 PM
    Hello all, I have a question regarding the correct flow to follow when doing these steps, the goal is this, a user can only have a profile picture, so first we check if that profile has a picture if it does delete it and then we upload the new one, then I try to fetch the new one that has been upload it, right now however this is not working as expected as I don't get the correct updatedDate url, perhaps I am missing something?
  • Can I send push notifications
    i

    ItsLeffdePeff

    01/27/2023, 6:34 PM
    Is there a way to send push notifications using supabase
    g
    l
    • 3
    • 3
  • authenticated role RLS issue?
    o

    Olyno

    01/27/2023, 6:42 PM
    Hi Today i'm experiencing a new issue with RLS. It looks like any RLS with the ``authenticated`` role is not working, returning false. When adding ``anon`` to the list of roles, it is working correctly. Note that i restarted the instance, logout and login again, still have this issue. Any idea?
    g
    s
    • 3
    • 27
  • javascript: after importing rows with unique ID from csv, getting duplicate key value error
    d

    Domcario

    01/27/2023, 8:24 PM
    imported 156 rows from csv to a table, where the
    id
    col is the primary key and identity, so it is "Automatically assigned a sequential unique number to the column" but i get a error
    duplicate key value violates unique constraint "events_id_key"
    details: "Key (id)=(1) already exists."
    so it's starting to insert rows with id 1 instead of 157. how would i fix this?
    g
    • 2
    • 2
  • RLS Policy Versioning or Testing?
    s

    shananananan

    01/27/2023, 10:23 PM
    I'm currently evaluating Supabase for a new app and i'm pretty intrigued by the whole concept. Especially around the power of safely exposing the db directly to clients vis RLS + auth. But one of my concerns would be a point in the future where a working policy was modified and subsequently broke app usage. Are there any plans to provide some level of version control in order to rollback changes? To kind of add to this, is there any way to possibly preview the impact a new policy or policy change might have beforehand? Maybe through some example queries to run with the new policy temporarily applied. I'd be generally curious if there are any known workarounds for this folks have found, or if it is currently just accepted limitations of the platform.
    s
    • 2
    • 1
  • Supabase documentation on pivot tables
    t

    Tarky

    01/27/2023, 10:28 PM
    Is there any documentation on how to use SupabaseJS with pivot tables?
    g
    • 2
    • 41
  • app.supabase.com password reset not sending the email
    s

    Smardrengr

    01/28/2023, 12:19 AM
    I'm not receiving the password reset to my Supabase account. Anyone else experience this today?
    g
    • 2
    • 5
  • Can't change the value of created_at in admin dashboard
    b

    BannedFromLeague

    01/28/2023, 12:35 AM
    Hey guys, I was using the admin dashboard and I wanted to change the created_at value of my data to one earlier in the year. However, everytime I do it keeps changing it to the previous value. I don't have any custom policies I've created for this so I'm assuming its one of the supabase default triggers casuing it Thanks
    s
    g
    • 3
    • 37
  • Added a custom domain, now getting an error (locally)
    s

    Smardrengr

    01/28/2023, 12:40 AM
    Upgraded to Pro and added a custom domain, went through the DNS steps, and Supabase reports “Your custom domain is currently active and is serving traffic”. However, when I try to sign into my Supabase app locally (dev), I get this:
    Copy code
    {
      "type": "invalid",
      "status": 500,
      "data": {
        "error": "Server error. Try again later.",
        "values": {
          "email": "me@gmail.com"
        }
      }
    }
    And I've updated the local
    .env
    to point to my new custom domain... In production, which is using the old Supabase hostname, auth works fine. What am I missing?
    s
    • 2
    • 3
  • Token "foo" is invalid. Invalid input syntax for type json.
    b

    Brad Dwyer

    01/28/2023, 1:22 AM
    I'm trying to replicate this query in supabase-js which gets a list of teams for which the user has one of the desired roles:
    Copy code
    SELECT * FROM teams WHERE data#>>'{roles,user1}' IN ('admin', 'guest')
    Where
    data
    is a
    jsonb
    column with data structured like this:
    Copy code
    {
      "name": "Some Example Team"
      "roles": {
        "user1": "admin",
        "user2": "guest"
      }
    }
    My closest attempt is this:
    Copy code
    const { data, error } = await supabase.from("teams").select("*").in("data#>>'{roles,user1}'", ["admin", "guest"]);
    But I get
    Token "admin" is invalid. Invalid input syntax for type json.
    I've also tried JSON stringifying, appending single quotes around things inside the JS strings, and several other things without success.
    g
    • 2
    • 9
  • Why the avatar is not deleted in the storage?
    u

    .davdi

    01/28/2023, 2:32 AM
    Why the avatar is not deleted in my storage if i run this function?
    Copy code
    js
    await supabase.storage.from("avatars").remove(["testuser.jpg"])
    Do i need to setup some policies for this? Because earlier worked fine and now i get this error:
    Copy code
    json
    {"statusCode": "409", "error": "Duplicate", "message": "The resource already exists"}
    g
    • 2
    • 15
  • Can't log into cli
    l

    Lukas

    01/28/2023, 2:38 AM
    For some reason I can't log into the CLI "No connection could be made because the target machine actively refused it."
    • 1
    • 1
  • Session is null
    u

    3000

    01/28/2023, 3:05 AM
    Hey everyone, I am using the Discord OAuth in my Next JS project and when I try logging in, the session is never instanced. I keep getting null. Am I missing something? I set all the env variables, set up my project in Supabase as docs indicated but nothing yet. Thanks in advance!
  • Password reset flow for Auth component?
    v

    Vince

    01/28/2023, 3:35 AM
    I've seen a lot of password reset threads here but it seems there are different ways to implement the password reset flow. I'm using Supabase's AUTH UI to set up an Auth component. The email/password fields are automatically rendered for me to either signup or signin my account. That component also has a "Forgot your password?" link. I clicked on it, entered my email address, got an email with the password reset link and it took me straight to localhost:3000. Here's the question: I know I need to change my Site URL but how does that facilitate the password reset? Where does the user enter the new password from the Supabase Auth component? For context, here's a snippet of my code - in the signin.js page from my Next.js project:
    Copy code
    import { Auth, ThemeSupa } from "@supabase/auth-ui-react"; // this is the Auth component that renders the signin/signup form
    import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";
    ...
    const Signin = () => {
      const session = useSession();
      const supabase = useSupabaseClient();
    ...
      return (
        <div className="container" style={{ padding: "50px 0 100px 0" }}>
          <Auth
            supabaseClient={supabase}
            appearance={{ theme: ThemeSupa }}
            theme="dark"
          />
         )
        </div>
      );
    };
    
    export default Signin;
    Screenshots to show what the rendered component looks like...see attached.
    g
    h
    • 3
    • 9
  • Get a list of table names
    l

    lukejamison_

    01/28/2023, 4:17 AM
    Hello I’m wondering if there a a way to get a list of tabes I have via a API or via SQL? Thank you!
    g
    • 2
    • 3
  • JSONB columns are sent as strings.
    u

    undoublethink

    01/28/2023, 7:07 AM
    Is it expected that JSONB columns are converted to strings when queried via the API? For example, if this is my (simplified) schema:
    Copy code
    sql
    CREATE TABLE foo (id int, data jsonb);
    And I have some data in the table:
    Copy code
    1 | [[1, 2], [3, 4]]
    2 | [[5, 6], [7, 8]]
    Then I query it via the API:
    Copy code
    sh
    curl 'https://<supabase id>.supabase.co/rest/v1/foo?select=*' \
    -H "apikey: SUPABASE_KEY" \
    -H "Authorization: Bearer SUPABASE_KEY"
    The result is the following JSON:
    Copy code
    json
    [
      {
        "id": 1,
        "data": "[[1, 2], [3, 4]]"
      },
      {
        "id": 2,
        "data": "[[5, 6], [7, 8]]"
      }
    ]
    But I would have expected the
    data
    value to be a JSON array? Is this the expected behavior or is there something I am doing incorrectly? (edit: sorry, the title poorly worded for a help request but I don't think I can change it)
    g
    • 2
    • 3
1...111112113...230Latest