https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • failed to update pg.tables with the given ID: must be owner of table
    b

    bry

    02/13/2023, 7:43 PM
    I would like to edit tables from the dashboard. So on the supabase dashboard, I can create tables just fine, but as soon as I want to edit one of the tables I am met with the error in title. Okay cool, so I have to change some permissions. After some looking online I go to the SQL Editor and run
    GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO postgres;
    . I go to add a row to a table, same error. I then try
    GRANT supabase_admin TO postgres;
    , but I can't do that either. I am bashing my head into my keyboard since this problem is so simple yet am finding nothing online about it that works. Any help appreciated
    g
    • 2
    • 14
  • Unable to upload files to bucket.
    a

    ali

    02/13/2023, 7:53 PM
    I am unable to upload files to my storage bucket via the supabase dashboard or via the API. The files I am uploading are large (500MB). The upload indicator never seems to update. I have reviewed my storage settings and my files are below my set limit. Also the attached screenshot of my storage policies. Random Note: Notice how when i check my storage usage the used storage amount is "NaN undefined". Has my storage bucket been corrupted for some reason?
    g
    b
    • 3
    • 17
  • How to get the username from the provider
    h

    Hugos

    02/13/2023, 8:00 PM
    Meant to send this screenshot of oAuth and not signup
    • 1
    • 1
  • Please Help - 4th Time Posting This - Can't Deploy Edge Function
    i

    ICAZ117

    02/13/2023, 8:05 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.
    j
    g
    • 3
    • 7
  • duplicate key value error
    n

    nimo

    02/13/2023, 8:07 PM
    Copy code
    error - Error: {"code":"23505","details":null,"hint":null,"message":"duplicate key value violates unique constraint \"transcript_pkey\""}
    Hey all -- getting the above error when I run an insert as follows:
    Copy code
    const { data, error } = await supabase
        .from('transcript')
        .insert({ transcript: transcript.trim(), project_id })
        .select('*')
        .single();
    I'm not sure what's going on, as the transcript ID is a sequential number (should be auto-computed right?). Below are the SQL queries used to create the table.
    Copy code
    CREATE TABLE "public"."transcript" (
        "id" bigint NOT NULL,
        "created_at" timestamp with time zone DEFAULT "now"(),
        "transcript" "text",
        "project_id" "uuid",
        "cleaning_status" "public"."transcript_cleaning_status" DEFAULT 'started'::"public"."transcript_cleaning_status"
    );
    
    
    ALTER TABLE "public"."transcript" OWNER TO "postgres";
    
    --
    -- Name: transcript_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
    --
    
    ALTER TABLE "public"."transcript" ALTER COLUMN "id" ADD GENERATED BY DEFAULT AS IDENTITY (
        SEQUENCE NAME "public"."transcript_id_seq"
        START WITH 1
        INCREMENT BY 1
        NO MINVALUE
        NO MAXVALUE
        CACHE 1
    );
    p
    d
    • 3
    • 6
  • Include database information in webhook
    e

    elliott

    02/13/2023, 9:34 PM
    Is it possible to draw information from the supabase database as part of the body request posted by an http webhook? I am specifically trying to send a post request to firebase from supabase to trigger push notifications, so I need to include a payload from supabase that includes the right user id to notify. I'm not sure how to get this variable into the webhook with supabase's interface, and I have not found any helpful documentation here.
    o
    • 2
    • 2
  • Update trigger
    v

    VuFFeR

    02/13/2023, 11:03 PM
    Hi guys! I'm having trouble updating the avatar_url of my members table. I've created a trigger, that should fire whenever
    Copy code
    await supabase.auth.updateUser({ 
                    password: password.getValue(),
                    data: {
                        avatar_url: avatar.src,
                    }
    }):
    is called. Here the trigger is:
    Copy code
    begin
    update public.members set avatar_url = NEW.raw_user_meta_data->>'avatar_url'
        where m.id = NEW.id;
    end
    Is it a syntax error?
    g
    • 2
    • 8
  • Edit auth email templates through CLI
    c

    cdbattags

    02/13/2023, 11:25 PM
    Is there any method to edit email templates through a CLI of some sort?
    • 1
    • 1
  • Possible to dynamically subscribe to more rows?
    d

    DanMossa

    02/14/2023, 12:35 AM
    Hello! I have two tables, one named rooms that contains a room id and user id. I have another table named message, this contains the room id, the user id of the person who sent the message, and the message body. I want to listen to all messages that have room id equal to any to roomid that the user is in. The issue is that if a new room is created, I won't be listening to it's message since that won't be part of the roomids I'm subscribed to. 1. Is it possible to filter a realtime query with a check for Any in? 2. Is it possible to dynamically update this list? Or do I need to unsubscribe first and then resubscribe? Are there any better ideas lol
    g
    • 2
    • 10
  • Struggling to setup Supabase with Prisma.
    e

    Emmett

    02/14/2023, 12:41 AM
    I am unsure about how to set up this step. https://supabase.com/docs/guides/integrations/prisma#configuring-the-project-to-use-postgresql I believe thats the last thing I need to do. I am rebuilding an old app and wanted to use a more fun tech stack.
    g
    • 2
    • 3
  • jsonb - Querying anything other than str | int "eq"
    r

    rajamaka

    02/14/2023, 1:00 AM
    Not entirely sure if this might be a supabase-py issue, postgrest issue or (more likely) a me issue. Running
    Copy code
    cls.table.select("data").eq("data->>email", "foobsar.com").execute().data
    Returns successfully:
    Copy code
    [{'data': {'email': 'foobsar.com', 'skills': ['Java', 'Python', 'JavaScriptd'], 'address': {'city': 'San Francisco', 'state': 'CA', 'street': '1 Main St', 'zip_code': '94102'}, 'hire_date': '2022-01-01', 'is_active': True, 'last_name': 'Doe', 'department': 'IT', 'first_name': 'John', 'employee_id': 999}}, {'data': {'email': 'foobsar.com', 'skills': ['Java', 'Python', 'JavaScript', 13], 'address': {'city': 'San Francisco', 'state': 'CA', 'street': '1 Main St', 'zip_code': '94102'}, 'hire_date': '2022-01-01', 'is_active': True, 'last_name': 'Doe', 'department': 'IT', 'first_name': 'John', 'employee_id': '12345'}}]
    However following up with a query to check a bool value
    Copy code
    cls.table.select("data").eq("data->>is_active", True).execute().data
    Having the same issue with weird behaviour for gte / lte queries.. 😦
    g
    • 2
    • 3
  • SvelteKit - Empty Session on OAuth Redirect
    l

    lost12487

    02/14/2023, 1:19 AM
    Just trying to get auth set up and working in SvelteKit and I'm running into this issue. I'm attempting to set up the typical User Clicks Sign In -> Provider Sign In Page Comes Up -> User Signs In -> Provider Interacts with Supabase -> Supabase redirects to my app flow. My issue is that I want the user to be redirected to a protected route on successful sign in, but the call to
    getSupabase
    is returning
    null
    for the session. Sign in action:
    Copy code
    typescript
    export const actions: Actions = {
      signIn: async (event) => {
        const { supabaseClient: sb } = await getSupabase(event);
    
        const provider = event.url.searchParams.get('provider') as Provider | undefined;
    
        if (!provider) {
          return fail(400, { message: 'Missing provider' });
        }
    
        const { data, error: err } = await sb.auth.signInWithOAuth({
          provider,
          options: { redirectTo: 'http://localhost:5173/app' } // temporary - for debugging
        });
    
        if (err) {
          return fail(500, { messaage: 'Failed to sign in with provider. Please try again later.' });
        }
    
        throw redirect(302, data.url);
      }
    };
    Server load of the page I'm attempting to redirect to after sign in:
    Copy code
    typescript
    export const load: PageServerLoad = async (event) => {
      const { session } = await getSupabase(event);
    
      if (!session) {
        throw redirect(302, '/sign-in?unauthorized=true'); // This is always hit
      }
    
      return {};
    };
    I feel like there's got to be some small thing I'm misusing here. Apologies if this is something I'm doing incorrectly.
    g
    d
    • 3
    • 5
  • Can realtime reexecute a query everytime an postgres change happens?
    d

    DYELbrah

    02/14/2023, 3:00 AM
    Every time an event occurs on a table such as insert or update, I'd like to rerun a supabase query to get the updated results. My current implementation is using React Query, where everytime an event occurs, I invalidate the query:
    Copy code
    const channel = supabase
          .channel("table-db-changes")
          .on(
            "postgres_changes",
            {
              event: "*",
              schema: "public",
              table: "customer",
            },
            (payload) => {
              console.log("payload", payload);
              void queryClient.invalidateQueries(["customerTableData"]);
            }
          )
          .subscribe();
    Is there a way I can avoid having to use React Query and simply get the results back directly from Supabase for a query. In V1 docs I saw you could write a query and subscribe to it. I believe that's no longer the case in V2. Thanks!
    g
    j
    • 3
    • 20
  • Can't Deploy Edge Functions
    i

    ICAZ117

    02/14/2023, 4:23 AM
    https://www.reddit.com/r/Supabase/comments/111tkgw/cant_deploy_edge_function/?utm_source=share&utm_medium=web2x&context=3
  • Edge Functions vs Database Webhooks
    e

    elliott

    02/14/2023, 5:45 AM
    I am trying to understand when to use one vs the other. I see very similar documentation from Supabase with guides like 'Set up a user on Stripe with Webhooks', and then another 'Set up a user on Stripe with Edge Functions' etc. As far as I can tell they accomplish the same thing, but I want to be corrected and understand better. Which of these is better to use for communicating with external API's?
    g
    b
    • 3
    • 11
  • textSearch Javascript
    p

    Poypoypoy

    02/14/2023, 7:21 AM
    text Search not get the data, is there any way to get the Biodata even i type Bio see the image for refernce , thanks in advance
    g
    • 2
    • 1
  • Edge function not receiving body
    c

    ChrisCoCreated

    02/14/2023, 7:28 AM
    First time with backend functions, so I'm sure I'm missing something obvious. When I send a post request to my edge function the body doesn't seem to be received. (I've tried both from a webhook and using postman). The function returns the expected response fine, but it doesn't log the
    Copy code
    req
    as far as I can see. Here's the code
    Copy code
    import { serve } from "https://deno.land/std@0.168.0/http/server.ts"
    
    console.log("Hello from Functions!")
    
    serve(async (req) => {
      
     // const { streamData } = await req.json()
    
    console.log(req);
    
    return new Response(
      JSON.stringify("thanks for testing"),
      { headers: { "Content-Type": "application/json" } },
    )
    
    })
    Here's the log from the postman request.
    Copy code
    Log ID
    0157d979-d9e1-4cb2-9089-c704e9af4e32
    
    Log Timestamp (UTC)
    2023-02-14T07:11:27.875Z
    
    Log Event Message
    Request {
      bodyUsed: false,
      headers: Headers {
      accept: "*/*",
      "accept-encoding": "gzip, deflate, br",
      "accept-language": "*",
      "cdn-loop": "deno;s=deno;d=0xgb8wqb38d0",
      "content-type": "application/json",
      host: "subhosting-v1.deno-aws.net",
      "postman-token": "f0a82679-e7c0-41a6-a3c5-00e2a1036093",
      "user-agent": "PostmanRuntime/7.31.0",
      "x-forwarded-for": "95.97.53.229"
    },
      method: "POST",
      redirect: "follow",
      url: "https://subhosting-v1.deno-aws.net/hello"
    }
    
    
    Log Metadata
    [
      {
        "boot_time": null,
        "deployment_id": "tzkolxmyzqprcmyinkum_2f768470-9986-4ddb-a463-12d6e17afb6c_8",
        "event_type": "log",
        "execution_id": "eaab427e-a25e-4789-b5ab-01709f5e66a8",
        "function_id": "2f768470-9986-4ddb-a463-12d6e17afb6c",
        "level": "info",
        "project_ref": "tzkolxmyzqprcmyinkum",
        "region": "aws-eu-central-1",
        "timestamp": "2023-02-14T07:11:27.685824837+00:00",
        "version": "8"
      }
    ]
    Screen shot Postman attached. What might I be doing wrong? Any guidance for a noob appreciated. thanks!
    a
    • 2
    • 3
  • Cookie not deleted on logout
    j

    JacobCoRo

    02/14/2023, 7:47 AM
    Because my next.js app is using SWR, it sends a lot of requests to the backend. When logging out, some of these requests are always going to be in-flight. after calling
    auth.signOut()
    and redirecting back to the login page, by the time the user gets to the login page, the cookie has already been rewritten into the browser and our login page directs them right back into the logged-in protected pages.
    • 1
    • 3
  • Insert into two tables
    e

    eloahsam

    02/14/2023, 7:59 AM
    Is it possible to insert into parent then child wishing one query through the supabase js sdk on nextjs or I can only insert via two queries or via trigger etc
    s
    a
    g
    • 4
    • 12
  • sign up with email
    b

    bkyerv

    02/14/2023, 9:09 AM
    when using sign up api for user management as suggested in the docs
    Copy code
    (await supabase.auth.signUp(
      email: 'example@email.com',
      password: 'example-password',
    );
    I don't get a confirmation message to the email used to sign up and I don't see any user in the profile db (unlike when I use magic link where I see users using their emails). Are we supposed to implement ourselves all the logic related to sending out a confirmation message to the email address provided during sign up and keeping record of users who confirmed their email?
    g
    • 2
    • 1
  • Permission denied for view
    r

    Rain2o

    02/14/2023, 10:53 AM
    I recently dropped and re-created a view so that I could add a column to it. I have been using this view without problem from the API (using Flutter SDK), but after dropping and re-creating it, I'm now receiving the error
    permission denied for view
    . As far as I can tell I can't set RLS or any other security permissions on a view. I used the same saved script to recreate it, only adding a new column. I've also tried removing the new column to create the view back to how it was before, but still receiving this error. It's in the
    public
    schema. Running a select * query from the query editor in Supabase UI works without issue. And the API calls from my app are working fine for everything else, and were working on this view before I dropped/created it again.. Here's a snippet from the Supabase logs
    Copy code
    "query": "WITH pgrst_source AS ( SELECT \"public\".\"all_posts\".* FROM \"public\".\"all_posts\"  WHERE  \"public\".\"all_posts\".\"user_id\" = $1 ORDER BY \"public\".\"all_posts\".\"updated_at\" DESC NULLS LAST LIMIT $2 OFFSET $3 )  SELECT null::bigint AS total_result_set, pg_catalog.count(_postgrest_t) AS page_total, coalesce(json_agg(_postgrest_t), '[]')::character varying AS body, nullif(current_setting('response.headers', true), '') AS response_headers, nullif(current_setting('response.status', true), '') AS response_status FROM ( SELECT * FROM pgrst_source ) _postgrest_t",
    g
    • 2
    • 2
  • Deno: password authentication failed for user "postgres"
    c

    cohlar

    02/14/2023, 2:46 PM
    Hi, I have an edge function that connects to the database according to the "Connect to database directly" example in https://supabase.com/edge-functions It's been working fine until I changed the password of my database. Is it possible that the Deno environment doesn't have the updated DB password? How would you check that?
    g
    • 2
    • 7
  • Will Realtime joins be supported sometime in the future?
    a

    A-PRYME

    02/14/2023, 2:56 PM
    What I'm specifically asking for is this.. Say that I have three tables,
    Post
    ,
    Comment
    and
    User
    . A post has a list of comments, and each comment belongs to a single user. How might I get a list of comments with their associated users as a stream? I'm looking to build a reactive comment section where each comment is displayed together with the name and avatar of the user who wrote it. If a new comment is
    added
    ,
    liked
    or
    removed
    , the comment section should react accordingly. This means I need to join my comment table with my user table and get the data as a stream, something that's currently not possible. But is there any chance at all that this feature will be supported in the near future?
    g
    • 2
    • 1
  • Clerk + Supabase
    s

    Smiley

    02/14/2023, 3:16 PM
    Hi, I was wondering what would be the usage of Clerk? Can't I just use supabase's auth alone? I know Clerk starts charging after 5k users and with supabase I don't have to worry about that.
    • 1
    • 2
  • NextJS app/ directory and supabase auth
    b

    Babou 🧙

    02/14/2023, 3:38 PM
    Hi, I'm currently following this guide on supabase Docs: https://supabase.com/docs/guides/getting-started/tutorials/with-nextjs#set-up-a-login-component The problem is that I'm supposed to edit the pages/_app.tsx file but it's deprecated. How can I go about it please?
  • Filtering through foreign tables doesn’t seem to work as documented
    j

    joshuabaker

    02/14/2023, 4:33 PM
    I would expect the following fetch to only return a single project, but it returns an unfiltered set.
    Copy code
    const { data: projects } = await supabaseAdmin
      .from("projects")
      .select("*, project_users(*)")
      .eq("project_users.user_id", user.id);
    User ID:
    Copy code
    bb872bc9-90f1-40a7-af0c-bed5b5662e6f
    Result:
    Copy code
    [
      {
        "id": 1,
        "created_at": "2023-02-07T18:19:54+00:00",
        "updated_at": "2023-02-07T18:19:54+00:00",
        "title": "Test Search 0001",
        "project_users": [
          {
            "id": 1,
            "created_at": "2023-02-08T12:00:41.024374+00:00",
            "project_id": 1,
            "user_id": "bb872bc9-90f1-40a7-af0c-bed5b5662e6f"
          }
        ]
      },
      {
        "id": 2,
        "created_at": "2023-02-07T18:25:48.607192+00:00",
        "updated_at": "2023-02-07T18:25:48.607192+00:00",
        "title": "Test Search 0002",
        "project_users": []
      },
      {
        "id": 3,
        "created_at": "2023-02-07T18:27:40.645989+00:00",
        "updated_at": "2023-02-07T18:27:40.645989+00:00",
        "title": "Test Search 0003",
        "project_users": []
      }
    ]
    This case is almost exactly like the one in the docs (https://supabase.com/docs/reference/javascript/select). What’s happening here?
    g
    a
    • 3
    • 62
  • PGPLSQL
    r

    Ruzelmania

    02/14/2023, 4:40 PM
    Once I have created a function and stored it in the Postgres DB, how do I get back to it if I want to edit it?
    g
    a
    • 3
    • 6
  • Not getting the row back I create on insert
    h

    Hugos

    02/14/2023, 4:47 PM
    The docs state that when inserting a new row into a table and RLS for select is enabled for everyone it should give back the inserted row which isn't the case for me, am I doing something wrong?
    Copy code
    js
            const {data, error} = await serviceRoleSupabaseClient
            .from('games')
            .insert([
                {
                    player_id_white: playerWhite.id,
                    player_id_black: playerBlack.id,
                    pgn: chess.toString("pgn")
                }
            ]);
    
            if (error) {
                return new Response(JSON.stringify({ error: error.message }), {
                    headers: { ...corsHeaders, 'Content-Type': 'application/json' },
                    status: 400,
                });
            }
    
            return new Response(JSON.stringify({ message: 'Successfully created game', game: data }), {
                headers: { ...corsHeaders, 'Content-Type': 'application/json' },
                status: 200,
            });
    g
    • 2
    • 4
  • Is there a predicted release date for PostgREST 11?
    a

    Atrox

    02/14/2023, 6:02 PM
    Couldn't find anything on the blog or in GitHub issues about a timeline or roadmap.
    g
    s
    • 3
    • 3
  • Inserting related records with primary table row id failing. Need docs.
    s

    sosapps

    02/14/2023, 6:02 PM
    When using Supbase.js style we don't see the docs for inserting a related record. We get the record to store but the relationship doesn't happen. primary record (recipe), and secondary record is (ingredient) which has the recipe relationship. If we pull the records back it shows the related ingredients, works great. What is the syntax for inserting records via the JS library to the ingredients table?
    a
    g
    • 3
    • 20
1...131132133...230Latest