https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How to update profile picture (avatar) src file so we don't store picture unused?
    b

    blurblur

    12/15/2022, 12:26 PM
    Hello guys! How do we replace (on upload) the user avatar src file, so we don't store unused pictures?
    f
    b
    b
    • 4
    • 4
  • set-cookie in function
    s

    sigma-andex

    12/15/2022, 3:52 PM
    How can I set a cookie in an edge function? I'm using
    cookie.setCookie
    to set the cookie on the response, and it is in the response that I return, but the cookie doesn't seem to be forwarded from the gateway..
    a
    c
    • 3
    • 4
  • Spotify social login refresh token
    x

    xenon

    12/15/2022, 5:12 PM
    Does the social login authentication also automatically refresh the auth token when it has expired? Specifically asking for Spotify.
    c
    • 2
    • 2
  • How to use JWT to authenticate user on a custom server?
    w

    Wizzel

    12/15/2022, 6:01 PM
    I want to write a custom server where I need to authenticate the user, that has made a request. Unfortunately I am a complete beginner when it comes to authentication. Current state Currently I am getting the refresh token from an authenticated user like this:
    Copy code
    dart
    final token = Supabase.instance.client.auth.currentSession?.refreshToken;
    I copy and pasted this value(for now) and set it as a parameter on the server: Inside the servers middleware, I set
    Copy code
    dart
    await supabase.auth.setSession(refreshToken);
    to use the users credentials on the server. Questions 1) I have read that I can verify an accessToken by using the JWT secret of my project to make sure the request if from a real user. However, I am a bit confused here because the
    .setSession()
    requires a refreshToken. Do I need to send both the accessToken and the refreshToken to the server? If not, how can I authenticate the user on the server? 2) How/where do I set the tokens value? Do I include it in the request header?
    j
    • 2
    • 15
  • table in table
    p

    Pure

    12/15/2022, 8:50 PM
    Hello! i am actually new to advanced databases. i used quick.db and quickmongo type of things all the time. so what i want is object in objects. i mean like db.get("users.user.assets.purse") and setting that. i checked supabase but i cant really find a way to do that. i can create individual tables but i cant make a sub table in a table. like i can make user, it has an id and name, but i cant make a sub table in it which includes its purse and so.
    o
    g
    f
    • 4
    • 7
  • Trouble with realtime access in local development using supabase auth + next.js
    k

    KT

    12/15/2022, 9:11 PM
    So I get the following error "Error 401: Unauthorized". I have enabled the tables I want to subscribe on in "Replication" but I'm not able to access it using the service_role key. Am I missing an obvious step here? Please help me out
    g
    c
    • 3
    • 10
  • Are Supabase Auth Helpers for SvelteKit insecure?
    s

    Smardrengr

    12/16/2022, 12:09 AM
    After watching

    https://www.youtube.com/watch?v=UbhhJWV3bmIâ–¾

    , I'm concerned that the auth redirect logic for protected routes should be in
    hooks.server.ts
    , not in each
    +page.ts
    that is under the so-called protected
    (dashboard)
    group route. Thoughts?
    b
    • 2
    • 1
  • email template if condition?
    d

    Dies.Irae

    12/16/2022, 3:28 AM
    Wondering if I can add conditionals within my email template
    g
    • 2
    • 70
  • Firestore migration to Postgres (Supabase)
    m

    MorenoMdz

    12/16/2022, 4:10 AM
    Hey there, I would like to see if anybody in the community has experience migrating off FS into Postgres, I noticed that Supabase has a way to do it and wonder what are the limitations. We have a semi large system that we are going to migrate from NoSQL to SQL and this came up during the research.🤔
    s
    v
    • 3
    • 3
  • Restrict number of returning items
    d

    Damir

    12/16/2022, 7:53 PM
    As far as I can see all items of a table can be retrieved in one API call, by simply not specifying paging. Is it possible to restrict the number of returning items in API calls for all tables/functions?
    g
    • 2
    • 2
  • How to add profile data to session with SvelteKit auth helpers
    e

    enyo

    12/16/2022, 9:31 PM
    The new svelte kit auth helpers are amazing. But I need to display the user name and other things (that are stored in another
    profile
    table) on the account page, so I'd like to add some of this data to the session. Is there a way to do that?
    c
    • 2
    • 2
  • How do invite invite users by email client side?
    e

    ethanfox

    12/17/2022, 12:16 AM
    I am creating an app for architecture firms and I want the firm owner to be able invite their employees by their email addresses. I know supabase have inviteUserByEmail() but they say to not run the client side because of the key that is needed to run the function. Is inviteUserByEmail applicable to edge functions? I am not sure on how to go about this.
    u
    d
    • 3
    • 2
  • Row Level Security on database view
    m

    mick

    12/17/2022, 4:43 AM
    Hi, I am trying to set up row level security on a view. I understand that the view inherits the permissions of the user that created it, and that the view owner needs to be changed to the current user. Supabase docs (https://supabase.com/docs/guides/database/tables) refer to an issue https://github.com/supabase/supabase/discussions/901 that indicates that this can be done via the SQL editor with the following command:
    ALTER VIEW [view] OWNER TO authenticated;
    When I tried to implement this, I get an error stating: Failed to run sql query: must be member of role "authenticated". I think this might be related to the change to SQL Editor user roles to postgres, rather than a super user. Can any one give me some advice on how to change the view owner to the user calling the view? Update: I have granted the authenticated role to the postgres user, and am now getting the error: Failed to run sql query: permission denied for schema public I have attempted to add all permissions on schema public to the postgres user, however the error continues.
    t
    • 2
    • 1
  • Supabase Swift Documentation
    l

    Lingxi

    12/17/2022, 6:28 AM
    I wonder if there is a documentation (site or markdown) for Supabase Swift. Although most of APIs are the same with JS version, there are still a lot of different things that need to be noted or worth to point out. It seems like there isn't an official one out there. So if there is no an ongoing one, I might consider to make one (probably unofficial).
    c
    • 2
    • 1
  • Login with Multiple Auth providers per account
    s

    SpikeSaber

    12/17/2022, 10:12 AM
    I have configured my project to use Phone auth via Twilio. However I want users to be able to sign in via Google Auth or email as well. Would it be possible for a existing user to link their Google account or email?
    s
    a
    e
    • 4
    • 3
  • How to impersonate the user from a NodeJS API
    m

    mancku

    12/17/2022, 10:26 AM
    Hi, I'm creating an API in NodeJS and (using NestJS, but it would be the same using ExpressJS or StrapiJS) and I want to do a simple select, like
    Copy code
    js
    const rows = await supabaseClient.from('profiles').select('*');
    The select works fine, but I want it to impersonate the user so it would only return that person's profile, using Supabase policies. I have the JWT (access_token) of the user but I can't find a way to create the client so the policies would act. I always end up getting all the rows. Can someone help me with that? Thank you very much! PS: Here's the table and policies definition:
    Copy code
    sql
    create table public.profiles (
      id uuid references auth.users(id) not null ,
      first_name text,
      last_name text,
    
      primary key (id)
    );
    
    alter table public.profiles enable row level security;
    
    create policy "Users can get own profile."
      on profiles for select
      using ( auth.uid() = id );
    u
    g
    • 3
    • 6
  • is supabase really the thing i need?
    p

    Pure

    12/17/2022, 12:29 PM
    Hello, i currently want to develop a discord bot which i want it to grow. I used databases system like quick.db which uses sqlite or mysql. The bot will probably make millions of changes to the database every minute or second if it grows up as its a complicated game. Is it really the right way to go? I thought it may be better to go with quick.db locally then make backups every 12 hours or so. Is supabase really made for millions of data handling per second like that or am I in the wrong way?
    c
    • 2
    • 2
  • How to display OTP in email template?
    g

    glowcap

    12/17/2022, 5:03 PM
    I've spent some time digging through the docs and can't seem to find the correct way to display the
    .Token
    value in the email template. The docs say to replace
    .ConfirmationURL
    with the token value, but it's still embedded in an href which obviously isn't ideal. Can someone instruct me on how to just display the Token value?
    g
    • 2
    • 5
  • Grafana Example
    n

    navandstokes

    12/17/2022, 6:52 PM
    Has anyone set up a Grafana dashboard successfully using this example? https://github.com/supabase/grafana-agent-fly-example/ It's my first time using Prometheus, Grafana, or Fly and can't quite figure it out.
    j
    m
    • 3
    • 5
  • How to upgrade supabase postgrest to 10.0?
    j

    Jaaneek

    12/18/2022, 1:07 AM
    There are quite few features I would like to use in postgrest 10.0, can I somehow update my supabase to use it? Right now it's "PostgREST API","version":"9.0.0.20220531 (pre-release
    g
    a
    • 3
    • 2
  • Check if row already exists with RLS.
    f

    floyare

    12/18/2022, 3:28 PM
    I have simple table that only user can post in it once for every 'target' user. For example.
    user1
    have row that targets
    user2
    and user1 can't insert any more of this combination. And now my question is is it possible to do it with RLS?
    g
    • 2
    • 6
  • data.session from supabase.auth.getSession() is always null.
    t

    Torwent

    12/18/2022, 6:15 PM
    So... I consider myself a javascript/typescript newbie but I've been using supabase for several months now just fine. I've recently started a new project in which I installed the latest version of supabase.js which uses the new
    javascript v2.0
    release and no matter what I try
    data.session
    from
    supabase.auth.getSession()
    is always
    null
    . To be specific, I'm using
    "@supabase/supabase-js": "^2.2.1"
    . This is the code I'm trying to run:
    Copy code
    typescript
    const options = { auth: { autoRefreshToken: true, persistSession: true } }
    const supabase = createClient(env.SB_URL, env.SB_ANON_KEY, options)
    
    const login = async () => {
      const { data, error } = await supabase.auth.getSession()
     
      if (error) {
        console.error(error)
        return false
      }
    
      if (data.session == null) {
        console.log("here")
        const { data, error } = await supabase.auth.signInWithPassword({
          email: env.USER,
          password: env.PASS,
        })
        if (error) {
          console.error(error)
          return false
        }
      //I've printed data here, All seems fine.
      }
    
      //debugging here my session:
      console.log(await supabase.auth.getSession())
      return true
    }
    I've also tried using
    supabase.getUser()
    but the result is the same, it's always
    null
    . What am I doing wrong? :S
    g
    • 2
    • 17
  • Error getaddrinfo on a fresh git clone
    i

    itisnajim

    12/18/2022, 11:01 PM
    i get this error when running
    docker-compose up -d
    supabase-auth
    and
    supabase-storage
    won't to start, other services are ok !
    Copy code
    console
    supabase-storage | 2022 Error: getaddrinfo EAI_AGAIN supabase_storage_admin
    supabase-storage | 2022     at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
    supabase-storage | 2022   errno: -3001,
    supabase-storage | 2022   code: 'EAI_AGAIN',
    supabase-storage | 2022   syscall: 'getaddrinfo',
    supabase-storage | 2022   hostname: 'supabase_storage_admin'
    any idea of how to fix?
    s
    • 2
    • 5
  • Get file URL directly after upload
    x

    Xepp

    12/18/2022, 11:02 PM
    I am trying to have a form that uploads an image, but right after the image is uploaded I want to get the public url and store it together with metadata in a table, but when I try to fetch publicUrl after upload it is undefined.
    Copy code
    const { uploadData, uploadError } = await supabase.storage
          .from(bucketName)
          .upload(fileName, file, { upsert: true });
    
        if (uploadError) {
          setError("Upload error: " + uploadError.message);
          return;
        }
    
        let { publicURL, error } = await supabase.storage
          .from(bucketName)
          .getPublicUrl(fileName);
        // publicUrl is undefined
    
    `
    How can I achieve this?
    g
    l
    • 3
    • 13
  • create RLS to only allow authenticated users to insert data
    m

    Matt B

    12/19/2022, 12:32 AM
    I am trying to use row level security to only allow authenticated users to insert data into a table. I used the premade rule in supabase that says it should only allow authenticated users to insert data, but when an authenticated user attempts to insert data, it throws an error that rls denied the request. Do I need to pass any special data when I insert data, or should it just work off the session?
    g
    n
    • 3
    • 10
  • Auth docs unreadable
    h

    hyperknot

    12/19/2022, 2:23 AM
    https://supabase.com/docs/reference/auth/introduction is unreadable in the default dark mode.
    g
    • 2
    • 5
  • Check if data exists in row before deciding to update
    j

    jarryd

    12/19/2022, 6:01 AM
    I'm scraping event data from sites to create a central calendar of events and will be scraping data regularly (most likely daily). I'm using octaparse for the web scraping and then doing some data cleaning before sending the data to supabase. I'm also going to look at using a generative AI tool (probably Open AI) to identify event categories and for music events the genres for improved searching and recommendations for every new event added. I know I can do an upsert and just override any exist events with the data from the latest web scrape but I was planning to base the function that sends the event description to Open AI for the category and genre generation on when a row is added, plus hope to use new data being updated as a trigger for user notificiations. 1. Would a new row trigger for a function also include when a row is updated? 2. Octaparse can only check if a url has been scraped before not that the data has updated on that URL so ideally I'd like to check if the latest web scraped event data matches all the current data already in that row in supabase and ignore so that I can then create triggers for when an event actually has new data such as sold out, change of date, cancelled, updated description etc to notify users. 3. It'll be potentially 10k-30k events that will be scraped daily so most won't need to be updated and don't know if check each individually for changes across every column in a row is a slow way to do it. Would love any thoughts on the best way to approach this type of scenario.
    g
    • 2
    • 4
  • Unable to use 'docker-compose up' on ubuntu server
    l

    Lukas?

    12/19/2022, 7:59 AM
    I fixed the original error
    • 1
    • 2
  • Math in UPDATE Statement
    a

    AliCodes!

    12/19/2022, 9:03 AM
    Sorry if this is really obvious(still kind of a noob at SQL, Postgres, and Supabase). Is there a way to run a math op in an UPDATE statement? Like UPDATE value = value - 10?
    n
    • 2
    • 3
  • Upgrade project on pro plan
    t

    talpiven

    12/19/2022, 10:13 AM
    It seems it is not possible to upgrade a pro plan for example from v14 => v15 of Postgres, Is it happens automatically or it is a bug??
    n
    s
    +3
    • 6
    • 10
1...727374...230Latest