https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Auto insert rows after adding a new csv file in the storage bucket
    a

    anindosarker

    02/12/2023, 10:23 AM
    I'm creating an application where admins will be able to upload csv files. I wanted to use storage bucket and then upload the files there. After the file is uploaded, a trigger function will be called and every line from the file will be added to a specific column in a table in my database. I can't do it. help
  • Getting header by key for PGSQL Http Response
    b

    brassotron

    02/12/2023, 11:10 AM
    Hello, I'm following the example given here for sending emails with the http extension via MailerSend here: https://github.com/burggraf/supabase-mailer/blob/main/02E_send_email_mailersend.sql The response returned into
    retval
    contains headers as type
    http_header[]
    which is a tuple as described by the documentation https://github.com/pramsey/pgsql-http: > The headers field for requests and response is a PostgreSQL array of type http_header which is just a simple tuple. The MailerSend API request to send an email returns an empty response with a 202 status and a response header with key
    x-message-id
    containing a uuid of the message in MailerSend's API. I need to get this from the headers stored in retval, but I can't seem to figure out how without getting type interchangeability errors?
    Copy code
    sql
    
    -- this is executed by a trigger after insert on public.emails
    
    select into retval * from http(...);
    
    update public.emails set message_id = ... where id = new.id;
    I'm trying to effectively get the value of
    retval->'headers'->>['x-message-id']
    . Thanks for any help!
  • Is it possible to make RLS policy to have uneditable fields?
    s

    Shelby

    02/12/2023, 11:37 AM
    Basically, I have a project similar to Reddit and the is_approved field is in the same table, I don't want people to spam stuff and send a api request and change it to is_approved: true so Is there a way I can set a policy where users can update all fields except is_approved field Thanks big help.
    g
    • 2
    • 7
  • Is this a good use case for database functions?
    j

    jfbn

    02/12/2023, 1:32 PM
    Users on my client are submitting match results for a tennis game they have played. They only enter the names of the 2 players of each team (4 players in total), the score of each team, and where they played the match. To store this data in a normalized matter, I have 5 different tables that each needs some part of this data. Since the client only provides the before mentioned data, I don't have the necessary details at hand to do all the table inserts without first having to look up the users id's etc. etc. I would prefer to not chain a bunch of API calls from the FE (ie. retrieve each players ID by their username, finding the id of the play location by the play locations name etc), but instead just make 1 request with the data submitted by the user, and then have the BE chain these requests. Is this an appropriate case of RPC? Can I make one stored function (procedure?) invoke another one? I suspect I would use triggers for most of these -- but ideally I can forward along data between the functions, instead of having to do similar lookups in multiple of the functions. for context, my db schema in next comment: I need to make inserts into matches, match_results, player_matches, and finally player_elo_history. A problem I am foreseeing: The insert into the matches table would be the first action to perform. Setting up a trigger to perform the "next step" as a reaction to the insert in the matches table seems insufficient, as the new row in the matches table does not contain the information that the next table insert requires.
    g
    • 2
    • 7
  • Python edge functions
    j

    Jeremy Deceuster

    02/12/2023, 1:33 PM
    Are python edge functions on the roadmap?
    g
    s
    • 3
    • 2
  • How do I open a port for my local Supabase instance to send POST requests?
    o

    oth.bio

    02/12/2023, 1:37 PM
    Hello! I have an after trigger on row insertion that should generate one of the row's fields. Ideally, the trigger is run asynchronously, requests an HTTP POST endpoint hosted locally, and modifies that row. But when I use http_post, it tells me that the connection is refused. I am guessing it comes from the docker-compose rules which I should modify to open the specific port I am using locally. But I can't find information on customizing the docker container started by supabase start anywhere. I found a
    supabase eject
    function online, but it was apparently scrapped. How can I proceed? Thanks!
  • Multiple Environment Best Practices
    u

    水瓶座ーcindrmon

    02/12/2023, 1:42 PM
    Hi! I would like to ask about best practices in terms of setting up a fullstack, monolithic Nuxt 3 project with Supabase into multiple environments, particularly a dev environment, staging environment, and production environment. how do i set all of it up together? i just need guidance on setting up supabase with multiple environments in a fullstack codebase.
    o
    • 2
    • 6
  • AND operator and related (nested) tables queries
    e

    edgaras

    02/12/2023, 2:17 PM
    Copy code
    js
        const { data, error } = await supabaseAdmin
            .from('jobs')
            .select(`*,
                job_filters!jobs_job_filters(*)
               `)
            .eq('job_filters.slug', 'freelance')
            .eq('job_status', 'LIVE')
    This is what I am trying to achieve but seem like the
    .eq('job_filters.slug', 'freelance')
    part doesn't' work. Any ideas?
    g
    • 2
    • 40
  • How do real-time events consume database size?
    e

    Erdi

    02/12/2023, 2:37 PM
    I spent 80MB of 500MB free tier database space but I only used realtime actions. Never persisted any data. How actually realtime events consume database size?
    g
    • 2
    • 2
  • API Calls within Database
    r

    rwbcards

    02/12/2023, 3:08 PM
    Hi Everyone, I am brand new to Supabase and I was wondering if I could make an API call within a database. I have a list of Products with ProductIDs and the Price of each Product changes by the minute/hour/day. I was wondering if I could keep the Products and ProductIDs static but call an API endpoint to get the most recent price. If this is a thing I would love to know how to implement that! Thanks so much!
    g
    • 2
    • 1
  • fetching text pre-formatted
    d

    DevilsBlade0

    02/12/2023, 3:34 PM
    Hey guys, I’m fetching a description paragraph from db, but it comes in bulk and I can’t seem to format it on front end, as I’m adding line breaks, making a bit of it bold? Can anyone advise a work around? Thank you. Screenshots attached.
    s
    • 2
    • 2
  • generate magiclink and send manually
    a

    ak4zh

    02/12/2023, 4:23 PM
    Is it possible to generate magic link via code and send via modes other than email?
    g
    • 2
    • 1
  • “sb-access-token” has been rejected because it is already expired
    k

    kugi

    02/12/2023, 4:49 PM
    im getting this error with Nuxt3 supabase module and wondering how i can work around it
    n
    g
    k
    • 4
    • 26
  • Precompiled dependency + functions
    s

    subvertallchris

    02/12/2023, 4:54 PM
    Hi! I’ma exploring a project built with Supabase that needs to call a precompiled binary from a function. In Lambda, I’m providing the dependency using a layer. What’s the equivalent with a Supabase Function? I could probably host it in my Storgae bucket and download on every invocation but this seems clunky. Excited to get going with this! Supabase looks fantastic and if this works out, it’ll simplify my project and life tremendously.
    g
    • 2
    • 3
  • Insert event not firing when RLS is enabled on the table
    k

    kaze

    02/12/2023, 5:03 PM
    I'm following this documentation here https://supabase.com/docs/reference/javascript/subscribe but I'm not receiving any insert events, when I turned off the RLS I'm getting the events, is there any to make it work without turning off the RLS?
    g
    • 2
    • 53
  • How to make a user BYPASSRLS for all queries (admin dashboard)
    s

    Shelby

    02/12/2023, 6:51 PM
    How do I make every request received from this user to bypass all RLS policies
    g
    • 2
    • 4
  • How to import a prod database into local
    s

    Sarcodo

    02/12/2023, 7:33 PM
    I currently have a prod database which has a bunch of data tables etc and I wanted to import that locally so that I can, going forward, make changes to the local db to test everything works before making those changes to the prod one. I have been following https://supabase.com/docs/guides/cli/local-development and gotten past
    npx supabase start
    so I can see my container running and can access a local DB however that local DB doesn't have any tables which I wanted to get from my prod db.
    s
    • 2
    • 2
  • Can't access host.docker.internal
    o

    oth.bio

    02/12/2023, 7:44 PM
    Hello! I am not able to make http requests to localhost when developing locally. My Supabase Function uses http_post but can't connect to localhost, even if I use host.docker.internal. Is there a way to use localhost in plpgsql functions?
  • supabase db remote commit does not apply remote changes to new project
    s

    stefanVDW

    02/12/2023, 8:43 PM
    Hi! When running the
    supabase db remote commit
    command in a project which I just initialised (it was an existing project but I deleted the supabase folder and ran everything agains starting from
    supabase init
    ), I expect the 7 remote changes to be applied to my local development environment. Instead I get the following error:
    Copy code
    Error: The remote database's migration history is not in sync with the contents of supabase/migrations. Resolve this by:
    - Updating the project from version control to get the latest supabase/migrations,
    - Pushing unapplied migrations with supabase db push,
    - Or failing that, manually editing supabase_migrations.schema_migrations table with supabase migration repair.
    I was under te impression that when you have an empty /migrations folder (or no migrations folder), the remote migrations will be applied.
    Running the supabase migration list command shows the expected migrations:
    Copy code
    LOCAL │     REMOTE     │     TIME (UTC)
      ────────┼────────────────┼──────────────────────
              │ 20221015154708 │ 2022-10-15 15:47:08
              │ 20221018164830 │ 2022-10-18 16:48:30
              │ 20230105123901 │ 2023-01-05 12:39:01
              │ 20230105125254 │ 2023-01-05 12:52:54
              │ 20230107120832 │ 2023-01-07 12:08:32
              │ 20230107124039 │ 2023-01-07 12:40:39
              │ 20230211161612 │ 2023-02-11 16:16:12
    Is there an extra step needed in order to get my (empty) local development environment back in sync with my remote one? I tried the suggested commands in the error message but no luck so far. Thanks!
    s
    t
    • 3
    • 4
  • Is there something wrong with the server?
    a

    AlanK

    02/12/2023, 9:26 PM
    I have two free tier projects - I am getting "Something went wrong" error messages on both and my tables are not showing.
    • 1
    • 1
  • Is there a way to write more efficient queries in Supabase?
    m

    mohnish

    02/12/2023, 9:59 PM
    I'm on the pro plan with XL tier add-on. Our queries still give us a 400 error timeout every single time we query data. We're trying to do pagination and sending query requests in batches of just 10 rows... but it still gives us a timeout error. We're strictly specifying the number of columns (10-15) but that still gives us an error. My logs dont tell me anything about why the query failed. This keeps happening every single time. What am I doing wrong? Is there a better way to write queries so that it doesn't fail? I doubt that more compute power is the only answer...
    s
    g
    • 3
    • 3
  • Can't Deploy Edge Function
    i

    ICAZ117

    02/12/2023, 10:53 PM
    Hey yall! I'm quite new to supabase, and am currently in the process of following the supabase tutorial (https://supabase.com/docs/guides/functions/examples/stripe-webhooks) to integrate Stripe into a Supabase edge function. I'm at the point where I'm ready to deploy the edge function, but I'm getting the following error, and can't seem to find anything online for it.
    Copy code
    js
    Error: Error bundling function: exit status 1
    file:///src/import_map.json
    file:///src/index.ts
    error: Uncaught (in promise) Error: NotFound: The system cannot find the path specified. (os error 3)
          const ret = new Error(getStringFromWasm0(arg0, arg1));
                      ^
        at __wbg_new_8d2af00bc1e329ee (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:312:19)
        at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:79439)
        at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:1388039)
        at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:1862894)
        at __wbg_adapter_18 (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:146:6)
        at real (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:130:14)
  • auth.getSession is not a function
    h

    Hypersigils

    02/12/2023, 11:02 PM
    I'm running getSession() at the beginning of page load. However, my console logs an error:
    Uncaught (in promise) TypeError: supabase.auth.getSession is not a function
    This is after pulling a project from github that worked on another machine. Here's a screenshot of the supabase.auth object I'm calling
    getSession()
    on:

    https://i.imgur.com/m2z2fkC.png▾

    Here are my dependencies:
    Copy code
    "dependencies": {
        "@mdi/font": "5.9.55",
        "@supabase/supabase-js": "^2.7.1",
        "pinia": "^2.0.30",
        "roboto-fontface": "*",
        "vue": "^3.2.45",
        "vue-router": "4",
        "vue-supabase": "^2.3.0",
        "vuetify": "^3.0.0-beta.0",
        "webfontloader": "^1.0.0"
      },
    Here's my import.
    Copy code
    import { createClient } from '@supabase/supabase-js'
    
    const supabase = createClient(
      "-------------------------",
      "-------------------------"
    );
    
    export default supabase;
    Thank you in advance!
    g
    • 2
    • 7
  • did they bring json back to the dashboard?
    d

    Domcario

    02/13/2023, 12:33 AM
    it was missing as of earlier this week right? thought we only had
    jsonb
    available from the dashboard
    g
    • 2
    • 1
  • Supabase remote commit does not create triggers, is this normal ?
    t

    Trixrabbit

    02/13/2023, 12:39 AM
    I'm updating upgrading my workflow and started using a local instance of supabase for development. Following the documentation (https://supabase.com/docs/guides/cli/local-development) , I got everything setup properly and by running
    supabase db remote commit
    my initial migration script was automatically generated. After I started supabase with
    supabase start
    everything was created except my triggers. Is this normal ? (the trigger function was created, but not the trigger itself)
    g
    s
    • 3
    • 14
  • Sign up emails being marked as spam
    s

    sinrabo

    02/13/2023, 2:16 AM
    I installed MailerSend as Custom SMTP but email still in spam box? How can I fix this issue?
    s
    a
    • 3
    • 7
  • Can't Deploy Edge Functions
    i

    ICAZ117

    02/13/2023, 3:13 AM
    Hey yall! I'm quite new to supabase, and am currently in the process of following the supabase tutorial (https://supabase.com/docs/guides/functions/examples/stripe-webhooks) to integrate Stripe into a Supabase edge function. I'm at the point where I'm ready to deploy the edge function, but I'm getting the following error, and can't seem to find anything online for it.
    Copy code
    js
    Error: Error bundling function: exit status 1
    file:///src/import_map.json
    file:///src/index.ts
    error: Uncaught (in promise) Error: NotFound: The system cannot find the path specified. (os error 3)
          const ret = new Error(getStringFromWasm0(arg0, arg1));
                      ^
        at __wbg_new_8d2af00bc1e329ee (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:312:19)
        at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:79439)
        at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:1388039)
        at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:1862894)
        at __wbg_adapter_18 (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:146:6)
        at real (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:130:14)
    • 1
    • 1
  • Slow query results:
    d

    dav

    02/13/2023, 3:52 AM
    How long should I expect a query like this to take:
    Copy code
    select id from table
    where property1 >= 5
    and property2 = 'arbitrary string'
    and property3_date <= <ARBITRARY DATE>
    limit 30000
    There are 1,000,000 rows in my DB. This query returns 26,000 rows. I have indices on property1, property2 and property3 Currently, it takes up to 90 seconds sometimes (median latency is ~30 seconds). I pay for the small add-on (2 GB memory)
    • 1
    • 2
  • How to remove login by Email, in Supabase Auth UI component?
    h

    hiroshi nishio

    02/13/2023, 5:10 AM
    We only want to log in via the Slack provider.
    r
    • 2
    • 4
  • Struggling with setting up Auth MagicLink with Next.js from the last 4 days.
    s

    sam12

    02/13/2023, 7:20 AM
    Apparently whatever docs or videos I refer to are using the previous v1 of supabase and when I use them it results in an error. There doesn't seem to be a good resource available for the new v2. Guide me to a resource so I can make this sh*t happen for my app.
    s
    • 2
    • 3
1...129130131...230Latest