https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Tips for caching data on the edge?
    b

    b----nessmen

    08/20/2022, 11:32 PM
    Hi, every request I have to fetch discord api to check if channel is nsfw or not, since it will often used be on the same servers, it would be easier to just cache that data, any suggestions on how to do that?
  • Database Function returns null
    s

    SparK

    08/21/2022, 12:42 AM
    Hi! I'm having a problem when I call from API a database function, it returns null. And from Supabase UI returns correct information.... What could be happening?
    g
    • 2
    • 10
  • Relationship between tables
    k

    Keviruchis

    08/21/2022, 12:50 AM
    I’m a new web developer that’s started as a hobby about 6 months ago. I’m working in Svelte using the rest api and it’s been a blast! One thing I’ve been struggling with in supabase is relationships between tables even with the direct db queries. How do you reference items in different tables when creating items?
    l
    • 2
    • 1
  • Specify token scopes with Spotify auth provider
    w

    whaley

    08/21/2022, 2:00 AM
    The spotify web playback api needs more token scopes than what's provided by supabase. Is there a way to specify these scopes?
    e
    • 2
    • 2
  • How to count a joined foreign table?
    l

    laubonghaudoi

    08/21/2022, 2:14 AM
    The doc only shows how to count a table without joined foreign tables: https://supabase.com/docs/guides/database/tables#joining-tables-with-foreign-keys Using the example below which gets messages from a certain user:
    Copy code
    typescript
    const { data, error } = await supabase
      .from('messages')
      .select('*, users!inner(*)');
    How to count the joined
    users
    table?
    g
    a
    • 3
    • 5
  • CLI link to project error
    m

    MAXXtreme

    08/21/2022, 2:32 AM
    When I use the CLI (v1.0.7) and run
    supabase link --project-ref PROJECT_ID
    , I get an error:
    Copy code
    sh
    Error: failed to connect to `host=db.PROJECT_ID.supabase.co user=postgres database=postgres`: failed SASL auth (FATAL: SASL authentication failed (SQLSTATE 08P01))
    How can I connect my local instance to my project?
    p
    • 2
    • 2
  • Supabase CLI - Generating types from local hosted supabase possible?
    m

    Milou

    08/21/2022, 5:57 AM
    In your recent blogpost you mentioned that from now on, we can generate types for our database with:
    Copy code
    supabase gen types typescript --local > DatabaseDefinitions.ts
    In the example you use a supabase installation thats managed via supabase CLI. Is there a way to also generate types from a different, currently running local hosted installation?
    p
    • 2
    • 13
  • Why is config.toml required to generate types?
    n

    nahtnam

    08/21/2022, 7:43 AM
    Hello, I have two repos, one that contains the supabase code, and one that contains the frontend. I noticed that trying to run the
    supabase gen types
    command fails when I provide a db-url saying that the config is missing. However I want to keep these repos separate. Is there anything we can do to retain this?
    p
    • 2
    • 3
  • Supabase-js-2, alternative to reloadSession()
    j

    Jesse

    08/21/2022, 10:06 AM
    I see reloadSession is not supported in supabase-js@rc anymore, I use this to reload my access token that holds permissions. Is there any alternative?
    p
    g
    • 3
    • 6
  • How to download data from a bucket?
    u

    ! Do you even Vim, bro?

    08/21/2022, 1:27 PM
    Hi guys, how do I download / get data from a storage bucket on the client side? Let's say I have a file in the following path
    articles/en/1/3.json
    where
    en
    is one of many languages,
    1
    stands for article id and 3 represents a subheading. Thanks in advance! 🙏
    g
    • 2
    • 3
  • Supabase Storage protocol
    l

    leynier

    08/21/2022, 3:05 PM
    I'm interested in using Supabase Storage together with https://github.com/apache/libcloud The question would be: Does Supabase Storage follow any particular protocol? As does Digital Ocean Spaces which follows the S3 protocol.
    g
    • 2
    • 2
  • Getting user data on dynamic page with Next JS
    a

    Audrow

    08/21/2022, 5:44 PM
    I'm trying to make a dynamic page with NextJS using data stored in Supabase. This requires me to use
    getStaticPaths
    to specify which pages are valid and
    getStaticProps
    to load one row's data for the page. I'm having trouble getting my user data in the
    getStaticPaths
    method, so that I can get items that are specific to that user. I'm also using row level security in my tables, so that a user can only select their data. Any advice on how to proceed here? I'm planning to look more into
    @supabase/supabase-auth-helpers/nextjs
    and maybe make an API route that I can use to get my current user's ID, and then I can use that with a service-level Supabase client.
    • 1
    • 1
  • create dummy data for testin
    e

    e.sh

    08/21/2022, 5:52 PM
    is it possible to create dummy data for testing
    b
    g
    • 3
    • 16
  • Github expect iat at jwt
    p

    pu0238

    08/21/2022, 6:14 PM
    Hi I am using superbase as Auth Provider and i do like to send request to "https://api.github.com/app" but there is a problem. This endpoint expect jwt o have "iat", "exp" and "iss" but "iat" is missing. How can i fix that. https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-a-github-app
    s
    • 2
    • 7
  • I'm having trouble writing a query
    b

    bent

    08/21/2022, 6:24 PM
    In SQL, something like
    Copy code
    SQL
    select credit, link, collaborators.instagram, groups.id as group, theme from
    groups join memberships on groups.id = memberships.group
    join collaborators on collaborators.id = memberships.collaborator
    where collab = 12
    would be ok, and then I could use
    map
    and
    reduce
    to get it into this sort of structure:
    Copy code
    js
    [
      {
        "theme": "group 1s theme",
        "collaborators": [{"credit": "my name jeff", "link": "google.com", "instagram": "jeff"}, {"credit": "asdf", "link": "google.com", "instagram": "asdf"}]
      },
      {
        "theme": "group 2s theme",
        "collaborators": [{"credit": "ulfrick", "link": "google.com", "instagram": "stormcloak69"}]
      }
    ]
    now, what's the best way to get there with supabase? Is there even a way to get this done with only one request? I can do this
    Copy code
    ts
      const { data, error } = await supabase.from<definitions["groups"]>("groups").select(`
      theme,
      collab (
        collaborators (
          credit
        )
      )`).eq('collab', id);
    but then I get every person, even if they are not inside a group and if I do
    Copy code
    ts
      const { data, error } = await supabase.from<definitions["groups"]>("groups").select(`
      theme,
      collaborators (
          credit
      )`).eq('collab', id);
    collaborators
    will be an array in the result, but empty.
    e
    s
    • 3
    • 3
  • NextJS quickstart getSession is not a function
    b

    Bee

    08/21/2022, 6:30 PM
    Hi all, I am just trying to follow the NextJS guide here: https://supabase.com/docs/guides/with-nextjs#intro and I am running into this error "TypeError: _utils_supabaseClient__WEBPACK_IMPORTED_MODULE_3__.supabase.auth.getSession is not a function" Any idea how to fix this? My code is exactly what's on the page. Thanks!
    g
    s
    h
    • 4
    • 14
  • View not loading in supabase table editor
    m

    Monkeybanana

    08/21/2022, 6:48 PM
    Why doesn't my view load in the supabase editor? It works in all my postgres clients, but on the Supabase website table editor it's stuck on "Loading..." with the loading animation. I've left it like this for hours and it never seems to end On my Postgres clients this view loads in less than a second. I have other views that work fine in the supabase table editor, it's just one that gets stuck on "Loading..."
    g
    • 2
    • 2
  • Sveltekit page.sever.ts
    a

    Ape R Us

    08/21/2022, 7:35 PM
    Hey, would like to know if this is the best method to fetch data and throw errors
    Copy code
    import supabase from '$lib/db';
    import { error } from '@sveltejs/kit';
    
    export const load = async () => {
        const {
            data: events,
            error: eventsError,
            status: eventsStatus
        } = await supabase.from('event').select('name, organiser, url').limit(4);
    
        const {
            data: fundraisers,
            status: fundraiserStatus,
            error: fundraiserError
        } = await supabase.from('fundraisers').select('*');
    
        if (events && fundraisers) {
            return {
                events,
                fundraisers
            };
        }
    
        if (eventsError || fundraiserError) {
            throw error(404, `Events: ${eventsError?.message}, Fundraiser: ${fundraiserError?.message}`);
        }
    };
  • I have an error in edge functions
    f

    Fainaru

    08/21/2022, 9:09 PM
    It happens to me when sending a status other than 200
    g
    • 2
    • 4
  • signOut doesn't remove session from local storage
    f

    Fyris

    08/21/2022, 9:19 PM
    Hey, I am experimenting with supabase. I like it so far, but I have encountered problems with signing out. When I use
    supabase.auth.signOut()
    request is sent, however token inside local storage is not removed. Due to that
    supabase.auth.user()
    returns valid user object and not null. I inspected
    signOut
    method and it is supposed to remove item in local storage with session, however this is not done. I need to to it manually by myself with
    localStorage.removeItem(STORAGE_KEY)
    . Had anybody seen similar problem like this? Here's code I have used:
    Copy code
    const handleSignOut = async () => {
            await getClient().auth.signOut();
            localStorage.removeItem(STORAGE_KEY); // this is mandatory, otherwise signing out doesn't work
            setUser(null)
        }
    g
    s
    • 3
    • 7
  • function auth.jwt() does not exist for local RLS?
    s

    samwoolerton

    08/21/2022, 10:15 PM
    After configuring RLS policies locally through Supabase Studio, I generated migrations and now can't run
    supabase start
    because running migrations throws with
    function auth.jwt() does not exist
    . Is there a setting I can change or some step I've missed? I've opened an issue on GitHub here: https://github.com/supabase/postgres/issues/277
  • Need to reload to use Supabase auth
    h

    harsh singh

    08/22/2022, 12:52 AM
    Whenever I sign in on Supabase (I've tested Firefox and Brave), it brings me back to the home page as it should but I'm not authenticated. Although, after I reload the page, I am authenticated and everything works as intended. How would I go about solving this bug?
    g
    • 2
    • 38
  • Unable to use getUser without async
    h

    harsh singh

    08/22/2022, 1:58 AM
    Just upgraded to Supabase's JS client v2, and I had issues with getting the user without using async.
    c
    s
    • 3
    • 16
  • Insert not returning new data
    k

    kevindmoore

    08/22/2022, 3:22 AM
    In the dev4 version of supabase Flutter, the insert command is returning null and not the updated data.
    Copy code
    final data = await client.from(tableName).insert(tableData);
    g
    w
    • 3
    • 7
  • How do I set few users as admin?
    s

    stha_ashesh

    08/22/2022, 3:25 AM
    I want to manually set few users as admin and set RLS for admin role only. I am a beginner in this hence I may have missed it. Thanks
    g
    j
    • 3
    • 3
  • problems creating rls
    f

    Fainaru

    08/22/2022, 5:15 AM
    first time using rls and I have problems creating the security as I try to use a function and it gives me the error only when the result is true
    g
    • 2
    • 2
  • CNAME Cloudflare
    d

    daud18

    08/22/2022, 6:43 AM
    Hi, how can i setup cname through cloudflare for supabase db connection
  • Query data in jsonb values array
    m

    MrZe0n

    08/22/2022, 7:57 AM
    I have a jsonb type column, and I want to use a filter such as in() or contains() to check if one of the values matches my query. The column has an array ["blue", "green"], so I want to have a function such as in('colours', ["orange", "blue"]) and have it match, is that possible?
    g
    b
    • 3
    • 13
  • Problems with getUser rc in Node 16, but not 18
    r

    raae (queen.raae.codes)

    08/22/2022, 12:44 PM
    I upgraded to the rc (ie version 1) and when I do:
    Copy code
    import { createClient } from "@supabase/supabase-js";
    import fetch from "node-fetch";
    
    const supabase = createClient(supabaseUrl, supabaseAnonKey, {
      fetch: (...args) => fetch(...args),
    });
    
    const userResult = await supabase.auth.getUser(
      req.body.accessToken
    );
    I get:
    Copy code
    Right-hand side of 'instanceof' is not an object
    
      TypeError: Right-hand side of 'instanceof' is not an object
      
      - fetch.js?:23 eval
        [.]/[@supabase]/gotrue-js/dist/module/lib/fetch.js?:23:17
      
      - Generator.next
    This does not happen if I switch to Node 18. Or if I switch back to version 1 of supabase and use
    supabase.auth.api.getUser
    Is there anything I could do to get it to work on Node16?
    b
    • 2
    • 7
  • Pass metadata info on magiclink
    j

    Jaaneek

    08/22/2022, 12:59 PM
    I would like to register people by magicLink, the problem is that I can only do that by using .signIn and not providing password. .signIn method does not have 'data' property which Is used in signUp for passing additional data.
    g
    • 2
    • 3
1...678...230Latest