https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Deploy supabase nextjs on gcp cloud run
    e

    eloahsam

    02/26/2023, 3:16 PM
    Has anyone deployed a nextjs project that uses the supabase javascript sdk v2 on google cloud run , i wanted to know how did you set your environment variables without committing a env file or hardcoding keys in the dockerfile ?
    e
    d
    l
    • 4
    • 9
  • Equivalent to RLS for columns
    u

    \ ឵឵឵

    02/26/2023, 3:40 PM
    Once in a while I encounter a situation where it would be fantastic to have the ability to determine dynamically not only whether given rows can be accessed, but also which columns of those rows may be accessed. Coming from a "vanilla" Postgres background, a
    grant
    is often the tool I would turn to, but this is complicated by not quite using the built-in Postgres role system in the usual way. In addition, I'd be interested in being able to determine the columns dynamically based on other properties of the user/context besides the user role. What I'm wondering is if there is something similar to the
    using
    clause in `create policy`—where I can use whatever functions etc. that I wish—that can be used to determine which columns should be accessible. Even if this was table-wide, like
    grant select (...)
    , it would be a start, but of course it would also be nice to be able to determine it dynamically based on the content of the row, if necessary.
    g
    • 2
    • 10
  • Project inactivity cron job
    ř

    Řambo

    02/26/2023, 3:45 PM
    So your project gets paused after 1 week of inactivity, whats stopping someone from setting up a cron job to avoid this?
    g
    • 2
    • 1
  • foreign key must be uuid?
    c

    chrtravels

    02/26/2023, 3:48 PM
    Two questions on this? 1. The foreign key must be a uuid? The following will not work unless I add uuid: post_id uuid references posts (id), 2. The posts table id must also be a uuid? An error is also returned: "foreign key constraint "comments_post_id_fkey" cannot be implemented" A post on stack overflow mentions this is because the table you are pointing too must also have an id of uuid. Why is this? It's my understanding that uuid's are difficult to search, so often it is better to use SERIAL/INTEGER. Thanks much
    g
    a
    • 3
    • 17
  • can i change my db schema from the CLI
    s

    somoni

    02/26/2023, 4:20 PM
    Is it possible to change the db shema from the cli ? i uderstand this could be risky for production workload. As such i wanted to see if there is a way i can modify my schema for devlopment purposes without the risk of affecting the production schema. And also be able to migrate the production schema to the new schema ?
    g
    s
    • 3
    • 60
  • Help with CORS error with 302 redirect
    c

    Creix

    02/26/2023, 5:24 PM
    I'm trying to redirect the user to stripe connect to create their account, but I keep having this issue and I don't know how to resolve it. This is the response that I am sending from the edge function:
    Copy code
    return new Response(null, {
          status: 302,
          headers: {...corsHeaders, location: accountLink.url, "Content-Type": "application/json"},
        });
    I took
    corsHeaders
    from supabase edge function docs. And this is the error that I have on my client:
    Access to fetch at 'https://connect.stripe.com/XXXX' (redirected from 'https://XXX.functions.supabase.co/stripe_onboarding') from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
  • Help with storage policy and creating new users?
    s

    salzar

    02/26/2023, 6:18 PM
    So I'm trying to make a storage bucket so that when new users sign up, it will create folder with their user ID and only allow them access to that bucket. Luckily, there is a template that will do just that. But I cant figure out how I can actually generate the folder when a user signs up. They wont have any access to the bucket with RLS, so I cant just generate one when they sign up. Is there a way I can do it on supabase itself thatll trigger a folder to be made when it detects a new user signed up? Thanks in advance.
    g
    • 2
    • 23
  • FinTech Use Case
    g

    GKL

    02/26/2023, 6:26 PM
    Hi there, I was wondering if Supabase would be a suitable tech for my application. I will need to make a request to the database every second (sometimes even more) as I will be storing data from the stock exchange there and be calling it too. Do you think Supabase would be a viable option for this
  • UUID automatically
    d

    DikiyKazah

    02/26/2023, 6:31 PM
    I think Im doing something wrong already😀 How can I just that field automatically, a user will add goal by clicking button and table should add uuid of user, who clicked button
    g
    s
    • 3
    • 3
  • How to prompt user every time with Social Logins? (Google in particular)
    u

    Unknown Member

    02/26/2023, 7:45 PM
    Hi, is there a setting in Supabase where I can force the user for prompt every time they login with Google? This is so they can choose to login with different Google account. The issue am having is that even when I sign out of Google, everytime I log back in I automatically get signed in without prompt. The only way I can login with a different Google account is if I clear my history and cookies. It might be a Google Login specific question, but I thought I'd ask if anyone here has any advice
    s
    • 2
    • 2
  • Database health + Usage (Connecting Issue)
    m

    Michie

    02/26/2023, 8:35 PM
    We are unable to connect to our project and when we click 'still connecting'. It is asking us to check the health of our database. When we click database health, it doesn't show any info about the health. Only details about the DB for the API. We created this project way back when supabase was still in Alpha/beta I think. I'm not sure if we have reached the limit or anything but we can't determine it with the error that's being provided. The data stored are not that big and we only have few users, little traffic, so this shouldn't be an issue with the DB health. Hope anyone from the Supabase team can help us. Thanks 🙂
    g
    • 2
    • 3
  • localhost realtime db changes not working
    c

    ctulek

    02/26/2023, 11:25 PM
    I have a messages table with RLS and RealTime enabled. I have RLS policies like SELECT, INSERT for all
    authenticated
    users. Inserts work fine and I can select records from the table, too. I have a realtime channel set as follows, but it doesn't receive any updates. Looking to the browser network logs, the websocket seems to be connected as I see some heartbeat messages going back and forth. I have
    @supabase/auth-helpers-nextjs@0.5.4
    and
    @supabase/supabase-js@2.8.0"
    .
    g
    o
    s
    • 4
    • 81
  • SQL equivalent to Supabase's Inner Join
    j

    jdgamble555

    02/26/2023, 11:58 PM
    If I want to join the author record on a posts record, I can just add it like so:
    Copy code
    ts
    supabase.from('posts')
    .select('*, author!inner(*)')
    But how do I do this in pure SQL so that the results are inner json like Supabase does? I'm thinking
    Copy code
    sql
    select * from posts
    join profiles on profiles.id = posts.author
    But this won't make the results nested json like I want or give my desired results: There seem to be lots of confusing examples with
    json_agg()
    ,
    row_to_json()
    ,
    array_agg()
    and
    json_build_object()
    , none of which are simple or clear. What's the simple translation for this? Thanks, J
    • 1
    • 1
  • Internal Server Error when uploading to storage
    d

    Deng

    02/27/2023, 12:22 AM
    here is the log
    g
    • 2
    • 21
  • How to know whether the registered Email is verified or not?
    h

    Hayato

    02/27/2023, 12:29 AM
    Hello, I am new to Supabase. I would like to know if there is any way to check registered email is verified or not through API. I googled for awhile but I cannot find related posts. I might be missing something. Do I just need to simply make database for checking the status of email verification? ### When I call supabase.auth.signInWithPassword, I will get a following response which telling email is not verified. I would like to have better way to check status of email verifiation.
    Copy code
    const res = await supabase.auth.signInWithPassword({
          email: data.email,
          password: data.password,
        });
    
        console.log(res);
    Copy code
    {
      "data": {
        "user": null,
        "session": null
      },
      "error": {
        "name": "AuthApiError",
        "message": "Email not confirmed",
        "status": 400
      }
    }
    g
    • 2
    • 3
  • ERROR: relation "supabase_migrations.schema_migrations" does not exist
    c

    ctulek

    02/27/2023, 1:03 AM
    After running
    supabase db remote commit
    I get the following error. Is that an issue with my linked project?
    Copy code
    Error: ERROR: relation "supabase_migrations.schema_migrations" does not exist (SQLSTATE 42P01)
    • 1
    • 6
  • Capabilities of row level change listeners?
    i

    imagio

    02/27/2023, 2:37 AM
    I'm looking into migrating from firebase and I have a few questions about realtime database change listeners. With firestore I can query for and then listen for updates on any arbitrary query. Is that possible with Supabase? The docs seem pretty sparse about listening to row level changes. They only mention the following about filtering: > You can listen to individual rows using the format {table}:{col}=eq.{val} - where {col} is the column name, and {val} is the value which you want to match. Does that mean that the only possible filter you can apply to an update listener is
    eq
    ? If so am I correct in thinking that Supabase's realtime change listener capability is significantly more limited than Firestore's? It seems to me from reading the docs that Supabase has the following limitations: * You must use a different API for querying data and for connecting to and filtering realtime updates * You cannot fetch and begin listening in a single operation, you have to fetch data then set up a listener as a separate step * The only operation available for filtering change listeners is
    eq
    * There are significant performance limitations with listening to document updates (the docs only say
    By default, listening to database changes is disabled for new projects due to database performance and security concerns
    ) Are those accurate? If not where can I find more info? I'd like to figure out if Supabase can fill the requirements to migrate my project from Firebase. Thanks!
    g
    • 2
    • 4
  • Aren't INSERT policies with `WITH CHECK(true)` little bit dangerous?
    c

    ctulek

    02/27/2023, 3:19 AM
    If you have a table with user_id -> auth.users.id that semantically represents the owner of a record, an insert policy like the following opens the risk of any user creating any record owned by some other user. That is, if I have the following policy:
    Copy code
    sql
    CREATE POLICY "policy_name" ON public.messages
       FOR INSERT TO authenticated WITH CHECK (true);
    Any authenticated user can do the following:
    Copy code
    javascript
    await supabase.from("messages").insert({ user_id: some_other_users_id, ...other_fields });
    Or am I missing something about Supabase REST API? And is the following a way to shield against that?
    Copy code
    sql
    CREATE POLICY "policy_name" ON public.messages
       FOR INSERT TO authenticated
      WITH CHECK ((auth.uid() = user_id));
    j
    • 2
    • 1
  • Getting response status
    l

    lampaboy

    02/27/2023, 4:18 AM
    Is there a way to get the status shown here: https://supabase.com/docs/reference/javascript/insert I basically want to know if my insert is successfully and ideally through the response message.
    Copy code
    const { error } = await supabase
      .from('countries')
      .insert({ id: 1, name: 'Denmark' })
    From the docs, it shows the response message below, but is it accessible anywhere?
    Copy code
    {
      "status": 201,
      "statusText": "Created"
    }
    • 1
    • 1
  • RLS vs API
    j

    JumpingBack

    02/27/2023, 4:23 AM
    I am only using supabase for a project and would like to know when to use RLS and API, cause rls interacts directly with postgres and api go through gotrue so they are slower but what if I want to only use api should I even enable rls? I couldn't find anything related to this so my concepts might be wrong please correct me.
    s
    • 2
    • 2
  • role bases permissions is not easy to implement !!
    m

    mct.dev

    02/27/2023, 6:54 AM
    Am trying to implement a role based permissions in my app (Nextjs 13) and it seems difficult any suggestions??
    s
    g
    v
    • 4
    • 8
  • Using Supabase Auth within a Postgres connection
    u

    \ ឵឵឵

    02/27/2023, 9:04 AM
    Any way to voluntarily authenticate using a JWT from within a native Postgres connection? I guess yes, but haven't seen it in the docs.
    g
    • 2
    • 2
  • Help with self-host on caprover
    a

    ak4zh

    02/27/2023, 9:08 AM
    I am trying to add Supabase as a one click app to Caprover. Here's the pull request: https://github.com/caprover/one-click-apps/pull/833 Everything deploys correctly but the issue I am facing is when I open dashboard it is unable to connect with the postgrest API and results in 404. Though all individual apps are working fine and can be accessed from their individual urls without any 404.
  • Supabase sign out doesn't seem to work for Flutter
    e

    elliott

    02/27/2023, 9:47 AM
    Calling Supabase's
    signOut()
    method does not clear the session or current user on Flutter. Both appear to retain their state. An auth changed event for log out is fired, but those variables remain not cleared.
    s
    g
    • 3
    • 11
  • Possible to Disable some unused containers in local development?
    n

    NanoBit

    02/27/2023, 10:01 AM
    Hello, I was just curious if it was possible to disable some containers during local development to reduce resource usage? For example, I never use
    imgproxy
    and
    storage
    , so turning them off saves some resources. I didn't see any post on Discord or Github.
    s
    • 2
    • 2
  • Simple js client insert fails: "more than one row returned by a subquery used as an expression"
    s

    spiralis

    02/27/2023, 10:02 AM
    I have a really strange situation. I have a table that I cannot even do a simple insert on. It accepts data when using SQL, but when using the supabase client it fails. The error message (as referred to in the subject) really seems off. And like I said, the following simple SQL INSERT query does work:
    Copy code
    sql
    INSERT INTO section 
    (poll_id, slug_id, "label", description) 
    VALUES(4, 'welcome', 'Welcome', 'Test');
    For the record, the table is (was) empty. RLS is enabled, with one relevant policy:
    Copy code
    sql
    (EXISTS ( SELECT 1
       FROM poll
      WHERE ((poll.id = section.poll_id) AND (poll.project_id = ( SELECT project.id
               FROM project project
              WHERE (project.owner_id = auth.uid()))))))
    A
    project
    has an
    owner_id
    . A
    project
    can have many
    poll
    records via
    poll.project_id
    . A
    poll
    can have many
    section
    rows. The relevant DDL is attached to the post. This is the client call I am making:
    Copy code
    ts
      async create({
        poll_id,
        slug_id,
        label,
        description,
      }: {
        poll_id: number
        slug_id: string
        label: string
        description?: string
      }) {
        const { data: sectionIds, error } = await supabase
          .from('section')
          .insert([{ poll_id, slug_id, label, description }])
          .select('id')
        return { id: sectionIds?.[0]?.id, error } as { id: Number; error: PostgrestError }
      },
    Digging deeper, I find this error-entry in the Supabase "postgres" logs: ERROR: more than one row returned by a subquery used as an expression The content json is really interesting, but I am not able to figure it out. Please see the attached file. Any assistance or tips on working around it would be appreciated.
    g
    • 2
    • 4
  • react supabase can't see my new table
    m

    MoreeZ

    02/27/2023, 10:33 AM
    Ive been using react supabase for a long time now and its worked well until now. This line has always worked and returned correct data and it still does.
    Copy code
    js
      const { data, error } = await supabase
        .from("stories")
        .select()
        .order("index");
    This I'm trying to do the same thing for the
    user_settings
    table and it's returning an empty array in data
    []
    Copy code
    js
      const { data, error } = await supabase.from("user_settings").select();
    s
    • 2
    • 6
  • profiles table on public or auth metadata?
    r

    Razoth

    02/27/2023, 11:00 AM
    i don't know what to use, i have to store user data for my company's internal application. the user wont be able to update or delete it themselfes. including name, language preference, title, department, telephone and fax extension. whats the correct policy?
    s
    g
    • 3
    • 23
  • Supabase auth with separated db
    m

    Mihai Andrei

    02/27/2023, 11:04 AM
    Hello! Anyone using supabase only for auth + storage with a different database? I am curious how you guys create the user in your own db when he logs in ( when using supabase also for db, you add a trigger, But in this case i cannot do it)
    j
    • 2
    • 5
  • Inner Join on select returns differently now?
    c

    Cardoso

    02/27/2023, 11:40 AM
    Hello. I updated the supabase-js and auth-helpers to the latest versions and my typescript linter started triggering. It does not give anymore the inferred types. example here my type that i intend to return from the function and the second image shows host: [x:string].
    • 1
    • 1
1...147148149...230Latest