https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How can i create a schema to the database?
    t

    Talajax

    10/18/2022, 11:35 PM
    Hi, how can i create a column which is an array of objects like
    Copy code
    id: string;
      name: string;
      artist: string[];
      cover: string;
    Thanks
    g
    • 2
    • 11
  • Can I use cookies instead of storing supabase.auth.token to localStorage
    c

    cptCrunch

    10/19/2022, 12:22 AM
    Current project is using SvelteKit
  • supabase flutter when you want to update data PostgrestException error
    f

    Flipers

    10/19/2022, 12:38 AM
    when I want to update the data using the syntax ..... according to the example given it always error PostgrestException(message: , code: 404, details: Not Found, hint: null), how should I fix this?, when I try on select everything is normal but when updating data an error appears, I use flutter supabase version 1.0.0-dev.9
    g
    • 2
    • 3
  • Exploring Postgres Logs For Raise Notice
    j

    jon.m

    10/19/2022, 1:20 AM
    I'm trying to test function logic using raise notice, but I'm having a hard time locating where these logs are printed in the supabase dashboard. I've tried this code in the query editor and then viewed database > logs >postgres , but nothing appears.
    Copy code
    sql
    
    do $$
    begin
       for counter in reverse 5..1 loop
          raise notice 'counter: %', counter;
       end loop;
    end; $$
    g
    • 2
    • 13
  • Error code 42725
    u

    usamichizuru

    10/19/2022, 2:42 AM
    { code: '42725', details: null, hint: 'Could not choose a best candidate operator. You might need to add explicit type casts.', message: 'operator is not unique: text <@ unknown' } This is what supabase returned when I called containedBy method. I have no idea what is it mean so can anybody can help me? Thanks in advance. this is my code line:
    Copy code
    const { data, error, count } = await supabaseClient
        .from("profile")
        .select("id,email,username,role,telephone,name,start_shift,end_shift", {
          count: "exact",
        })
        .containedBy("role", ["admin", "employee"])
        .range(rangeArray[0], rangeArray[1]);
    a
    • 2
    • 3
  • select with multiple relationships
    u

    ((()))

    10/19/2022, 5:16 AM
    I have a db as seen in screenshot and I am trying to get all details for selected "muni" (all offices that have that muni_id and all users that have that muni_id). right now it screaming at me that it is confused on relationships and forces me to use
    Copy code
    js
    supabase.from('munies').select('*,muni_offices!muni_users(*)')
    however problem is that it leaves out some offices that have no users attached to them. please help
    j
    s
    g
    • 4
    • 10
  • database function with object arguement
    c

    cryptosi

    10/19/2022, 10:41 AM
    Is it possible to pass a large JSON object to a database function and access the objects properties in the query. At they moment I have a database function with heaps of parameters which feels clunky
    g
    • 2
    • 1
  • Can't create storage buckets from within the UI NetworkError when attempting to fetch resource
    a

    ALLINUPPERCASE

    10/19/2022, 11:38 AM
    Hey, I wanted to follow the tutorial on https://supabase.com/docs/guides/with-nextjs Everything was working so far but I couldn't upload an avatar. From within Supabase Studio I saw, that the created policies from the tutorial wheren't tied to any bucket. So i tried to manually create a bucket and received a "NetworkError when attempting to fetch resource.". I tried it with other Browsers (Safari, Chrome) and received similar errors (Failed to fetch, Failed to load). Apparently a CORS error. But I couldn't resolve it further (tried it with another network and even a new account, all the same).
    • 1
    • 1
  • Login on WFP App
    h

    HyperFX

    10/19/2022, 1:04 PM
    So I want to make it so I can have users login to my site and then get logged in on the app. I don't know how to do this though. VS Code does this when you login to github.
    g
    • 2
    • 5
  • How does docker-compose in Supabase work?
    s

    sandr

    10/19/2022, 1:26 PM
    Hey, I was just looking into the architecture of Supabase but don't understand the docker-compose and kong configuration file completely. In these files, containers are targeted as a 'hostname', it seems. For example:
    POSTGREST_URL: http://rest:3000 in docker-compose.yml
    . I'm unfamilar with this strategy in Docker. Can someone point me to where or how these domainnames are translated to their respective container IP (if that is what happens)? Is there some local DNS-server running that I am not aware of? Very curious, thanks!
    n
    • 2
    • 2
  • Auth 2.0 Google provider doesn't work for only one account
    a

    adamjarling

    10/19/2022, 1:44 PM
    Hi, I have a very curious scenario... where the Google Auth provider works for multiple Google accounts I've been testing, except for only one. The account which doesn't seem to authenticate properly is a Google Biz domain name, which happens to be the same domain name as our live app url (@zuma.live). I've tried other Google Biz email accounts, and they work. Wondering if it's some type of network / DNS collision with Auth 2.0 somehow? Anyone else experience this, or recommend how I can trouble shoot? I'm using my Google Biz domain name as an "Admin" user in my app, and seem to be locked out after upgrading to Auth 2.0, and have tried everything I can think of to login via different packages
    Auth
    component, etc.
  • GraphQL support for Views
    t

    TSIA_SN

    10/19/2022, 1:52 PM
    Hey, just wanted to make sure I wasn't missing something and that Supabase (or pg_graphql, whichever) does not currently support querying Views from GraphQL? Are there plans to add this if not?
    k
    • 2
    • 2
  • Runs local dev fine, function error when deployed to Netlify
    s

    Smardrengr

    10/19/2022, 2:43 PM
    See the error here: https://gameonornot.com Function logs say:
    Copy code
    Oct 19, 04:48:54 AM: c5565cd6 [ERROR] [1666176534418] LAMBDA_RUNTIME Failed to get next invocation. Http Response code: 403Oct 19, 04:48:54 AM: c5565cd6 2022-10-19T10:48:54.827Z    undefined    ERROR    Unhandled Promise Rejection     {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: Dynamic require of \"events\" is not supported","reason":{"errorType":"Error","errorMessage":"Dynamic require of \"events\" is not supported","stack":["Error: Dynamic require of \"events\" is not supported","    at file:///var/task/app/.netlify/functions-internal/render.mjs:29:9","    at node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/utils.js (file:///var/task/app/.netlify/functions-internal/render.mjs:5950:41)","    at __require2 (file:///var/task/app/.netlify/functions-internal/render.mjs:47:50)","    at node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketServer.js (file:///var/task/app/.netlify/functions-internal/render.mjs:7457:18)","    at __require2 (file:///var/task/app/.netlify/functions-internal/render.mjs:47:50)","    at node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/websocket.js (file:///var/task/app/.netlify/functions-internal/render.mjs:8445:17)","    at __require2 (file:///var/task/app/.netlify/functions-internal/render.mjs:47:50)","    at node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/index.js (file:///var/task/app/.netlify/functions-internal/render.mjs:8461:22)","    at __require2 (file:///var/task/app/.netlify/functions-internal/render.mjs:47:50)","    at node_modules/.pnpm/@supabase+realtime-
    Repo: https://bitbucket.org/r2-creative/gameonornot/src/main/ Any thoughts?
    • 1
    • 1
  • Please bring `auth.setAuth` back
    h

    Hal

    10/19/2022, 3:19 PM
    Hi, I upgraded my supabase to V2 but some parts crashed in my code. I looked into it and finally figured it out.
    setAuth
    is missing in V2. In my case, I need to change auth role to do different things to control access. how can I handle this for now? Can you bring it back? Thanks https://github.com/supabase/supabase/issues/8490#issuecomment-1284162765
    g
    s
    +2
    • 5
    • 11
  • Preserving url params with magic link
    c

    Cheqo

    10/19/2022, 3:23 PM
    Hello, I am using this supabase template - https://github.com/vercel/nextjs-subscription-payments I wanted to know sign up referrals, to track media or users conversion results. So, I thought of attaching referral code to my landing page like this -
    myapp.com/?ref="abc"
    I can simply grab this code and when user creates account, I make a call to public users table and attach a value like:
    refered_by: "abcd"
    But, what if they use magic link? when they confirm the email it takes them back to
    myapp.com
    ? or can I set it, so that it goes back to a link with a reference code on it? Here is some that is used with this template.
    Copy code
    const getURL = () => {
      const url =
        process?.env?.URL && process.env.URL !== ''
          ? process.env.URL
          : process?.env?.VERCEL_URL && process.env.VERCEL_URL !== ''
          ? process.env.VERCEL_URL
          : 'http://localhost:3000';
      return url.includes('http') ? url : `https://${url}`;
    };
    
        const { error } = await supabaseClient.auth.signIn(
          { email, password },
          { redirectTo: getURL() }
        );
    Does this preserve the query params? or do I need to do something else?
  • Supabase CLI & Gitpod - How to change Supabase URL for Supabase Studio
    c

    ccssmnn

    10/19/2022, 3:36 PM
    I really like how a Gitpods concept of ephemeral development environments can speed up the workflow and lower the barriers for new developers: No need to set up Docker, Node, VS Code etc. Developing the App itself in Gitpod is straightforward. Just change the Supabase URL to the one made available by Gitpod. But I cannot get Supabase Studio working. The reason: I get stuck in "Connecting to default project". The browser console shows failed requests to
    http://localhost:54321/rest/v1/
    . It seems supabase studio is also trying to reach for the Supabase URL, but I cannot find a way to change this URL to e.g.
    54323-MY-WORKSPACE.gitpod.io/rest/v1
    .
    • 1
    • 2
  • How to unpack an array of arrays with an RPC
    i

    InASunshineState

    10/19/2022, 6:04 PM
    It seems there's a lot of the documentation that assumes comfort and familiarity with PostgreSQL which makes sense, but for those of us who are being introduced to it for the first time through Supabase, I am having a hard time finding out how to do certain PostgreSQL things the "Supabase way" For example, I have a situation where I'd like to tag a function parameter that is an array of arrays, and loop through it. Something along the lines of "Each of these arrays I am sending is a family of words, find at least one of these words in each" ['blue', 'red', 'green'] = blue OR red OR green AND ['house', 'apartment', 'condo'] = house OR apartment OR condo where a row containing blue AND apartment would work, or green AND condo, but not blue AND green and none of the second array, or vice versa. Where's a good resource for learning how to craft these? More often than not examples I find online are for different versions of Postgres, take advantage of extensions I don't have, or have some other syntactical weirdness because I am using JSONB and it doesn't seem to want to cast in the same way as the person's example. Are function parameters even optional? It seems like they aren't (not here, I mean in Postgres at large) and also that something like knowing that an array is empty and skipping it isn't either. Strongly thinking about going to #907558989963853826 just to figure out how to craft certain things.
  • useSession() is null
    d

    Daddymilker4000

    10/19/2022, 6:08 PM
    hi guys, after clicking the magic login link, useSession() returns null. Firefox shows auth token in local storage. calling session import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";
    Copy code
    const session = useSession();
      console.log(session) -> null
    package.json
    Copy code
    "react": "18.2.0",
        "react-dom": "18.2.0",
        "react-redux": "^8.0.4"
        "@supabase/auth-helpers-nextjs": "^0.4.1",
        "@supabase/auth-helpers-react": "^0.3.0",
        "@supabase/auth-ui-react": "^0.2.2",
        "@supabase/supabase-js": "^2.0.2",
    • 1
    • 1
  • How to fetch the realtime changes in bulks?
    j

    johnnypea

    10/19/2022, 6:53 PM
    Can a "payload" be an array? E.g. a client browser become active again after some time and I would like to see all the changed documents.
    g
    • 2
    • 11
  • Updated to Supabase V2 not getting 'UPDATE requires a WHERE clause' on update functions.
    q

    QRST

    10/19/2022, 7:41 PM
    Updated to Supabase V2 now getting 'UPDATE requires a WHERE clause' on update functions.
    g
    u
    • 3
    • 5
  • Help with vs code and supabase cli
    c

    Crisisgone

    10/19/2022, 9:04 PM
    Hey everyone I'm having this issue with vscode so when I run the supabase link command and type in my project ref it asks me to type in the database password but when i go to type in the terminal it doesn't let me type. I attached a screenshot where the issue happens in the terminal.
  • Why is createBrowserSupabaseClient called in useState?
    u

    user8923

    10/19/2022, 9:15 PM
    Looking at official Supabase examples for React/Next.js, I see the following in _app.ts:
    Copy code
    js
    const [supabaseClient] = useState(() => createBrowserSupabaseClient());
    I'm new to React so I'm not quite sure what purpose it serves vs just calling createBrowserSupabaseClient directly?
    s
    • 2
    • 3
  • Disconnecting user from presence
    f

    foci

    10/19/2022, 9:26 PM
    I want to show a list of active users in a room. There's very clearly a client API for creating the channel and configuring the users' presences, but how do I programmatically get a user to disconnect/leave a channel? Right now my code just permanently marks them as in the room once they join, and is unable to capture when they leave. I feel it's quite basic but I'm really unclear on what exactly emits the 'leave' event on here: https://supabase.com/docs/guides/realtime/quickstart, how does supabase know when a client leaves?I want the user session to persist, just their presence in the room to go away.
  • PostgreSQL pool connection from express
    u

    5lghtct

    10/19/2022, 10:18 PM
    Hello people! I'm creating a back end with node and expressJs, and want to use supabase postgreSQL as my main db, all the changes to it should go through authenticated users from a react web client to my server, I have seen a library by supabase called postgresql-js, but I can't find any info about how to use the pool from the db, as this server will be hosted in vercel, any light to shine over how to approach to it or documentation? thanks in advance
    g
    n
    • 3
    • 2
  • updated_at
    s

    Smardrengr

    10/19/2022, 10:35 PM
    What's the simplest way to get this column to receive a new timestamp when the row is, well, updated?
    g
    j
    n
    • 4
    • 11
  • Getting a null value for the error.message when trying to DELETE a record
    b

    besimon

    10/20/2022, 1:00 AM
    I have a switch case and the GET works without an issue, but the DELETE and PATCH are not deleting or updating the row. You can see what I've got in the code below - I have RLS turned off and can't seem to identify what's stopping the record from being deleted or updated 🤨
    Copy code
    javascript
    export default async function handler(req, res) {
      const jokesID = req.query.id;
      const method = req.method;
    
      switch (method) {
        case "GET":
          const { data: getJoke } = await supabase
            .from("jokes")
            .select("id, joke, user_id")
            .eq("id", jokesID)
            .single();
          if (getJoke) {
            res.status(200).json(getJoke);
          } else {
            res.status(404).json({
              error: "Joke not found. Try checking the id or reload the page.",
            });
          }
          break;
        case "DELETE":
          const { data: delJoke, error: delError } = await supabase
            .from("jokes")
            .delete()
            .eq("id", jokesID);
          if (delJoke) {
            res.status(200).json(delJoke);
          } else {
            res.status(404).json({ error: delError.message });
          }
          break;
        case "PATCH":
          let { joke, user_id } = req.body;
          const { data: patchJoke, error: patchError } = await supabase
            .from("jokes")
            // On save, the following line changes "joke" to joke and "user_id" to user_id. 
            // I think this may be the problem (How to stop?)
            .update([{ joke: joke, user_id: user_id }])
            .eq("id", jokesID);
          if (patchJoke) {
            res.status(200).json(patchJoke);
          }
          if (patchError) {
            res.status(400).json({ error: patchError });
          }
          break;
        default:
          res.status(405).json({ error: `Method ${method} not allowed` }
    );
          break;
      }
    }
    g
    • 2
    • 4
  • stay logged in
    c

    Chen

    10/20/2022, 1:25 AM
    I'm using supabase auth but is not sure how I can implement for a user(on the web) to stay logged in forever. I've adjusted the token duration to maximum which seems to be a week, but if a user doesn't log in within a week they have to sign in again. How can I solve this?
    g
    • 2
    • 30
  • Local Development Upgrade
    a

    Arne

    10/20/2022, 4:18 AM
    Does running
    brew upgrade supabase
    upgrade only the CLI or also the Supabase services (Kong, Gotrue, DB, etc..)?
  • Bandwidth calculation for an rpc function
    r

    retr0

    10/20/2022, 6:56 AM
    Hello, how do I calculate the bandwidth cost of an rpc function? The return table from the rpc contains: 4 text columns 1 timestamp column 1 interval Column 1 int column
    g
    • 2
    • 2
  • Allow RPC only for RLS query
    t

    Tomasz Szczuciński

    10/20/2022, 8:27 AM
    Hey, another question from my side. I'm using postgres function to check something in rls. But this function can be also called by client side user. Is there a way to allow running this function only server? And block it to run from client side?
    g
    • 2
    • 4
1...484950...230Latest