https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Unable to update column value to null (supabase-js)
    s

    STILLWATER;

    09/24/2022, 1:22 PM
    Im trying to set column value to null based on criteria but im getting error that column is invalid input syntax for type bigint: \"null\ (Column type is int)
    m
    g
    • 3
    • 6
  • OTP via email for signIn
    g

    gustavoeliasexe

    09/24/2022, 2:40 PM
    I would like to ask you if there is a way to use the email sign-in with the OTP verification like mobile phone. The project use angular.
    g
    • 2
    • 2
  • login
    m

    mbr

    09/24/2022, 2:43 PM
    How can I find out what happens behind the scenes when calling
    auth.signUp
    in the JS SDK?
    m
    g
    • 3
    • 8
  • Where can I find the endpoint URLs for things like the GoTrue instance that is part of an app?
    m

    mbr

    09/24/2022, 3:17 PM
    e.g. when trying to access the
    /settings
    endpoint of GoTrue via
    curl
    . Is there a list for these routes?
    g
    • 2
    • 6
  • is there a way to set cors configuration
    s

    sofaking

    09/24/2022, 3:27 PM
    Is it possible to set cors so that only request from my domain can reach supabase? I have some end points which are read only but I don't other domains to be able to make request to those end points.
    g
    • 2
    • 9
  • apiKey vs Bearer token
    m

    mbr

    09/24/2022, 4:34 PM
    Any request made to the REST API seems to expect two JWTs: One in the
    apiKey
    header and one in the
    Authorization: Bearer ...
    header. Obtaining a user JWT via
    /auth/v1/magictoken
    (which is delivered as a cookie named
    sb-access-token
    ?) does not seem to yield a JWT that can be used for both. Is it correct to place the anonymous JWT into the
    apiKey
    header to bypass an initial gateway, and have the supplied user-JWT be used in the
    Authorization
    header for the actual auth? What happens when the
    service_role
    JWT is used for
    apiKey
    instead?
    g
    • 2
    • 2
  • Why does the PresenceState contain a list of Presence for each entry?
    e

    enyo

    09/24/2022, 4:53 PM
    The type is:
    Copy code
    export type PresenceState = { [key: string]: Presence[] }
    I tried it, and when I open multiple windows, it just adds a new entry in the
    PresenceState
    Object, so why is there a list of
    Presence[]
    for each key?
    b
    • 2
    • 1
  • Are conditional .eq checks possible?
    k

    Kruger

    09/24/2022, 5:02 PM
    Is it possible to conditionally check for something in a table? For intance: I want to run
    Copy code
    return supabase
        .from('table1')
        .select(`*`)
        .eq('account', account)
    on one function call, but then:
    Copy code
    return supabase
        .from('table1')
        .select(`*`)
        .eq('account', account)
        .eq('2ndThing', 2ndThing)
    Can I toggle on/off that last eq or do I need to define a separate function?
    m
    • 2
    • 2
  • Supabase magic link - I broke it!
    d

    Dil

    09/24/2022, 5:15 PM
    Hi, I'm trying to get Supabase to send 'magic link' emails using SMTP credentials from Mailjet (https://dev.mailjet.com/smtp-relay/overview/), but nothing is happening. It has been working from a private email server, but with deliverability issues - so we moved to a commercial service. All I have done is change the SMTP settings in the Supabase configuration, but now nothing is working. Anyone able to help? I can share details.
    g
    • 2
    • 7
  • How do I avoid content flashing from signed in and not signed in?
    m

    Matt

    09/24/2022, 5:47 PM
    For example, homepage has a sign in and sign up button when not logged in and a profile button that replaces it when logged in. How can I access this information quicker than doing supabase.auth.user() to handle this? Im using svelte/sveltekit if that matters.
    g
    • 2
    • 14
  • properties undefined
    k

    kingpeppe

    09/24/2022, 5:56 PM
    Hi there, I'm trying to update fields in rows matching my ids but I keep getting undefined. Why does this happen?
    Copy code
    js
    const getCoingeckoData = async () => {
      const { data: tokens, error } = await supabase.from('tokens').select('*');
      const ids = tokens.map((token) => token.coingecko_id);
      console.log(ids); \\ [ 'kounotori', null, 'shield-protocol-token', 'saitama-inu' ]
    
      const { data: price } = await CoinGeckoClient.simple.price({
        ids: ids,
        vs_currencies: 'usd,eth',
        include_market_cap: true,
        include_24hr_vol: true,
        include_24hr_change: true,
        include_last_updated_at: false
      });
    
      ids.forEach(async (id) => {
        const { data, error } = await supabase.from('tokens')
          .update({
            usd: formatCurrency(price[id].usd, 'usd', 'en'),
            eth: formatCurrency(price[id].eth, 'eth', 'en').substring(1)
          }).eq('coingecko_id', id);
      });
    };
    o
    p
    • 3
    • 5
  • Why can't get a variable from onAuthStateChange
    r

    rgfx

    09/24/2022, 6:43 PM
    Copy code
    js
    const testFunction = async () => {
        let userId
    
        supabase.auth.onAuthStateChange((event, session) => {
            if (event == 'SIGNED_IN'){
                userId = session.user.id;
                console.log("auth state has changed", userId);
            }
        });
    
        return userId;
    };
    
    console.log('id',await testFunction());
  • How to find out the latency of a user
    j

    joshua7v

    09/24/2022, 6:50 PM
    Hi, I am playing around with supabase realtime features. I opened the site multiplayer.dev and noticed there is a latency measurement on the bottom left. So I'm wondering how that is implemented.
  • Referencing file in Migration
    s

    sudoramen

    09/24/2022, 11:03 PM
    Hi, this might be more of a postgres question but I'm trying to organize my scripts in a way to where say I want to reference or update a table, I could just alter the sql file at say
    supabase/tables/table_name.sql
    . To add this table in my DB, I run a new migration with the line
    \i supabase/tables/table_name.sql
    but I'm getting
    Error: Error starting database: supabase/tables/table_name.sql: No such file or directory
    when I try to spin up Supabase. Two questions, 1. What is the relative path when running
    supabase start
    ? Maybe I just have the wrong path in my migration script. 2. Is there a better way I could be organizing my scripts/migrations? Thanks for any help!
  • (Production!) Real-time connection 404s after database upgrade
    n

    Nicola

    09/25/2022, 12:13 AM
    Hi, We upgraded our database to a larger size and since then our real-time connections cannot be established and keep returning 404s. We’ve tried reaching out to support to get this looked at or our real-time server restarted (we don’t want to restart the whole project because this is our production project and don’t want the downtime). It’s been 24 hours since the upgrade, is there anyone that can help?
    g
    • 2
    • 13
  • storage.from.list(); returns empty
    b

    Blobby

    09/25/2022, 1:56 AM
    Copy code
    export async function getProspectFileList(): Promise<any> {
      const { data, error } = await supabaseClient.storage
        .from('prospects')
        .list();
      if (error) return error.message;
      console.log("got the data", data);
      return data;
    }
    this returns an empty array. but I see files in the
    prospects
    bucket. any ideas?
    g
    r
    • 3
    • 22
  • RLS on Likes Table
    j

    jdgamble555

    09/25/2022, 2:34 AM
    I have 3 Tables;
    Copy code
    users
    - id
    - ...
    
    posts
    - id
    - author (fk to users.id)
    - ...
    
    likes
    - pid (fk to posts.id)
    - uid (fk to users.id)
    (PK = pid + uid)
    And I'm trying to create a universal policy where users can like their own posts (CRUD), but this doesn't work:
    Copy code
    sql
    (role() = 'authenticated'::text) AND (uid = uid() AND pid.author = uid())
    I get this error:
    Copy code
    Error adding policy: failed to create pg.policies: missing FROM-clause entry for table "pid"
    This seems pretty basic, but my mind keeps exploding right now. J
    g
    s
    • 3
    • 6
  • Supabase Realtime race condition
    s

    stevharve

    09/25/2022, 2:52 AM
    I have a chat portion of my app and it subscribes to the INSERT on the messages table. It fires correctly but if I re-fetch messages instantly when the INSERT fires the new message isn't even in the table yet. And I know the re-fetch is good because if I delay it by 1000ms the table contains the new message.
    g
    j
    • 3
    • 20
  • google oauth redirect
    b

    bhaskar

    09/25/2022, 3:51 AM
    i am trying to redirect to particular page on nextjs after auth with google. it temporarily redirects to the page (status code 307) but redirects again to login. appreciate any help.
  • supabase calling supabase.auth.user().id crashes server error 500
    u

    ((()))

    09/25/2022, 3:55 AM
    in api.js where connection to supabase is made
    Copy code
    js
    userDetails() {
      return supabase
      .from('muni_users')
      .select('*')
      .eq('user_id', supabase.auth.user().id);
    },
    on a page
    Copy code
    js
    export async function load() {
      const { data: muni_user, error: bleh } = await db.users.userDetails();
      console.log(muni_user)
    };
    and this is error I get in terminal while my browser shows ERROR 500
    Copy code
    text
    Cannot read properties of null (reading 'id')
    TypeError: Cannot read properties of null (reading 'id')
    What is causing it and how can I pass currently logged in user id to userDetails()? If I hardcode user id which is uuid for that table then it shows me results I am looking for.
    j
    • 2
    • 3
  • Loading module from “localhost” was blocked because of a disallowed MIME type (“text-html”).
    t

    The Little Cousin

    09/25/2022, 4:39 AM
    I'm trying to build a client with vanilla-js from the front-end to link the DB, been following the API docs and these error are thrown at me. I'm a newbie to Supabase. I've tried the npm method up to the CDN same error.
    p
    k
    • 3
    • 12
  • creating a new user in signup function
    r

    rinorzk

    09/25/2022, 4:47 AM
    so I remember that I did this somehow, I think it was automatic when I set up my project, however not sure what happened and now that function along with the trigger is no longer there. So I'm trying to add it from the start and can't figure out what I am doing wrong. This is my table of profiles I want to add my new users. And this is the function I'm trying to use for the trigger:
    Copy code
    begin
      insert into public.profiles (id, username, avatar_url)
      values (new.id, new.raw_user_meta_data->>'username', new.raw_user_meta_data->>'avatar_url');
      return new;
    end;
    p
    • 2
    • 3
  • Email confirmation url data
    m

    MrPoule

    09/25/2022, 8:08 AM
    Hey all, Is there a way for the email confirmation url (at signup) to pass the access_token, and other informations differently than within the url hash? By default it seems these informations are added in the hash of the url provided in the supabase auth settings: https://my_URL/#access_token=XXXX&expires_in=3600&refresh_token=XXXX&token_type=bearer&type=signup The problem is that I'm using supabase in the backend only (building a client with no JS) and I'd like the link to call and provide access_token etc. to the backend which can then redirect the user to the correct page with the appropriate cookies. But sadly the hash does not exists on the backend side it's just ignored. Thanks in advance 🙂
    • 1
    • 2
  • limit file uploads to n files
    m

    magicbyt3

    09/25/2022, 10:13 AM
    Hi there, I am wondering if there is a way to limit the number of files a User can upload into a bucket. Thanks in advance.
    g
    • 2
    • 2
  • Trying to add array of objects to JSON field
    j

    jdgamble555

    09/25/2022, 12:47 PM
    You should probably post the errors you're getting
    k
    • 2
    • 1
  • Changed column type broke filtering
    u

    0xdunston

    09/25/2022, 11:22 AM
    Hi I changed a column type on table with existing data from int8 to text but now I get this error when trying to filter:
    Copy code
    {
      code: '42883',
      details: null,
      hint: 'No operator matches the given name and argument types. You might need to add explicit type casts.',
      message: 'operator does not exist: text = bigint'
    }
    this used to work fine before:
    Copy code
    let { data, error } = await supabase
        .from('new-follows')
        .select('username,follow_by,twit_id')
        .eq('follow_by', 239518063);
    but now this gives the error above:
    Copy code
    let { data, error } = await supabase
        .from('new-follows')
        .select('username,follow_by,twit_id')
        .eq('follow_by', '239518063');
    • 1
    • 1
  • Supabase realtime where column equal to val1 or val2
    a

    avalanche

    09/25/2022, 11:33 AM
    I have same issue as described in this thread https://stackoverflow.com/questions/73679550/how-to-queries-in-supabase-realtime except I want to filter realtime conversations where sender or receiver equals to some value. Is it possible to do 'or' 'message_table:sender=eq.user1 or recveiver=eq.user2'
    j
    g
    • 3
    • 15
  • Securing rows based on another table.
    l

    liljamesjohn

    09/25/2022, 12:29 PM
    In the image provided, I have 3 tables. Firstly, I am wanting to restrict access to the
    accounts
    so that a user can only access it if they are a
    account manager
    . I also have a
    published_status
    table, which I only want to allow
    account managers
    to have access. How would this be done?
    g
    • 2
    • 2
  • Issues setting up OTP code signin and signup flows
    u

    0xAsimetriq

    09/25/2022, 12:36 PM
    I'm trying to create a user flow where an OTP code is sent to users email and then verified to sign them in. Following supabases documentation I am doing following 1. I changed from using link in "Magic Link" email template to
    {{ .Token }}
    2. I tried using both
    type: 'magiclink'
    and
    type: 'signup'
    in code below 3. My email provider settings are set to
    60000
    for expiry seconds and
    6
    for password length. Email confirmation is set to be enabled. Implementation is as follows
    Copy code
    ts
    const { data, error } = await supabaseClient.auth.signInWithOtp({ email })
    // {"data": {"session": null, "user": null}, "error": null}
    
    const { data, error } = await supabaseClient.auth.verifyOtp({ email, token, type: 'signup' })
    // {"data": {"session": null, "user": null}, "error": [AuthApiError: Token has expired or is invalid]}
    I double verified that token I am sending is exact one as I got in email, yet I keep getting that auth error.
    g
    t
    • 3
    • 34
  • Migrations preserving data
    h

    Haus Of Alejandro

    09/25/2022, 12:58 PM
    Hello everyone! I'm working with local development as described in the official guide (https://supabase.com/docs/guides/cli/local-development). I'm able to sync my remote and local database in order to make changes in local, test and then push to remote. But when I perform a db push the data that was in the remote db is lost, and viceversa Is that behavior expected? Or there's any better way to achieve a migration without data lost? thanks a lot in advance!
1...303132...230Latest