https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Edge function slow when hitting internally from Postgres http extension
    j

    jh

    02/06/2023, 10:38 PM
    I'm curious if others are witnessing slow edge functions when using them internally? I've run some tests like:
    Copy code
    sql
    SELECT
      *
    FROM
      http_get ('http://httpbin.org/');
    This is runs correctly and quickly. Now when I run against my edge function:
    Copy code
    sql
    SELECT
      *
    FROM
      http_get ('https://my-project-id.functions.supabase.co/delete-user-avatar/user-id');
    It times out with:
    Copy code
    Failed to run sql query: Operation timed out after 5001 milliseconds with 0 bytes received
    I've ran it with insomnia and it responds quickly, so I'm not sure what may be going on. Any suggestions?
    • 1
    • 3
  • ParserError<"Expected identifier at `\"*\")`">
    n

    nimo

    02/06/2023, 11:07 PM
    Getting a typescript error:
    Copy code
    Argument of type 'Omit<UseQueryOptions<TranscriptWithInterview, unknown, TranscriptWithInterview, QueryKey>, "queryKey" | "queryFn">' is not assignable to parameter of type 'Omit<UseQueryOptions<ParserError<"Expected identifier at `\"*\")`">, unknown, TranscriptWithInterview, QueryKey>, "queryKey" | "queryFn">'.
    I'm using supabase browser client like so:
    Copy code
    const { data: transcript, error } = await supabaseClient
        .from('transcript')
        .select('*, interview("*")')
        .eq('id', tId)
        .single();
    with react-query. It's erroring with the
    interview("*")
    line, likely because the typescript definitions are confusing it? Any advice on handling this?
    g
    • 2
    • 23
  • seeding files in storage in local supabase (dev. env.)
    l

    logemann

    02/07/2023, 1:41 AM
    Since there is no easy way to populate test files via seed.sql when it comes to storage, i wonder whats the best way to populate it. The following options come into my mind. 1) separate build target which just calls a node function doing the insert via JS API (not my fav since its a manual step after supabase local started up) 2) calling a webhook which itself is triggered via some SQL call in seed.sql (but it seems supabase local doesnt support webhooks yet) I really want to have something which runs automatically on "supabase start" like seed.sql. Everything you need to run yourself will be easily forgotten.
    s
    p
    • 3
    • 5
  • Inconsistent fetching data from table [resolved]
    c

    Chez

    02/07/2023, 1:43 AM
    Hello! I'm relatively new to Supabase and am looking for more info than I can find through docs or googling. Right now, I'm creating a very simple Gallery App with Nextjs. The issue I'm having is that every few refreshes (dev mode) the data is called from the table correctly, and other times it's not. I'm getting feedback in my browser tools "Error GET (path to image) 400" I'm going off a tutorial and wondering what I'm doing wrong. Here is my code for context. Edit: I forgot to mention for my RLS on my table I'm allowing read access and insert. For my storage.objects and storage.buckets I'm allowing read and insert as well.
    g
    l
    • 3
    • 31
  • Multiple environments
    n

    nimo

    02/07/2023, 1:46 AM
    Hey all, I'm following the guide here (https://supabase.com/docs/guides/cli/managing-environments) to setup migrations across different environments. However, I keep running into the error:
    Error: Cannot connect to the Docker daemon at
    . 1. Is Docker necessary to set this up? Ideally my localhost db points to an environment on Supabase? 2. If yes, is
    ley
    the best alternative? I would rather not rely on docker locally. 3. Will migrations using GH Actions / ley capture changes to RLS, or do those need to be manually duplicated across environments?
    s
    • 2
    • 4
  • Next Auth roles
    p

    Pythonic

    02/07/2023, 1:51 AM
    Hi there, I've been using NextAuth.js with Supabase and things have been going well. I was trying to implement an "admin" role that some users have to get increased priveledges so in my
    users
    table I have a column
    role
    and I have a function called
    next_auth.role()
    which does the following:
    Copy code
    sql
    
      select
        coalesce(
            nullif(current_setting('request.jwt.claim.role', true), ''),
            (nullif(current_setting('request.jwt.claims', true), '')::jsonb ->> 'role')
        )::text
    I'm pretty sure this should be working as intended, however I'm getting a strange error after manually giving myself the role
    supabase_admin
    and making a request with the JWT that includes the role
    Copy code
    Uncaught (in promise) Error: permission denied to set role "supabase_admin"
    Anyone know what this means and how to avoid it?
  • Need help with adding a row to a table while referencing a foreign key - Javascript API
    v

    Vince

    02/07/2023, 2:07 AM
    I recently added a table called
    products
    with
    product_name
    . The
    id
    and
    created_at
    columns are automatically added. I was able to programmatically populate the `products`table with data I got from another source. This is how row insertion is implemented:
    Copy code
    const { data, error } = await supabase
          .from("prices")
          .insert([pricePayload])
          .select();
        if (error) {
          console.log("Cannot insert, see error: ");
          console.log(error);
        }
        if (data) {
          console.log("Success!");
          console.log(data);
        }
    Next, I added a table called
    prices
    . Each price belongs to a product but a product can have multiple prices so it references product id as a foreign key. I don't know how to programmatically reference the foreign key when calling the API. Does anyone know how to do this? Is there a reference somewhere I could find?
    g
    • 2
    • 3
  • How to skip the Confirm email and register directly if Confirm email is enabled?
    e

    Eryou Hao

    02/07/2023, 2:11 AM
    How can I enable a small number of users to skip the Confirm email and register directly if Confirm email is enabled? I have some user data migrated from FaunaDB and I want to enable the old users from before to log in directly on the new system, the solution I use is Set VIP mailbox whitelist, when user login, check if it is in the whitelist, if it is, then login FaunaDB by the mailbox + password he entered, if the login is successful, it means the mailbox and password are correct, then use this data to register users in Supabase, so as to achieve data migration. But then I have to disable Confirm Email, but I want to enable Confirm Email for new user registration, so I don't know how to do it so that the old user can skip this process.
    • 1
    • 1
  • Requests doesn't seem to run in parallel [Supabase Functions]
    k

    khaledg

    02/07/2023, 3:18 AM
    Hey guys, I am trying to get the requests to run in parallel. Was expecting to get all requests to respond after 5 seconds here since they all fire at the same time, but they are blocked and remain stalled. Any help will be appreciated.
    a
    u
    • 3
    • 8
  • jsonb trigger function
    o

    Olly

    02/07/2023, 4:11 AM
    Hey! I want to add a jsonb with a trigger function, but the problem is that I cannot figure out the right formula Insert into users-history(id, data) values(new.id, ….) Return new;
    g
    • 2
    • 2
  • How hard is it to create a 'real-time' app?
    a

    AntDX316

    02/07/2023, 6:16 AM
    How hard is it to create a real-time app? Does it eat lots of battery power and internet bandwidth? I've been using patch and get requests and it works great but I'm seeing if upgrading to real-time is worth it? If it's crazy involving it's not worth it..
    b
    • 2
    • 2
  • range returning rows that don't meet filters
    j

    Jorf

    02/07/2023, 7:36 AM
    I'm constructing a supabase query dynamically, then adding filters, then ending with some ordering and a range:
    Copy code
    let jams = supabaseClient.from('jams').select('*');
    [FILTERS HERE]
    jams = jams.order(orderBy, { ascending: asc });
      jams = jams.range(startRange, endRange);
      const { data: jamsFetched } = await jams;
    While there are rows that match the filters, it works properly, but when rows that match the filters run out, it starts fetching rows that don't match the filters. Similar to this question: https://discord.com/channels/839993398554656828/1017135923298840676/1017135923298840676 The solution there was to add an order. My query has an order. Any ideas on how to get it to stop fetching data that doesn't match the filters?
    g
    • 2
    • 36
  • How to send google uuid into text uuid in database
    n

    Neelay

    02/07/2023, 7:54 AM
    So i am doing auth via firebase auth and trying to insert the uuid into user_id but i am getting this error: " invalid input syntax for type uuid: "Y4av6kZEdQTqQ4KFHerKplcaItD2"" What i tried var userdata = { 'email_id': user!.email!, 'user_id': user!.uid.toString(), 'provider': Platform.isIOS ? 'ios' : 'android',};supabase.from('user').insert(userdata)
    g
    • 2
    • 1
  • Cache Supabase table in Eleventy
    w

    WD40

    02/07/2023, 9:04 AM
    Hi all, I'm looking to cache data from Supabase in my Eleventy blog so that I don't need to call the API every time the live server reloads, however I am having trouble doing so. I'm currently trying to implement the [eleventy-fetch](https://www.11ty.dev/docs/plugins/fetch/) plugin and I believe the part I'm stuck on is entering an API URL that authenticates me as a user - I'm not sure how to enter this correctly. At the moment I think I'm entering the supabase client in full, maybe it needs to be more specific than that? I'm quite lost to be honest. My code is shown in full below for reference:
    Copy code
    require('dotenv').config()
    const { AssetCache } = require("@11ty/eleventy-fetch");
    const supabase = require('@supabase/supabase-js').createClient(
        process.env.SUPABASE_URL,
        process.env.SUPABASE_KEY
    )
    
    console.log(supabase);
    
    module.exports = async function () {
    
        let asset = new AssetCache(supabase);
    
        if(asset.isCacheValid("1d")) {
            return asset.getCachedValue();
        }
    
        try {
            // Query the Library table
            const libraryTable = await supabase.from('Library').select('*')
    
            // Return the result as a collection
            return libraryTable.data
        } catch (error) {
            // Log the error
            console.error(error)
        }
    }
    Any help would be much appreciated. Also note I am happy to hear an alternative to eleventy-fetch too, it was just my first port of call at this stage.
  • signInWithPassword does not update supabase user, but auth session is updated.
    b

    blimey

    02/07/2023, 9:16 AM
    Please see description in my repo https://github.com/rscorer/auth-demo You should see
    Copy code
    [Log] No user (auth.ts, line 10)
    [Log] No auth session (auth.ts, line 17)
    [Log] Auth State changed – Proxy {access_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6Ik ... …} (app.vue, line 19)
    [Log] No user (auth.ts, line 10)
    [Log] Got Auth session, user =  – {id: "b0a83c5b-4ffd-400d-b751-61ffc2490d72",  …} (auth.ts, line 14)
    The first 
    No user
     and 
    No auth session
     are expected, as this is us hitting the login page. Then the 
    Auth State changed
    , this is us hitting Login button. There is however no
    user
    in the 
    useSupabaseUser
     composite. Which there should be, since we just logged in. This is in 
    auth.ts
     on line 10. The next log line shows us we have an 
    auth session
    , which contains the user. Question is, why is this not in the useSupabaseUser composite?
  • Please how do i find an item on the database using an id, to avoid this "message: 'already exists.'"
    a

    Amara

    02/07/2023, 9:30 AM
    Please I keep getting this error "message: already exist", I want to find if an item exist already on the database, then increase the quantity of the item instead of adding it again. I am using this logic to build a cart
    g
    • 2
    • 1
  • "message":"No API key found in request"
    c

    CynicalDuck

    02/07/2023, 9:31 AM
    Hi, NEXTJS - Supabase Free level (DEV) I tried to search but did not find a topic that fit the problem that I have. I use the email/password login and 'create user' and 'login' works very nice. I am able to log in and I can return the username etc. When I am trying to post data to a new table "FOLDERS" i do it this way: async function onClickCreateFolder() { if (createNewFolderName) { const { data, error } = await supabase .from("folders") .insert({ name: createNewFolderName }); if (!error) { window.location.reload(); } } } What am I missing since i am getting the error "message":"No API key found in request" ? I am using the same supabase import in my create user and login. Sorry for bad english, hope you understand me. Thanks.
    • 1
    • 3
  • Slack provider token errors
    m

    mattfreire

    02/07/2023, 10:08 AM
    Hi everyone. We're getting a strange error in our authentication process via Slack. Immediately after authenticating we use the user's provider_token for requests to Slacks API but sometimes we get a missing scope error response. Our slack app has the correct scopes, and for some users the registration process works fine but for others they get this error. Any ideas on what could be causing this issue?
  • Calling the REST API
    w

    WD40

    02/07/2023, 11:12 AM
    Hi, I am looking for assistance in calling the Supabase REST API. The background is I am trying to cache the data from a Supabase table I'm using in my Eleventy blog, so it doesn't call the API every time the live server reloads. I was planning on doing this using eleventy-fetch (https://www.11ty.dev/docs/plugins/fetch/). The basic code looks something like the following:
    Copy code
    const EleventyFetch = require("@11ty/eleventy-fetch");
    
    module.exports = async function() {
      let url = "https://api.github.com/repos/11ty/eleventy";
    
      /* This returns a promise */
      return EleventyFetch(url, {
        duration: "1d", // save for 1 day
        type: "json"    // we’ll parse JSON for you
      });
    };
    What I'm stuck on is how to correctly change that URL to cache Supabase data. According to the documentation, the REST API is available at the following url
    https://<project_ref>.supabase.co/rest/v1
    and this requires the
    anon
    key to be passed through an
    apiKey
    header. How do I actually write this? I have no idea what it means for a URL to have a header. Any help would be much appreciated, thank you.
    r
    g
    • 3
    • 6
  • storage RLS not working
    v

    vjoohov

    02/07/2023, 12:50 PM
    Even if i set SELECT RLS always return false, anyone can download the file through following code const { data, error } = await supabase.storage .from("lecture-notes") .download("example.pdf"); do i have to setup more stuff?
  • Restful API a bit slow
    r

    Reuben

    02/07/2023, 1:04 PM
    I am seeing load times of half a second on responses filtered by
    ?limit=3
    and returned payload being ~2kb. Is this normal and is there a way of speeding this up?
    g
    • 2
    • 2
  • Any template when creating tables with SQL code for timestampz?
    l

    lake_mattiato

    02/07/2023, 1:09 PM
    Hello, what is the best way to approach this, since i've been using the timestamp data type and supabase warns me in the editor to change to timestampz, but offers me two options for the default value. Does anyone have a straightforward explanation on what is the correct way to approach this or even maybe a code snippet for the default value? Thanks in advance
    a
    s
    • 3
    • 3
  • Is there any plan to update the `auth-helpers-sveltekit` examples?
    m

    mrmikardo

    02/07/2023, 1:15 PM
    It looks like the SvelteKit examples are out-of-date. I can't see any relevant issues to update them in the repo: https://github.com/supabase/auth-helpers/issues/
    s
    • 2
    • 2
  • Create folder in Storage when row is inserted in DB Table
    l

    Lukas.lwz

    02/07/2023, 1:43 PM
    Is there any way to create a folder in supabase storage through a sql query + naming that folder?
    a
    g
    • 3
    • 4
  • Hosting Strapi on Supabase?
    d

    Daemon

    02/07/2023, 2:02 PM
    I believe there used to be an article on how to do this but it's since been removed? Does anybody know if this is still supported?
    s
    • 2
    • 3
  • What to do after Spotify Oauth redirects back with access token?
    j

    j0risnl

    02/07/2023, 2:11 PM
    UPDATE: solved, see comment Hi, I need to let users authorize my app to use Spotify's user-read-private user-read-email scopes. I have set up OAuth using this guide https://supabase.com/docs/guides/auth/social-login/auth-spotify. I can authorize successfully up to the point where it redirects me to the site url specified in https://app.supabase.com/project/[PROJECT_ID]/auth/url-configuration with the access_token as an url parameter. However, when I try to use that access token to request this endpoint, it returns "error": { "status": 401, "message": "Invalid access token" } I'm lost with what may be wrong, has anyone else succesfully set up Spotify oauth or know what may be wrong? For what it is worth, the access_token provided in the url and the access_token supplied when doing "get token" through spotify console look quite different (769 characters versus 188) but I don't know if this is expected...
    • 1
    • 1
  • Accept or reject depending on where the request comes from.
    d

    DisamDev

    02/07/2023, 2:47 PM
    I have a question, on my website I have an account system and each user has their own things, and through the policies I make them only able to read, delete, update if they are verified and their auth.uid() is equal to another column in the table. But I have a Discord bot and I would like it to connect to the database and look in a request to read if there is a row that has a specific value in a column, but the bot cannot verify itself as on the web to access. Is there a way that the bot can access the database with some authorization other than web verification? And it can only be done with web verification and that authorization I'm talking about. That exist?
    s
    a
    • 3
    • 8
  • Paying for some supabase guidance
    s

    silentworks

    02/07/2023, 3:03 PM
    This is better posted in the #907558989963853826 channel as you aren't asking a specific help question to do with supabase here.
    j
    • 2
    • 2
  • Supabase codebase repo taking so much time to clone
    o

    oyinkan

    02/07/2023, 3:18 PM
    Hey @everyone, I'm currently cloning the Supabase repo and it currently has been on for 3 hrs and it's still at 14%. Is there a better way to clone the repo or this is how it ought to be? Thank you very much for taking out time to help.
    a
    • 2
    • 4
  • Ban a user with GoTrue?
    d

    drewbie

    02/07/2023, 4:12 PM
    Im trying to find a way to ban a user from being able to sign in, and/or change their role from authenticated to something else (eg suspended). I do see a
    ban_duration
    in the GoTrue types under
    AdminUserAttributes
    but I cant seem to find a way to set it. I ultimately want to find a way to be able to suspend bad actors and have it apply to all of my RLS policies that apply to the autheticated user role. Either being able to update their auth role, or set the ban duration seemed to be the best start, but I'm not finding in the docs a way to be able to do either. Any help is appreciated. Thanks
    d
    n
    • 3
    • 15
1...122123124...230Latest