https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • React Native Webview oAuth
    v

    vjoohov

    11/17/2022, 12:55 PM
    Hi, I'm trying to publish my web app to appstore using webview. I'm stucked in auth system, since web app's oauth system is not working when rendered in webview. I think we should authenticate in react native level, and then inject auth data to webview. Is there any document about it? I need help to implement it.😂
  • Same trigger for insert and delete
    f

    FunHellion

    11/17/2022, 1:16 PM
    Hi there, I was working on some trigger for updating the claims in the JWT for the user that gets changes to their permissions. The following function came to life because it was not updating on deletes but only on inserts.
    Copy code
    sql
    create or replace function update_claims_member_schemas()
    returns trigger as
    $$
      declare
        nothing text;
      begin
        select update_user_claims(new.user_id) into nothing;
        select update_user_claims(old.user_id) into nothing;
        return new;
      end;
    $$
    language plpgsql security definer;
    
    create trigger user_roles_update_user_claims after delete or insert on user_roles
    for each row execute
      procedure update_claims_member_schemas(user_id);
    I have to execute the function for new and old now because an insert gives an object called
    new
    and a delete gives an object called
    old
    . Because this seems incorrect I was wondering if there is a better way to do this. Is there an object which is always available or is this the correct way? Thanks in advance!
    s
    • 2
    • 2
  • CDC - UPDATED Database Data to Send to External API
    r

    rohangroombridge

    11/17/2022, 1:21 PM
    Hi, would anyone kindly help? (Let me know if this is the wrong place to a ask) I am new here but I am after a CDC tool that can monitor a DB change event "UPDATE", "DELETE", "INSERT" etc... once the event happens, I can use the data in a post request to an external API. Source = MS SQL Server Destination = External API for updataing a record in the API What would help here? what's possible See image to help with what I am trying to do:
    g
    • 2
    • 1
  • error when trying to run initial db migration
    s

    sigma-andex

    11/17/2022, 2:02 PM
    Hi, I tried to run the steps from https://supabase.com/docs/guides/cli/managing-environments#overview to create the initial migration from the remote db (added three tables before using the dashboard) and now I get the following error:
    Copy code
    ➜ supabase start   
    Applying migration 20221117135052_remote_commit.sql...
    Error: ERROR: relation "graphql.schema_version" does not exist (SQLSTATE 42P01)
    At statement 113:            
    --   
    -- Name: TABLE "schema_version"; Type: ACL; Schema: graphql; Owner: supabase_admin
    --                 
    GRANT ALL ON TABLE "graphql"."schema_version" TO "postgres";
    In the migration I also cannot see an create table statement for this table. Any idea how I can fix this issue?
    s
    • 2
    • 1
  • Error fetching data on page refresh
    n

    NanoBit

    11/17/2022, 2:42 PM
    What's the full error?
    c
    • 2
    • 9
  • NextJS 13 & Supabase - Rendering a dynamic route with SSR with data from a table
    k

    kobyisalegend

    11/17/2022, 2:59 PM
    Hey, i don't really know if this is really related to supabase at all - but maybe someone can help me anyway. I want to render a dynamic route with nextjs with data from a supabase table. RLS is activated and the route should be rendered with getServerSideProps (I cannot use the
    beta
    /app directory in nextjs13 at the moment). Here is a stripped down snippet of my "problem":
    Copy code
    javascript
    export const getServerSideProps = async({ params }) => {
      const { data: board, error } = await supabase
        .from('boards')
        .select('*')
        .eq('id', params.id);
    
      return {
        props: {
          board,
        },
      };
    }
    
    export default function CategoryPage({ board }) {
      return (
        <h1>Test</h1>
      );
    }
    params.id
    is correct and also the query seems fine if i try it at any other place. But in this example the result of
    board
    is at anytime an empty array and i have no idea why. I also tried a default fetch request with an example json - that result is correct and works.:
    Copy code
    javascript
    const req = await fetch('https://jsonplaceholder.typicode.com/todos/1');
    const result = await req.json();
    has someone here an idea why this is not working and what i'm doing wrong here? i also tried it with getStaticPaths & getStaticProps - this lead into the same problem and empty array situation.
    d
    • 2
    • 2
  • Contribution setup returns error when trying to login locally 'No API key found in request'
    r

    raph941

    11/17/2022, 3:16 PM
    Hi, I Am trying to make contributions to the superbase project, and have followed the setup guide available on the repo. When I try to log in, I get 'No API key found in request', When I try to signup, I get 404. For the docker instance, am using the env value available in https://github.com/supabase/supabase/blob/master/docker/.env.example, For the studio app, I maintained the default env file https://github.com/supabase/supabase/blob/master/studio/.env These were working pretty fine before (a few weeks/month ago) until I tried again yesterday. Are there new steps required for setting up a local development environment for contribution?
    e
    g
    o
    • 4
    • 24
  • realtime updates with complex filter?
    m

    magicseth

    11/17/2022, 4:37 PM
    I'm trying to subscribe to updates for a (barely) complex filter, but it doesn't seem to work? Are boolean filters allowed?
    Copy code
    supabase
        .channel('public:messages')
        .on('postgres_changes', {
            event: 'INSERT',
            schema: 'public',
            table: 'messages',
            filter: "and(from.eq.${from},to.eq.${to})"
        }, gotNewMessage)
        .subscribe(console.log)
    g
    j
    • 3
    • 13
  • add enum type
    a

    andriusmv

    11/17/2022, 4:44 PM
    Hi there supa wizards 🧙🏻 🧙🏾‍♂️ 🧙🏻‍♀️ How do u add a new enum type to an existing column?
    g
    • 2
    • 3
  • Token cookie not being deleted on sign out
    i

    ismael1234

    11/17/2022, 5:08 PM
    when I do "await supabase.auth.signOut()", token is not being deleted in cookies.
    g
    • 2
    • 2
  • withPageAuth causes my page to be a Serverless Function on Vercel and times out when I try to access
    a

    adolfoportilla

    11/17/2022, 5:20 PM
    When utilizing
    withPageAuth
    on a page that I want to protect, this causes a timeout when I go to the page on Vercel. When I inspect the deployment, I see that the page is being added as a “Serverless Function”, is this expected?
    n
    • 2
    • 3
  • Manipulate Returned Data
    p

    puffer

    11/17/2022, 5:37 PM
    Hello all, maybe this is a stupid question but I am having a hard time accessing the data from my api call. My boiler plate code:
    Copy code
    const { data, error } = await supabase
            .from("myTable")
            .insert({
              first_name: firstName,
              last_name: lastName,
              address: addressOne,
              city: cityOne,
              address_two: addressTwo,
              state_province_region: stateProvince,
              zip_postal_code: zipPostal,
              country: countryOne,
              email_address: emailAddress,
              phone_number: phoneNumber,
              message: messageOne,
            })
            .select();
    My return object not sure how to access data I have been trying things like data.first_name, below is my return object. Thank you for any help
    g
    • 2
    • 4
  • Detect if someone is typing via Realtime
    u

    Unknown Member

    11/17/2022, 5:56 PM
    Hey guys, to detect if someone is typing, I would like to implement the "... is typing" on the front end, and I am aware that I have to implement this via realtime websocket. Between pubsub and presence, which of the two I need to look into if I want to implement it?
    j
    • 2
    • 2
  • filter between date via API
    s

    Siddharth

    11/17/2022, 6:04 PM
    I only use API only Till now I was using EQ. Method to filter my queries But now I want to filter between two dates Just like,, get all rows where created_at is between 10-11-2022 and 17-11-2022 But I can't get how to achieve that, any ideas?
    g
    • 2
    • 3
  • Auth Service terminating connection due to idle-session timeout
    g

    gerry

    11/17/2022, 6:25 PM
    Critical auth error does not let users log in. The auth service frequently throws an idle connection session timeout error. It affects us when we call this:
    Copy code
    const { data, error } = await supabaseAdmin.auth.api.generateLink(
        'magiclink',
        internalUserEmail,
        {
          redirectTo: ROOT_URL,
        },
      )
    The error object is attached in the image. Customer Support said they increased the max pool size as a temporary fix but that did not make a difference and they have been unresponsive since.
  • POSTGIS enabled but type not available in public
    r

    rankala

    11/17/2022, 6:52 PM
    Like the title said, I have enabled POSTGIS in extensions (was recomended) and I cant use it in public Schema
    g
    • 2
    • 1
  • createClient typescript auth helpers
    m

    mr fluffhead

    11/17/2022, 7:13 PM
    Does auth helpers createClient support the new 2.0 typescript setup? My project is erroring saying it doesn't expect any type arguments.
    s
    • 2
    • 4
  • Alternative to storing JSON array
    d

    dan_v

    11/17/2022, 8:15 PM
    In my table
    trip
    I currently have a column called
    destinations
    which contains an array of objects as a type
    json
    . Ideally this should probably be a nested table of some sort (?) so it can be full typed etc. However I'm not sure what the best approach is for setting this up, querying and RLS.
  • 414 Request Status - Too large Request URL
    i

    Ivan Kartashov

    11/17/2022, 8:49 PM
    I have a column with a big array that consists of cached IDs (on the 1st screenshot). I get values from it. And use these values to get records from another table that haven't cached. In other words, after getting a big array values I fetch records from another table with a condition: if the column value is not in that big array (means it hasn't been cached). Part of request looks this way:
    Copy code
    text
    "url": "https://krppyyichhwmuvastgik.supabase.co/rest/v1/kisis_forms?select=%2A&tg_id=not.in.%28%22547384285%22%2C...
    
    AND OTHER VALUES......"
    So it's too big. How could I fix that? I have no options: 1. This array represents cached values 2. I must only show user the data that hasn't seen previously (means not in that big array of cached values) 3. Then it means that I could only fetch with a filter that basically says COLUMN not in (a lot of IDs). Request is going to be huge anyways.
    g
    • 2
    • 2
  • CLI Start & Stop fails with graphql.get_built_schema_version() does not exist
    j

    Julian IncrEdelman

    11/17/2022, 8:55 PM
    I: - had a local DB - added some tables (I did enable the "set updated_at" trigger) - I wanted to enable a plugin (the psql audit plugin) - I couldn't find how to restart the local db so did "supabase stop & start" That failed (I think the start), and now whenever I start, I get the following:
    Copy code
    2022/11/17 15:50:21 PG Recv: {"Type":"ErrorResponse","Severity":"ERROR","SeverityUnlocalized":"ERROR","Code":"42883","Message":"function graphql.get_built_schema_version() does not exist","Detail":"","Hint":"","Position":0,"InternalPosition":0,"InternalQuery":"","Where":"","SchemaName":"","TableName":"","ColumnName":"","DataTypeName":"","ConstraintName":"","File":"parse_func.c","Line":2444,"Routine":"LookupFuncWithArgs","UnknownFields":null}
    2022/11/17 15:50:21 PG Recv: {"Type":"ReadyForQuery","TxStatus":"I"}
    2022/11/17 15:50:21 PG Send: {"Type":"Terminate"}
    Error: ERROR: function graphql.get_built_schema_version() does not exist (SQLSTATE 42883)
    At statement 107:
    
    
    --
    -- Name: FUNCTION "get_built_schema_version"(); Type: ACL; Schema: graphql; Owner: supabase_admin
    --
    
    GRANT ALL ON FUNCTION "graphql"."get_built_schema_version"() TO "postgres";
    • 1
    • 2
  • Gen incorrectly marking column type as `unknown`
    l

    LordZardeck

    11/17/2022, 9:05 PM
    I have a column with type of
    ::money
    , but the typescript definition comes through as
    unknown
    . Is there a way to fix this?
  • Unit and e2e testing, should you actually write to your database or mock the results?
    l

    Lukas V

    11/17/2022, 9:09 PM
    Hello, I just wanted to know how would I go about testing my app. Let's say I wanted to test user sign up and onboarding flow. Whenever i run this test, should I actually create a new user, send my onboarding form data to public users table and expect results back from my actual database or mock all the interactions with supabase, so that I'm not writing bunch of useless data to my database? I haven't done much testing, so I'm very unsure what to do at the moment, like how would I test email sign in with OTP password? Are there any examples or tutorials regarding testing with supabase out there?
    n
    z
    • 3
    • 49
  • Typescript types for views always nullable?
    x

    Xenni

    11/17/2022, 10:41 PM
    No matter which join I attempt to use for views,
    supabase gen types
    always seems to have each column of the view be nullable. Is this simply an implementation detail that's hard to overcome or?
    d
    • 2
    • 5
  • I can't figure out how to get filtering through foreign tables to work
    k

    konga

    11/18/2022, 12:55 AM
    This is in Rust so it looks a little different but it functions exactly like the JavaScript SDK. Basically there are two tables. One is called
    schedule
    and that is the direct table that I am querying.
    schedule
    table has a one to many relationship with
    schedule_details
    (basically there's one
    schedule
    and 7
    schedule_details
    one for each day). I am trying to do a foreign key filter by calling
    .eq("schedule_details.purchase_day", day)
    with day = whatever day it is. Supabase is returning the following error
    "column schedule.schedule_details.purchase_day does not exist"
    . Any thoughts?
    g
    • 2
    • 14
  • can I get USER_TOKEN via Curl on sign in?
    p

    paxmx

    11/18/2022, 1:16 AM
    I am using Curl in order to sign in, thought refresh_token in json response was the user_token, but it isn't. How can I get the actual user_token (if possible at all)? Thanks.
  • What's the better database design more tables or more columns?
    m

    Mx

    11/18/2022, 1:58 AM
    I'm designing the database for the V2 version of my opensource app for The Division 2 (https://mxswat.github.io/mx-division-builds/#/) What is better the first or second schema? First has more columns, the second uses a second table to map all the Item stats to the item
    n
    g
    • 3
    • 8
  • Help with a trigger + function
    s

    Smardrengr

    11/18/2022, 2:30 AM
    I'm a noob in this area. Given the following schema...
    Copy code
    create table games (
      id uuid primary key DEFAULT gen_random_uuid(),
      name text,
      players_min int default 0,
      players_conf int default 0,
      game_on boolean not null default false
    );
    I want to change
    game_on
    to
    true
    when
    players_conf
    (confirmed) is equal to or greater than
    players_min
    . (Conversely, if
    players_conf
    becomes less than
    players_min
    ,
    game_on
    should be changed to
    false
    .) Basically, on
    update
    , I want to run this condition and potential update to run. But... how. Still learning
    PGSQL
    .
    g
    • 2
    • 10
  • How to Redirect Login Button to Google Login ?(React.js)I have done all the setting
    z

    ZebraCoder

    11/18/2022, 10:10 AM
    How to Redirect Login Button to Google Login ?(React.js) I have done all the setting
    g
    • 2
    • 5
  • Where can I find a full example of testing security rules?
    p

    ppt

    11/18/2022, 10:13 AM
    If I understand correctly, I should use the pgTAP extension on supabase and here are a few examples of tests that I could write: https://supabase.com/docs/guides/database/extensions/pgtap . I found an example on how I could set up pgTAP to run with my Github actions CICD https://2metz.fr/blog/use-pgtap-on-github-actions/ . But what do I need the extension for then? What does this extension actually give me / how should I be using it?
    u
    • 2
    • 1
  • Whatsapp support for phone auth
    s

    Shawn Conecone

    11/18/2022, 11:02 AM
    Hello, for authentication, there's sms option, is there an option for whatsapp, ? If not, how would I make my own integration so this is possible?
1...666768...230Latest