https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Sending emails
    p

    Patryk Makowski

    09/23/2022, 10:45 AM
    Because of Gmail's SMTP which is on port 465 I can't send emails. As Deno deploy blocks that port. Is there anything I can do to fix that? Or is there any other easy way to send emails?
    n
    s
    • 3
    • 2
  • Allow SELECT on column which references another column which references the user
    b

    bhark

    09/23/2022, 12:07 PM
    Here's a simplified version of the setup: There's a "teams" table, a "nodes" table and a "comments" table. Comments belong to nodes. Nodes belong to teams. Users can be a member of teams by means of a many-to-many join table. I expected something like this to work, as a SELECT policy on comments:
    Copy code
    auth.uid() in (
      select profile_id from team_members
      where team_id = node.team_id
    )
    But it throws this error:
    missing FROM-clause entry for table "node"
    Where am I going wrong?
    n
    s
    • 3
    • 10
  • Join table multiple times ?
    a

    Amr

    09/23/2022, 12:54 PM
    I have this table
    stops
    Copy code
    sql
    - id - name
    |- 1 - Cairo
    |- 2 - Giza
    and another table
    trips
    Copy code
    sql
    - id - departure - arrival
    |- 1 -     1     -   2
    the
    departure
    column is a foreign key to
    stops.id
    and
    arrival
    to the same
    stops.id
    key. Now I can't select from
    trips
    while using
    left join
    because of this error:
    Failed to run sql query: table name "stops" specified more than once
    Of course I tried this first in SQL editor in supabase, but I'll use the js client for the project.
    g
    n
    s
    • 4
    • 13
  • Sending sendgrid email
    o

    omar

    09/23/2022, 1:17 PM
    Hello, I need to automatically send an email using my sendgrid when I insert a record in my homework table. A way to notify the client that they have new homework assigned by the teacher. All this is dont on the backend using supa UI where the teacher manually inserts a row with a quetion. How can I send the newly inserted data to a webhook url?. I have seen this post by kiwicopple https://github.com/supabase/supabase/discussions/259 but it didn't work for me. I'm sure I'm doing something wrong. Any help is much appreciated
    g
    m
    • 3
    • 29
  • Presence track calls rate limited
    i

    InspectorT

    09/23/2022, 1:18 PM
    Hello, I am testing presence on channels, and noticing that when I am calling the
    track
    call, I often get back "rate limited" as the response, even after having not called
    track
    after several seconds. It sometimes seems to stay in that state so I can never call
    track
    successfully again unless I reload the page. I tried digging through the realtime client code, and it seems like there is a way to configure
    eventsPerSecond
    but it's unclear to me how that's related and how to configure it on the channel. Any guidance would be a great help, thanks!
    g
    • 2
    • 1
  • Massive CPU Spikes
    p

    psteinroe

    09/23/2022, 1:58 PM
    Hey everyone. We are experiencing massive CPU spikes for the past 24hours and our queries became suuuuper slow. It always spikes up to 100% before crashing. Since this is a production system, we need immediate help. Already tried a ton of things (optimising queries, checking for loops in trigger etc) but none has helped enough... As of now, I am not even sure if the slow queries (20+ seconds) are symptoms or cause of the CPU spike. It almost feels like an infinite loop is increasing the CPU load until it crashes, but I cannot see anything that hints to it. We also already upgraded to the 200/month 4CPU instance but the behaviour is the same - it goes up to 100% and crashes. Any help is highly appreciated since we are out of ideas as of now...
    h
    g
    +4
    • 7
    • 24
  • Supabase forces page redirect after oAuth login?
    m

    MrGandalfAndhi

    09/23/2022, 2:02 PM
    I'm currently trying to set up oAuth in our Vue 3 app running on vite, but I'm having some difficulty redirecting users back to where they were trying to access before they logged in. The flow I'm currently trying is: 1. User accesses protected url and is redirected to login page with redirectTo query param set to the url they tried to access 2. User chooses oAuth provider and clicks the provider they want 3. i set the redirect in localStorage and call the signin with the provider and the redirectTo option set to our callback page 4. user is logged in and redirected to our callback page 5. before the callback page we validate the url fragments are set, get the redirect from localstorage and redirect to the url 6. user is now logged in and on the correct page In reality all the steps work except for 6. Instead the correct page is accessed, all is fine, but then there's a redirect seemingly out of nowhere to the root "/". Does supabase force this redirect? And is there a way to disable this?
    s
    • 2
    • 3
  • Using next with Auth.useUser() throws hydration error
    h

    HunterAndersonX

    09/23/2022, 2:46 PM
    I've basically implemented exactly https://github.com/supabase/supabase/blob/master/examples/todo-list/nextjs-todo-list/pages/index.js but get a React Hydration Error any time I try to access the page while authorized. All the documentation Supabase docs I can find point to the same implementation. This is supa frustrating...
    n
    g
    • 3
    • 44
  • How to insert to multiple tables in one request?
    x

    Xzight

    09/23/2022, 3:02 PM
    Hi I am making a todo list and I have tables for Tasks, Tags, and TagsToTasks. Is there a built in way with the rest api that I can
    POST
    a new task that has tags? To do this I will need to insert on the Tasks table and TagsToTasks table. I am hoping to avoid a situation where client first makes a
    POST
    request to Tasks and then to TagsToTasks after since then I would probably need to have a transaction to handle rollback. Is this something I should use an edge function for?
    g
    • 2
    • 13
  • Realtime not receiving events
    s

    stevharve

    09/23/2022, 3:46 PM
    For around the first 5 seconds of the realtime subscription subscribing it doesn't receive the insert event. I have already tried to listen to the isJoined boolean but that is true before the subscription starts receiving events.
    Copy code
    jsx
     useEffect(() => {
      const subscription = supabase
        .channel('public:messages')
        .on(
          'postgres_changes',
          {
            event: 'INSERT',
            schema: 'public',
            table: 'messages',
            // filter: 'team_id.eq.' + teamId,
          },
          async (payload: any) => {
            onInsert && onInsert();
          }
        )
        .subscribe((status: string) => {
          console.log('status', status);
          status === 'SUBSCRIBED' && onConnection && onConnection();
        });
    
      return () => {
        subscription.unsubscribe();
      };
    }, [teamId]);
    g
    • 2
    • 2
  • Change project url to custom domain
    a

    Anoushk

    09/23/2022, 4:14 PM
    Is there any way to change the project url to custom domain? Some of ours users told us it look malicious to them
    g
    o
    • 3
    • 3
  • How to return id upon Insert()
    c

    Cory

    09/23/2022, 4:18 PM
    How can I return the primary key ID upon inserting? I will the ID to be able to select to delete later on.
    g
    • 2
    • 6
  • Remote to local dump fails
    g

    gantiplex

    09/23/2022, 5:59 PM
    pg_dump 'postgres://user:[YOUR-PASSWORD]@db.[PROJECT-ID].supabase.co:5432/postgres' > database-dump.sql pg_dump: error: connection to database "postgres" failed: could not connect to server: Connection refused Is the server running on host "db.aqkroagodsljlpatznnr.supabase.co" (3.72.246.73) and accepting TCP/IP connections on port 5432? Ermm, yes? I can't tell if I should supply a password as it doesn't complain about that. . . . or a user of some sort
    s
    • 2
    • 2
  • Next.js - Once loaded auth page persistently shows ERR_TOO_MANY_REDIRECTS in the console
    h

    HunterAndersonX

    09/23/2022, 6:29 PM
    Started randomly seeing this issue when I thought auth was finally working. https://gist.github.com/3503ea0aaac0f7bb0ca4382b3837a092 Auth implemented per https://github.com/supabase/auth-helpers/blob/main/packages/nextjs/README.md
    • 1
    • 1
  • relation 'public.table_name' does not exist
    a

    Adam Ambrosius

    09/23/2022, 6:48 PM
    I am unable to fetch data from my table while running locally. It does work once deployed though. I have logged my
    SUPABASE_URL
    and
    SUPABASE_ANON_KEY
    and those are populated successfully. I only have one project, I have linked it and am running
    supabase start
    ,
    supabase functions serve function-name
    . Here is the only code that is being executed which is modeled directly off of the examples provided.
    Copy code
    js
    import { createClient } from "https://esm.sh/@supabase/supabase-js@^1.33.2";
    
    export const supabaseClient = createClient(
      // Supabase API URL - env var exported by default when deployed.
      Deno.env.get("SUPABASE_URL") ?? "",
      // Supabase API ANON KEY - env var exported by default when deployed.
      Deno.env.get("SUPABASE_ANON_KEY") ?? ""
    );
    Copy code
    js
    import { serve } from "https://deno.land/std@0.131.0/http/server.ts";
    import { supabaseClient } from "../_shared/supabaseClient.ts";
    
    serve(async (req) => {
      console.log(Deno.env.get("SUPABASE_URL") ?? "");
      console.log(Deno.env.get("SUPABASE_ANON_KEY") ?? "");
      const { data, error } = await supabaseClient.from("positions").select("*");
    
      console.log({ data, error });
    
      return new Response(JSON.stringify(data), {
        headers: { "Content-Type": "application/json" },
      });
    });
    What do I need to do so that I can execute this locally?
    g
    • 2
    • 3
  • Hi - I added a second schema to my database through prisma
    v

    ven

    09/23/2022, 7:16 PM
    which tells me the schema migrated successfully. I can see the new schema in Prisma studio but I am not seeing it in Supabase studio. how do i find this new schema? Also does Supabase assign a "starter" name to additional schema?
    s
    n
    • 3
    • 5
  • Typescript error with NextJs 'supabaseUrl'
    l

    louisstephensca

    09/23/2022, 8:15 PM
    So I followed the guide to create my .env.local file and set up my supaBaseClient.ts file. Everything is set up exactly as the docs suggest, but I get an error if I run my build command for the "supabaseUrl" that reads: "Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'." If I remove the env variables from the supabaseClient file and replace them with hard coded strings, everything seems to build/run just fine. Has anyone run into this issue before and successfully solved it?
  • replacing related id with value when querying table
    u

    ((()))

    09/23/2022, 9:28 PM
    Hello, I've got two tables:
    Copy code
    pre
    offices
    └  id
    └ name
    
    employees
    └ id
    └ office_id
    └ name
    office_id in employees table is linked to offices.id. When I query employees right now, I get something like
    Copy code
    json
    [
      {
        "user_id": "0dea707d-2248-4a2e-b8fd-b65578852ca9",
        "office_id": 1,
        "name": "Karen"
      }
    ]
    QUESTION: is it possible to replace that office_id with office name so I get something like this when I query select * from employees
    Copy code
    json
    [
      {
        "user_id": "0dea707d-2248-4a2e-b8fd-b65578852ca9",
        "office": "Billing Department",
        "name": "Karen"
      }
    ]
    g
    • 2
    • 9
  • Is there any way to access auth object in postgres functions?
    t

    tyakymiuk

    09/23/2022, 9:32 PM
    Hey! wondering if there's a way to access
    auth
    object inside postgres function that's being called via RPC just like we're accessing
    auth.uid()
    in e.g. RLS policies. If the answer is
    yes, it's possible
    maybe you also know a way how to access it using
    plv8
    language for writing those functions? Maybe there's a reserved word for it As a side question: are there any drawbacks in using .rpc() instead of .select() all the way through? (Just like endpoints and perform all the validations, checks, etc. there)
    g
    v
    n
    • 4
    • 12
  • Queries work navigating internally but not when loading page directly (supabaseauth-helpers-nextjs)
    h

    HunterAndersonX

    09/23/2022, 9:50 PM
    https://gist.github.com/meetbryce/bc1f279a1603a0f278a903ad5f18562c Data loads perfectly when navigating internally, but loading the page directly the request silently fails and seems to be made anon rather than authenticated.
    • 1
    • 2
  • signUp() does not detect duplicate
    s

    sob

    09/23/2022, 10:57 PM
    When I execute``` const { user, session, error } = await sb.auth.signUp({ email: email, password: pw }) ``` with an existing email, I get the user data with session=null and error=null. I was expecting to get an error. Is this normal?
    g
    v
    • 3
    • 7
  • Are there trigger functions on self hosting? I can seem to find it?
    r

    rgfx

    09/23/2022, 11:56 PM
    Found a guide that says they can be found here. Database -> Functions -> Create a new function. Not seeing anything. Let me know.
  • How do I open signIn() with 3rd party in a new window like other sites?
    m

    Matt

    09/24/2022, 1:41 AM
    When I used a firebase package before in React, the sign in method opened the "sign in with google" page in a small window, but with the default one in supabase it just redirect and then goes back, not giving any result from the { user, session, error } function as it just cuts out of it as soon as the window opens. I am using svelte and was trying to store the "user" info into a store from the result of this function.
    j
    g
    • 3
    • 2
  • Generate Types From the Cloud V2
    j

    jdgamble555

    09/24/2022, 5:33 AM
    The new supabase-js-v2 says I can generate types from the cli. The CLI, however, has nothing to do with supabase-js, so I am confused. https://supabase.com/blog/supabase-js-v2 I tried running:
    Copy code
    typescript
    supabase start
    supabase gen types typescript --local > DatabaseDefinitions.ts
    But of course it thinks I am running a local Docker version of Supabase. How can I generate the types from my cloud database? Thanks, J
    c
    s
    m
    • 4
    • 10
  • How can I join from a many to many into an array of values?
    x

    Xzight

    09/24/2022, 5:47 AM
    Sorry the title is bad it is hard to explain in one line. Basically I have tasks, tags, and a tags_to_task join table and I want to query for tasks and all their related tags. if I run this function I get the output from the image:
    Copy code
    sql
    create or replace function getTasksWithTags(input_owner_id uuid) returns table(id int8, title text, description text, priority text, due_by timestamptz, is_completed bool, tag_ids int8, tag_titles text) as $$
    begin
      return query select tasks.id, tasks.title, tasks.description, tasks.priority, tasks.due_by, tasks.is_completed, tags_to_tasks.tag_id, tags.title from tasks
      left join tags_to_tasks on tasks.id = tags_to_tasks.task_id
      left join tags on tags_to_tasks.tag_id = tags.id
      where tasks.owner_id = input_owner_id;
    end;
    $$ language plpgsql;
    What I am wondering is instead of having a row for each
    tag
    that is on a
    task
    how can I make the output 1 row per task with an array for
    tag_ids
    and
    tag_titles
    • 1
    • 1
  • Generate shorter UUID?
    o

    Oenu

    09/24/2022, 8:57 AM
    Is there a good way to generate a shorter default id? It is going to be used as a non-secure code used to access a resource (think youtube video id). I could generate it client side but that opens up a can of worms. Any suggestions?
    u
    j
    +2
    • 5
    • 7
  • Find Supabase source code
    s

    shmarts

    09/24/2022, 9:33 AM
    Hey guys, our teams been looking at supabase for the last week as we want to move away from firebase and having played around with it a bit it looks perfect for our needs Now that we're pretty much decided on it we want to get a self hosted set up up and running, but upon further digging I can't find the source code... I do see that the docker set up points to an image but not where the image is compiled from; it's probably me being stupid but can someone direct me to the source code of supabase? Thanks!
    c
    g
    • 3
    • 11
  • fields not updating
    k

    kingpeppe

    09/24/2022, 10:20 AM
    Hi there, I'm trying to update my fields but it doesn't seem to be working. I keep refreshing my supabase table and the cells don't update. Am I doing it wrong?
  • Getting 400 status when trying to upload a file to storage bucket
    c

    CANDY

    09/24/2022, 10:39 AM
    I followed this guide https://shipsaas.com/blog/get-started-with-nextjs-supabase-part-4 I did change the RLS Policy however, could it be caused by that?
    v
    g
    • 3
    • 44
  • Can we allow multiple site urls for auth redirect
    a

    Anoushk

    09/24/2022, 11:53 AM
    We have branch and preview deploys and auth doesnt work on those because they arent on the same domain as the site url, our auth redirect url is also dynamic like /post/[postid] so we cant add it in redirect urls plus there's a limit to redirect urls
    m
    g
    j
    • 4
    • 6
1...293031...230Latest