https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How can I reset my service role key?
    c

    Cheqo

    08/26/2022, 4:12 PM
    I just wanted to know how can I change my service role key,if its accidentally leaked?
    g
    • 2
    • 1
  • Any update on real time postgres changes in react useEffect?
    d

    DeadlyDev

    08/26/2022, 4:19 PM
    This seems to be an issue, even saw the issue on the happy hour stream last week. Any update on if this is being fixed? Right now its basically unusable in react.
    g
    p
    f
    • 4
    • 17
  • Magic Email Links and CDN
    v

    Vincent Warmerdam

    08/26/2022, 4:25 PM
    I figured I'd give supabase a try locally. I have the following code:
    Copy code
    <script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script>
    
    email
    <input type="text" id="email">
    <button onclick="signInWithEmail()">signin</button>
    
    <script>
    const SUPABASE_KEY = 'xxx'
    const SUPABASE_URL = "yyy"
    const client = supabase.createClient(SUPABASE_URL, SUPABASE_KEY);
    
    async function signInWithEmail() {
      console.log(`Trying to log in ${document.getElementById("email").value}`)
      const { user, error } = await client.auth.signIn({
        email: document.getElementById("email").value
      })
      console.log(user);
      console.log(error);
    }
    </script>
    This is hosted on localhost:8000 and supabase is configured to send a magic link with a re-direct. The redirect works ... I briefly see extra info in the URL, but how does the user actually get authenticated? The docs (https://supabase.com/docs/guides/auth/auth-magic-link) suggest that I merely need to call
    .auth.signIn
    but that's the same method that I used to send the email? Is there an example of basic email authentication that uses vanilla JS with supabase hosted via CDN.
    p
    • 2
    • 2
  • Reload Schema Cache
    l

    luke90275

    08/26/2022, 4:38 PM
    Hi, I recently changed a certain relationship in my database. When I tried to grab data from the database, it said "If a new relationship was created, try reloading the schema cache." How can I go about reloading the schema cache?
    g
    • 2
    • 4
  • Inviting Users to Project
    r

    RyanHirsch

    08/26/2022, 7:30 PM
    When I invite a user to my project using the web UI, they get an invalid link referencing localhost. Is there any fix I can do on my side?
    p
    c
    • 3
    • 3
  • supabase gen type typescript error running container
    w

    wieli99

    08/26/2022, 7:33 PM
    Hi, I'm trying to import typescript types using sudo supabase gen types typescript --db-url postgres://.... > database.types.ts however I'm getting "Error: error running container" Does anyone have any ideas?
    s
    u
    • 3
    • 3
  • [GraphQL] Array typed fields not included in update
    s

    Señor Bruno

    08/26/2022, 10:11 PM
    Whenever I use the codegen to create the types from the queries it does not generate the properties with [Int] for the update type: For example the type "Profile" is correctly generated as:
    Copy code
    type profiles {
        birthday: Date
        can_be_roommate: Boolean
        created_at: Datetime
        description: String
        display_name: String!
        employment: Int
        first_name: String!
        id: BigInt!
        last_name: String!
        search_as: Int
        tenant_attributes: [Int]
        user_id: UUID!
    }
    But its mutation type is missing the tenant_attributes input profilesUpdateInput { birthday: Date can_be_roommate: Boolean created_at: Datetime description: String display_name: String employment: Int first_name: String last_name: String search_as: Int user_id: UUID } Error: × GraphQL Document Validation failed with 1 errors; Error 0: GraphQLDocumentError: Field "tenant_attributes" is not defined by type "profilesUpdateInput".
    w
    • 2
    • 2
  • Get Google Image on Login
    j

    jdgamble555

    08/26/2022, 11:46 PM
    Is there a way to get the Google Image URL when a user logs in with Google, and save it in the photo_url row in the database?
    p
    j
    • 3
    • 9
  • Correct way to use a JWT on the server side to initialize a client as that user?
    s

    sythic

    08/26/2022, 11:54 PM
    Most of the documentation seems to assume you're using supabase on both browser client and api side. We have a custom GQL api that needs to get the users JWT from Authorization header and create a client as that user for the duration of that request. Attempting to use this in my request context (ApolloGQL server)
    Copy code
    export const getClient = (token?: string): SupabaseClient => {
      return createClient(SUPABASE_API_URL, token || SUPABASE_ANON_TOKEN);
    };
    This doesn't seem to create me a client authorized as that user (token is the JWT from Authorization header)
    supabase.auth.user()
    is null but tells me I should use
    auth.api.getUserByCookie()
    to do this in the server context. But I'm not using a cookie or any type of session management
    g
    • 2
    • 24
  • How do you configure compiler options when deploying?
    f

    Fez

    08/27/2022, 12:25 AM
    getting compiler errors when deploying that dont show locally, my
    deno.json
    looks like this: > { > "compilerOptions": { > "allowJs": true, > "esModuleInterop": true, > "experimentalDecorators": true, > "inlineSourceMap": true, > "isolatedModules": true, > "jsx": "react", > "lib": ["deno.window"], > "module": "esnext", > "moduleDetection": "force", > "target": "esnext", > "useDefineForClassFields": true, > "strictNullChecks": false, > "strictFunctionTypes": false, > "noUncheckedIndexedAccess": true > } > } >
    j
    • 2
    • 83
  • How do you use the editor for the database functions?
    n

    NicoNico

    08/27/2022, 2:24 AM
    There doesn't seem to be up to date documentation describing how to use the interface portion of the database functions. What are we expected to write in the definition? Is it the full:
    Copy code
    create function hello_world()
    returns text
    language plpgsql
    security definer set search_path = public
    as $$
    begin
      select 'hello world';
    end;
    $$;
    and if so what's the relationship between the parameters defined above via GUI and what we write in the function?
    g
    • 2
    • 2
  • python sql query Attribution error
    r

    robh

    08/27/2022, 9:49 AM
    Hi All This is my first post here. I am trying to use the python client to query one of my db tables. All works fine until I try to use where. Like this. data = supabase.table(“atable").select("*").where(something=“something”).execute() I get an error AttributeError: 'SyncSelectRequestBuilder' object has no attribute 'where' Is there another operator I can use? Thanks
    g
    • 2
    • 3
  • Select not returning any rows after enabling RLS with authenticated policy
    w

    wieli99

    08/27/2022, 11:25 AM
    I have a table named "Recipes" in my public schema, however I only want logged in users to be able to access the data. So I created a RLS policy as seen below. However as soon as I activate it, I can no longer access the data through the js api (v2). It returns an empty array.
    supabase.from("Recipes").select()
    Looking at my session from the browser, the access token says I'm an authenticated user (
    "aud": "authenticated"
    ). The
    auth.users
    table agrees. What am I doing wrong here?
    n
    • 2
    • 9
  • Help with Signin – Request failed
    m

    maija

    08/27/2022, 11:59 AM
    It is super weird, yesterday my code for user signup and signin worked just fine. Without changes on my code today, I am not getting the
    user
    and the
    session
    back, but an error:
    Copy code
    {
      "data": null,
      "user": null,
      "session": null,
      "error": {
        "message": "Request Failed"
      }
    }
    All requests return 200 and I can't find something unusual in the API or Database logs. I am using the ANON key. GET requests to read data work just fine. Does anyone have an idea, what could have been responsible for this error? Thanks in advance! 🙏
    w
    g
    • 3
    • 14
  • One To Many Relation, Dart Flutter, Database Swagger Codegen
    f

    FloH

    08/27/2022, 12:54 PM
    Hey guys, I am currently working on an project where i have a objectA which consists of many objectB´s. A basic one to many relationship. Here is some pseudo sql code of the table:
    Copy code
    sql
    create table objectA ( id )
    create table objectB ( id, objectA_id references objectA id)
    and i to create those types with the swagger codegen: https://pub.dev/packages/swagger_dart_code_generator (please do not mind syntax. the classes have the json serialization annotation correctly)
    Copy code
    dart
    class ObjectA() {
      id,
      List<ObjectB> objectBs,
    }
    class ObjectB() {
      id
    }
    but the codegen is generating smth like this
    Copy code
    dart
    class ObjectA() {
      id,
    }
    class ObjectB() {
      id,
      objectA_ID,
    }
    which means an postgrest call in dart like this wouldn´t work because objectA.fromJson never reads the value ObjectB:
    Copy code
    dart
    final response = await _supabaseClient
              .from('objectA')
              .select(
                '''
                *,
                objectB (
                  *
                )
                ''',
              )
              .eq('id', id)
              .single()
              .execute();
    final data = response.data as Map<String, dynamic>;
    return ObjectA.fromJson(data);
    any reccomendations or best practices on how to solve this?
    h
    • 2
    • 3
  • Data is not being inserted in supabase.
    m

    mathurah

    08/27/2022, 3:26 PM
    I wrote an insert function to insert new records into supabase but it's not showing up in the database. It is however coming up in the front-end and I'm getting a response. Would anyone be able to help figure out the issue why it's not updating on supabase?
    g
    • 2
    • 1
  • How to access a file from table with js API
    w

    wieli99

    08/27/2022, 4:08 PM
    Hi, I have a table called
    Recipes
    in which I created a column
    image_id
    which is a foreign key to an image id in my public bucket
    recipe_images
    . I would think that with the js API I could get the image with
    const { data, error } = await supabase.from("Recipes").select("recipe_images(*)")
    . However this results in
    Could not find a relationship between 'Recipes' and 'recipe_images' in the schema cache
    I can't find the correct way in the docs, does someone know how to do this?
    g
    • 2
    • 7
  • Writing to RLS-enabled table fails even with Service Key
    w

    Wonie

    08/27/2022, 4:33 PM
    Copy code
    const supabase = createClient(
      'process.env.DB_URL,
      process.env.SUPABASE_SECRET_KEY
    )
    const { data, error } = await supabase
      .from('user_tokens')
      .insert([{ token_read_key: code, token: session.access_token }])
    
    error: new row violates row-level security policy for table
    Any idea why this happens?
    g
    • 2
    • 14
  • Can I only allow viewing some columns in RLS?
    k

    KTibow

    08/27/2022, 5:39 PM
    Right now, I have two tables. `chat`: a table that has chat messages with data like the contents and email of the sender for each message, with a foreign key relation based on the email `schoology_users`: a table that has information from an external service, like oauth keys, and the name and profile picture of the person In order to display the chat message, I use something like
    Copy code
    js
      supabase
        .from("chat")
        .select(
          `
          *,
          schoology_users (
            name,
            profile_picture
          )
          `
        )
    I don't want to allow people to view the auth keys for each person anonymously, but the query doesn't work with the anon key once I enable RLS for
    schoology_users
    . What should I do here? (Also feel free to suggest a better title and/or tags, could be my actual solution would be different from what I think)
    m
    g
    • 3
    • 9
  • Discord auth in React app
    f

    FunHellion

    08/27/2022, 6:11 PM
    Hi there, I've set up a ReactJS app and I'm trying to implement discord auth. When trying to login I get send to discord page. Because of this the page unloads and I dont get my user into my data variable.
    const data = await supabase.auth.getUser();
    Any way to for instance open the discord auth page in another tab of window?
    s
    • 2
    • 3
  • How to change the type of my id column
    p

    PatoGordo

    08/27/2022, 8:01 PM
    When I try to change my id column type, the supabase give me a error
    Copy code
    failed to update pg.columns with the given ID: cannot cast type bigint to uuid
    how can I fix it?
    s
    • 2
    • 3
  • RLS syntax to see all rows if user ID in one of them
    h

    hankg

    08/27/2022, 10:33 PM
    I think I may have to stick with doing this as two tables but on the off chance I'm just being dense about RLS syntax. I am experimenting with RLS using a use case of purely private rooms. I want to set RLS up so that a user can only see information for rooms they created/own or are a member of and to be able to see the other members of the room. There is a rooms table, a profiles table, and a room members table that is just FK to the room ID and the profile ID. I can't seem to figure out how to make it so that the room members table will only allow visibility into rows that correspond to rooms that the user is a member of. It creates an infinite recursion since it requires queries on the table itself. My solution is to have a "my rooms" table and a "room members" table which are essentially the same data with different RLS policies. Then the "Room Members" rule can reference the "my room" data in its RLS which breaks the recursion issue. It feels janky so I figured I'd post it here in case I'm missing something obvious.
    g
    • 2
    • 1
  • How can I filter for results (text format) STARTING with the specified string?
    d

    Deleted User

    08/27/2022, 10:48 PM
    Hello, I want to filter by names and I don't want to search for names by checking if a name contains the search string (in my case I currently use
    .ilike()
    ), but I want to search by checking if the text starts with the specified string. Example:
    Copy code
    Some names:
    - John
    - Marry
    - Joe
    If I search for
    Jo
    , John and Joe should be returned.
    h
    • 2
    • 2
  • Is there a way to differentiate between sign up and sign in when using third party SSO providers?
    f

    franco.valdes

    08/28/2022, 12:11 AM
    In my app I create the user on the server because I end up creating a stripe user and default free subscription along the way. I want to incorporate Google SSO but its becoming quite tedious since there is no way from separating the sign in vs sign up actions.
    m
    r
    • 3
    • 9
  • Passing auth to the API - JS
    a

    Aaron Me

    08/28/2022, 3:20 AM
    I am reading the docs up and down, but I cannot find it, how do I pass the auth to the API request? Let's say I have a table where INSERT is for Authorized only.
    Copy code
    const { data, error } = await supabase
      .from('Contracts')
      .insert([
        { some_column: 'someValue', other_column: 'otherValue' },
      ])
    This will throw:
    Copy code
    {code:"42501"
     message: "new row violates row-level security       policy for table \"Contracts\""}
    Ofc which it should. Pls, help. EDIT: Using:
    Copy code
    "@supabase/supabase-js": "^1.35.6",
     "@supabase/ui": "^0.36.5",
    & NextJS
    • 1
    • 1
  • twitter login with missing email address
    e

    eunjae

    08/28/2022, 9:57 AM
    It seems like twitter (and other social) login doesn't work with supabase if a user is missing an email address. I think these issues confirm it: - https://github.com/supabase/supabase/issues/2853 - https://github.com/supabase/gotrue/issues/214 And the work to fix the issue is being stalled: https://github.com/supabase/gotrue/pull/414 Am I up to date on this topic? I'm not sure how many users would churn if I redirect those users back to twitter, saying they need to add email address there first. Is there any workaround?
  • What is the best way to go about self hosting supabase?
    t

    thecoderatekid

    08/28/2022, 1:38 PM
    I see that supabase studio only give us the dashboard to create our tables, storage, etc, etc. But it does not however give us the UI to put the dashboard behind an authentication UI. I am looking for guidance on best practices, thanks!
    j
    r
    • 3
    • 13
  • Bucket policy question
    m

    mrboutte

    08/28/2022, 2:48 PM
    I have the following scenario: userA and userB each have the ability to upload files to a specific folder path.
    Copy code
    ((bucket_id = 'contract-attachments'::text) AND ((uid())::text = (storage.foldername(name))[2]))
    what I'm struggling to figure out at the moment, is how to write a policy that would allow both users to select/download each other attachments. I also wonder if there's a way for me to rearchitect these file paths to make the problem simpler
    g
    • 2
    • 21
  • Authentication in Jetpack compose( or in Kotlin)
    m

    Mosh Tempest

    08/28/2022, 3:02 PM
    How can we integrate the supabase authentication in Kotlin?
    s
    • 2
    • 1
  • One-to-one relationship
    k

    Kristoff95

    08/28/2022, 5:32 PM
    How can we create a one-to-one relationship in supbase?
    g
    • 2
    • 2
1...101112...230Latest