https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • DELETE rest request with pgsql-http extension
    b

    Bruno Nogueira

    10/25/2022, 1:37 AM
    Hi everyone. I'm trying to make a DELETE request with the pgsql-http extension, and keep getting a error, as if the extension was from a early build, wich doesnt implements the DELETE method.
    Copy code
    http(('DELETE', ...
    Gives the "illegal HTTP method" error.
    Copy code
    http_delete('https://...
    Gives the "function http_delete(unknown, unknown, json) does not exist" error. Is that anyone facing the same issue?
    g
    c
    j
    • 4
    • 15
  • postgres user does not have privilage to set role supabase_admin
    a

    a99111cc042b477e9f22eafe7

    10/25/2022, 7:24 AM
    I am trying to edit table which was created with supabase_admin. This is not possible for me because I am sign in as postgres user. Changing role does not work either (permission denied to set role supabase_admin). How do you manage your database from outside of supabase web app ?
    n
    g
    g
    • 4
    • 17
  • file upload
    d

    Dies.Irae

    10/25/2022, 8:07 AM
    Keep getting this error
    'new row violates row-level security policy for table "objects"'
    on image upload, even though I've set up the policies on the image bucket
    g
    • 2
    • 5
  • Generating TypeScript types for remote database
    j

    janosch.hrm

    10/25/2022, 8:15 AM
    I want to generate types for the cloud database tables I have hosted with Supabase. In the docs, I saw this script:
    Copy code
    supabase start
    supabase gen types typescript --local > lib/database.types.ts
    The question is: How do I get this to use the types for tables in my remote database? When I ran the commands as seen above, it generated types for a new local database. I haven't found a way to specificy which db I want to generate the types for in the Supabase docs.
    o
    • 2
    • 3
  • foreign key select query question
    d

    draco

    10/25/2022, 8:44 AM
    Example schema
    Copy code
    People
    id: 1, name: Steve , age: 43
    id: 2, name: Janet, age:25
    
    Interests 
    id: 1, category: hiking, people: [1,2]
    So given this kind of structure, I am trying to figure out how to do a select from interests, but have the return data include the full information of each person in the list of people id instead of just the id themselves.. I know that you can use a join to accomplish this, but have had no success when trying to build a sql query using the dashboard or using the js library. It’s clearly user error on my part as I am still learning how to structure queries so any pointers would help. I am trying to avoid the alternative of making multiple calls for each person id after I select the interest row since that seems inefficient.
    g
    • 2
    • 5
  • redux-next-wrapper with supabase v2 ssr
    d

    Daddymilker4000

    10/25/2022, 9:12 AM
    Before supabase V2 I got my data and stored in with redux like this: supabase V2 broke unfortunately some functionality with redux-next-wrapper `export const getServerSideProps = wrapper.getServerSideProps( (store) => async ({ req }) => { const { user } = await supabase.auth.api.getUserByCookie(req); if (user === null) { return { redirect: { permanent: false, destination: "/auth", }, props: {}, }; } if (user) { async function getData() { let { data, error, status } = await supabase .from("table") .select(
    id
    ) .eq("id", user.id); store.dispatch(writeUserData(data)); return data; } return { props: { data: await getData(), }, }; } } ); ` Any ideas how I can achieve the same functionality with withPageAuth()?
    Copy code
    export const getServerSideProps = withPageAuth({
      redirectTo: '/foo',
      async getServerSideProps (ctx, supabase) {
        // Access the user object
        const {
          data: { user }
        } = await supabase.auth.getUser()
    
        return { props: { id: user?.id } }
      }
    })
    o
    s
    • 3
    • 6
  • Direct connection to DB unable to backup
    a

    a99111cc042b477e9f22eafe7

    10/25/2022, 9:13 AM
    Hi there, I just want to ask community if you are able to backup your database without having paid version. I connected to db with pgadmin but when trying to reach backup I am unable to backup the table. Please let me know if the issue is on my side or on the free version it is not possible. Thank you.
    n
    • 2
    • 3
  • analytics projet
    f

    flapili (FR, bad EN)

    10/25/2022, 10:31 AM
    Hi, we want to build an analytics for our customers (I'm working at Ugo.co) and I would like to know what is the best way to check the health of a website ?
    • 1
    • 3
  • How do I check if any element of user input array exists in a column which is an array itself?
    a

    Amr

    10/25/2022, 11:44 AM
    A user send an array like this
    [1, 2]
    There's an existing row that has
    [1, 5]
    I want to check if
    1
    exist in
    [1, 5]
    I tried this code:
    Copy code
    js
    await supabase.from('reservations')
            .select()
            .eq('departureTripId', departureTripId)
            .containedBy('departureSeats', departureSeats);
    But it doesn't return anything resulting in allowing for duplicate seats!
    g
    • 2
    • 3
  • I can't find `signInWithPasswordless` !!
    a

    Amr

    10/25/2022, 12:02 PM
    VSCode says:
    Property 'signInWithPasswordless' does not exist on type 'SupabaseAuthClient'. Did you mean 'signInWithPassword'?
    I've updated to
    "@supabase/supabase-js": "^2.0.4"
    j
    g
    • 3
    • 6
  • I'm having CORS issues when upgrading functions to use Supabase v2.0.0
    c

    cdedreuille

    10/25/2022, 12:12 PM
    Since Supabase JS is now available in v2 I'm trying to modify my edge function to use this new version but I'm having CORS issues when I remove
    JSON.stringify()
    from the body when invoking the function. Invoke before
    Copy code
    await supabaseClient.functions.invoke("media-upload", {
      body: JSON.stringify({
        path: fileName,
      }),
    });
    Invoke after
    Copy code
    await supabaseClient.functions.invoke("media-upload", {
      body: {
        path: fileName,
      },
    });
    In my function:
    Copy code
    const corsHeaders = {
      "Access-Control-Allow-Origin": "*",
      "Access-Control-Allow-Headers": "authorization, x-client-info, apikey",
    };
    
    serve(async (req) => {
      if (req.method === "OPTIONS") {
        return new Response("ok", { headers: corsHeaders });
      }
    
      try {
        ...
      } catch (error) {
        ...
      }
    });
    Any idea why if I remove
    JSON.stringify()
    I get a CORS error? It seems that now we have to remove it with v2.
  • Subscribe to specific row
    m

    MDobs

    10/25/2022, 12:13 PM
    I'm trying to subscribe to changes on table
    game_rooms
    where the row has a column named
    nickname
    with a value of
    x
    Copy code
    const gameRooms = supabase
            .from(`game_rooms:nickname=eq.${gameRoomNickname}`)
            .on("*", (payload) => {
                console.log("Change received!", payload)
            })
            .subscribe()
    this throws an error though, although it follows the example from the API page. What seems to be wrong with it?
    g
    • 2
    • 1
  • Postgres triggers
    f

    FunHellion

    10/25/2022, 12:19 PM
    Hi there, I've been creating some triggers in order for the app_meta_data in my JWT to update. Problem is, it only seems to actually trigger when I make changes in the Supabase UI itself and not from my front-end.
    Copy code
    sql
    create trigger role_permissions_update_user_claims after delete or insert on role_permissions
    for each row execute
      procedure update_claims_role_permissions_update(role)
    Could the reason be that I am still using
    supabase.js v1
    or might there be another reason for this. I'll gladly provide more information if needed. Thanks in advance, Bram
    g
    • 2
    • 7
  • nuxt-img and Supabase
    m

    Marcus Arnfast

    10/25/2022, 1:27 PM
    Have anyone successfully setup nuxt-img with supabase - as a custom provider?
    o
    • 2
    • 2
  • FATAL 42501 (insufficient_privilege) permission denied to set parameter pg_stat_statements.track
    i

    itisnajim

    10/25/2022, 1:51 PM
    after a time of running a self-hosted Supabase (docker) i got the error:
    Copy code
    [error] Postgrex.Protocol (#PID<0.235.0>) failed to connect: ** (Postgrex.Error) FATAL 42501 (insufficient_privilege) permission denied to set parameter "pg_stat_statements.track"
    any idea of how to resolve ?
    • 1
    • 1
  • query has no destination for result data
    f

    flapili (FR, bad EN)

    10/25/2022, 3:17 PM
    hi, how to avoid the trash var in this code ?
    Copy code
    sql
    drop function if exists tempo(text);
    
    create
    or replace function tempo(url text) returns integer language plpgsql as $$
    declare
        res_status integer;
        trash int;
    begin
      SELECT 1 into trash FROM http_set_curlopt('CURLOPT_TIMEOUT_MS', '10000');
      SELECT 1 into trash FROM http_set_curlopt('CURLOPT_CONNECTTIMEOUT', '10000');
      SELECT status INTO res_status FROM http_get('http://google.fr');
      RETURN res_status;
    end;
    $$;
  • GET with two parameters
    m

    MaGnezij

    10/25/2022, 3:18 PM
    Hi, i want to retrieve only the last record from the table. I know I need to use the order() function and the limit. I just don't know how to put together a CURL with two parameters. So i need them to be sorted by rec_id column. Thanks! Lets say i have this table and i want to get the last record, that is with the highest rec_id
    i
    • 2
    • 2
  • Problem handling magic link sign in
    p

    patrick

    10/25/2022, 3:30 PM
    Hi, I'm trying to set up magic link login in my NextJS app. I'm using supabaseClient.auth.signInWithOtp, but when I click the magic link inside the email, I get rerouted to http://localhost:3000/#access_token="ACCESS_TOKEN"&token_type=bearer&type=magiclink, however I'm not sure how I should handle the access token on my side. I'm making use of @supabase/auth-helpers-nextjs and the withPageAuth wrapper, so trying to protect pages using that, I'm wondering if I need to pass the token somewhere in there to store it, or how can I persist the session in this way?
    o
    j
    • 3
    • 5
  • pg_net is overwhelming our database
    l

    libovness

    10/25/2022, 4:09 PM
    We're getting DDOS'd right now, resulting in tons of requests coming from userAgent pg_net, an extension used by Supabase. Our database is now being overwhelmed from within Supabase. Any advice? We're trying as hard as we can to get in touch with Supabase (we're on the Pro tier).
    g
    g
    s
    • 4
    • 4
  • mapping from supabase-js to REST
    c

    config_wizard

    10/25/2022, 4:15 PM
    Is there anywhere that documents the RESTful equivalents of the js capabilities? I can attempt to guess but I'm sometimes not sure if its just a case of the API not being able to handle certain filters or I'm just getting the formatwrong
    j
    • 2
    • 2
  • Cant get user from getUser() through async function
    d

    Devr

    10/25/2022, 4:41 PM
    Hi there, Basically I have a issue where am not getting the data object returned from users() fxn , it returns Promise{} (Sorry but I dont have much understanding about Promises,etc)
    j
    n
    i
    • 4
    • 43
  • Is the Project ID sensitive, can it be safely stored in git?
    b

    brassotron

    10/25/2022, 4:43 PM
    I intend to use the Project ID to generate typescript database types as described in the documentation here: https://supabase.com/docs/reference/javascript/typescript-support Is the Project ID itself sensitive and is it safe to store in Git?
    j
    • 2
    • 1
  • Using auth-helpers and auth-ui with Zustand
    p

    patrick

    10/25/2022, 4:55 PM
    Hi, I'm trying to set up auth in my app, but because I have some complex global state management inside the app, I would like to use Zustand instead of the Context API. Has anyone done this? It's unfortunate how dependent both packages are on Context, and it's tricky to manage auth without the helpers otherwise.
    o
    • 2
    • 4
  • How is supabase pricing realtime?
    v

    VWL Tobias Hassebrock

    10/25/2022, 5:02 PM
    Is there a page explaining the pricing structure? Do I have to pay for open connections, calls or transferred data?
    d
    • 2
    • 1
  • Using import maps in Deno Edge Functions
    e

    eo me

    10/25/2022, 7:05 PM
    Deno has https://deno.land/manual@v1.26.2/linking_to_external_code/import_maps#import-maps feature which would allow us to import code that has internal absolute imports and that imports its own libraries through standard imports.
    o
    z
    • 3
    • 16
  • Connection Pooling & Prisma
    p

    perry

    10/25/2022, 7:21 PM
    Hi! I’m trying to understand what’s necessary when it comes to connection pooling. I have a project that uses Supabase DB and connection pooling is enabled, but I’m not sure if I could (or should) utilize Prisma Data Proxy in addition. Any thoughts on this?
    n
    • 2
    • 2
  • is .eq() chainable for database queries? How to send multiple conditions?
    u

    Unknown Member

    10/25/2022, 8:20 PM
    ....select().eq('name': "Awesome name").eq('fave_colour': "blue")
    j
    • 2
    • 1
  • Deploy to Netlify, console JS error “supabaseUrl is required”—although Supabase still works.
    s

    Smardrengr

    10/25/2022, 8:41 PM
    Trying to deploy SvelteKit apps to Netlify... I've added environments variables for
    SUPABASE_URL
    and
    SUPABASE_ANON_KEY
    .
    s
    j
    • 3
    • 6
  • Auth Provider Opens Website Not App
    c

    caseycrogers

    10/25/2022, 9:07 PM
    I'm using Flutter and testing on Android. I've set up Google, Twitter and Facebook provider sign in. On all three, when I call
    signInWithProvider
    , it navigates to a website instead of the app. Is there a way to get Supabase to open the app instead? No one is ever signed in on the website so if they have to sign in to their Google/Twitter/FB account then half the point of using a sign in provider is kind of defeated...
    o
    • 2
    • 3
  • Can't connect to the DB from a Next.js+Prisma app (Win)
    b

    balabanshik

    10/25/2022, 10:51 PM
    I'm trying to run a Next.js app with a Supabase DB accessed using Prisma. Other devs can connect, I can't. I think I'm the only one on WIndows, though. The exact output is
    Copy code
    Datasource "db": PostgreSQL database "postgres", schema "public" at "db.jbpbrlnjcocobepnwhst.supabase.co:5432"
    
    Error: P1001: Can't reach database server at `db.jbpbrlnjcocobepnwhst.supabase.co`:`5432`
    (This is a new blank DB spun up specifically to test my connection, so not masking it) Other data points: 1. I can go and see out DBs in the web UI 2. The app connects to a local Postgres just fine 3. Pinging the url times out 4. Trying with different DBs doesn't change the result 5. None of the usual fidgeting approaches (change Node version, restart, full reclone/rebuild etc) help either
    s
    n
    t
    • 4
    • 7
1...535455...230Latest