https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • How can I know if a trigger successfully ran a function?
    j

    jfbn

    02/19/2023, 1:55 PM
    I have setup logging via the resource in https://supabase.com/docs/guides/platform/logs but to no avail; I still don't see any function logs.
    g
    • 2
    • 44
  • Supabase and Unity Patch?
    a

    AntDX316

    02/19/2023, 3:13 PM
    someone please give code on how to do this? I've got the get to work but patch is a hassle. SimpleJSON c# scripts seems to be broken but it works for get.
    a
    • 2
    • 2
  • get id as result of insert action
    t

    theravenstone

    02/19/2023, 3:23 PM
    hey i want to create an entry with insert. i need the id of that new created row to add some relation data in another table for that new created entry in javascript
    g
    • 2
    • 11
  • Auth error: AuthRetryableFetchError
    o

    Orange🍊

    02/19/2023, 3:29 PM
    [SOLVED] Every time that I try signing in/up/out I hit this error:
    _AuthRetryableFetchError: fetch failed [...] _isAuthError: true, status: 0
    I am using SvelteKit with AuthHelpers and here's a quick overview of my code in `.../sign-in/+page.server.ts`:
    Copy code
    export const actions: Actions = {
        default: async (event) => {
            const { request } = event;
            const { supabaseClient } = await getSupabase(event);
    
    const { error } = await supabaseClient.auth.signInWithPassword({
                email: email,
                password: password
            });
    
    if (error) console.error(error)
    • 1
    • 1
  • Auth U: Custom Metadata
    p

    Prashant Singh

    02/19/2023, 3:34 PM
    How to send custom metadata when using AuthUI in nextjs? I want to send role (user or expert) when signup happens based on the page.
    o
    • 2
    • 2
  • i need a specific query to count all of my data
    t

    theravenstone

    02/19/2023, 5:01 PM
    i have the table activity_has_partner inside this there are "activity" and "partner" columns that reference to other tables i need the count of how many entries every partner has returned data could look like this [ {PARTNER1: X rows}, {PARTNER2: Y rows} ] i just need the row count for how often a partner is linked to an entry in table activity_has_partner code in javascript
    s
    g
    • 3
    • 15
  • No functions working
    r

    Ruzelmania

    02/19/2023, 5:36 PM
    No matter what function I write this morning, I get "Failed to validate sql query: syntax error at or near "function name"
    s
    g
    a
    • 4
    • 18
  • how to short result data
    t

    theravenstone

    02/19/2023, 5:36 PM
    currently i get
    Copy code
    [
      {
        "id": 10,
        "partnername": "sd",
        "total": [
          {
            "count": 3
          }
        ]
      },
      {
        "id": 12,
        "partnername": "Gk",
        "total": [
          {
            "count": 2
          }
        ]
      }
    ]
    would like to get
    Copy code
    [
      {
        "id": 10,
        "partnername": "sd",
        "count": 3
      },
      {
        "id": 12,
        "partnername": "Gk",
        "count": 2
      }
    ]
    current code:
    Copy code
    ts
    
    const { data } = await client.from('partners').select('id,partnername, total:activity_has_partner(count)').eq('created_by', user.value.id).order('created_at')
    g
    a
    • 3
    • 11
  • NextJS App Dir: Need help, cannot find ANY working guide
    m

    misakss

    02/19/2023, 5:43 PM
    I'm new to frontend development, but I've managed to build a working SPA web app. Now I need to add authentication and I decided to go with Supabase. However, I cannot find a working guide on how to do this. Where can I find help on this?
    s
    n
    s
    • 4
    • 4
  • permission denied for function get_workspaces_for_authenticated_user
    q

    queb

    02/19/2023, 5:43 PM
    Why am I getting this error when trying to get the workspaces for the currently authenticated user using SupabaseJS? It works in the SQL editor.
    g
    • 2
    • 14
  • Next.js - Using middleware + getServerSideProps returns Error 500.
    p

    pheralb

    02/19/2023, 5:55 PM
    Hi! I am using Supabase Auth Helpers Middleware for Next.js:
    Copy code
    tsx
    import { createMiddlewareSupabaseClient } from "@supabase/auth-helpers-nextjs";
    import { NextResponse } from "next/server";
    import type { NextRequest } from "next/server";
    
    export async function middleware(req: NextRequest) {
      const res = NextResponse.next();
      const supabase = createMiddlewareSupabaseClient({ req, res });
      const {
        data: { session },
      } = await supabase.auth.getSession();
    
      // Set Auth URL:
      const isAuthPage = req.nextUrl.pathname.startsWith("/auth");
    
      // If authenticated, redirect to dashboard:
      if (isAuthPage) {
        if (session?.user.id) {
          return NextResponse.redirect(new URL("/dash", req.url));
        }
        return null;
      }
    
      // If not authenticated, redirect to auth page:
      if (!session?.user.id) {
        let from = req.nextUrl.pathname;
        if (req.nextUrl.search) {
          from += req.nextUrl.search;
        }
    
        return NextResponse.redirect(
          new URL(`/auth?from=${encodeURIComponent(from)}`, req.url),
        );
      }
    }
    
    export const config = {
      matcher: ["/dash/:path*", "/auth"],
    };
    If in path /dash/url, which is protected by middleware, I use getServerSideProps to get the data from a table it returns Error 500:
    Copy code
    tsx
    export const getServerSideProps = async (
      ctx: GetServerSidePropsContext<ParsedUrlQuery, PreviewData>,
    ) => {
      const { url } = ctx.query;
    
      // Cache data
      ctx.res.setHeader(
        "Cache-Control",
        "public, s-maxage=10, stale-while-revalidate=59",
      );
    
      // Create authenticated Supabase Client
      const supabase = createServerSupabaseClient(ctx);
    
      // Fetch single row from table
      const { data } = await supabase
        .from("mytable")
        .select("*")
        .eq("url", url)
        .single();
    
      // Redirect to 404 if no data
      if (!data) {
        return {
          redirect: {
            destination: "/404",
            permanent: false,
          },
        };
      }
    
      return {
        props: {
          url,
          data,
        },
      };
    };
    g
    s
    • 3
    • 11
  • Doubt about security
    a

    Aless.c06

    02/19/2023, 6:21 PM
    Hi, I have a been playing around with supabase and I'm creating a multiplayer game (like garticphone) using vanilla js. At the moment I disabled RLS but I now want to do some tests with my friends, I haven't understood If I need to hide the anon key. Also the game shouldn't have mail authentications for users who join a lobby but at the same time I want to make sure people can't like "hack" the game by putting data they shouldn't be able to put.
    g
    r
    • 3
    • 7
  • getAuthenticatorAssuranceLevel not working as expected
    k

    kompiledstore

    02/19/2023, 9:04 PM
    Supposed behaviour:
    Once a user has logged in via their first factor (email+password, magic link, one time password, social login...) you need to perform a check if any additional factors need to be verified. This can be done by using the supabase.auth.mfa.getAuthenticatorAssuranceLevel() API. When the user signs in and is redirected back to your app, you should call this method to extract the user's current and next authenticator assurance level (AAL).
    Current behaviour: After signin Im getting this data: { currentLevel: 'aal1', nextLevel: 'aal1', currentAuthenticationMethods: [ { method: 'password', timestamp: 1676839714 } ] } Even thought I was receiving: { currentLevel: 'aal2', nextLevel: 'aal2', currentAuthenticationMethods: [ { method: 'password', timestamp: 1676839714 ...} ] } before sign out. Am I missing something? In db I can see the factor saved
    s
    • 2
    • 2
  • How to do basic retrieval of data and files from supabase?
    t

    TripleSmile

    02/19/2023, 9:07 PM
    First of all I want to test out how to get data from already created table called 'notes' and get text_column values from it. So far I have initialized supabase in main function:
    Copy code
    dart
    final supabase = Supabase.instance.client;
    void main() async {
      WidgetsFlutterBinding.ensureInitialized();
    
      await Supabase.initialize(
        url: 'https://lalala.supabase.co',
        anonKey:
            'myanonkey',
      );
    
      runApp(const MyApp());
    }
    My main runApp class looks like this:
    Copy code
    dart
    class MyApp extends StatelessWidget {
      const MyApp({super.key});
      
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: Scaffold(
            body: GridView.count(
              crossAxisCount: 4,
              children: ButtonList().create(),
            ),
          ),
        );
      }
    }
    I basically create a list of buttons where each one plays a sound Here's how my buttons list look:
    Copy code
    dart
    class ButtonList {
      static const double textSize = 50;
      create() {
        return [
          ElevatedButton(
            child: const Text("iː", style: TextStyle(fontSize: textSize)),
            onPressed: () {
              AudioPlayer().play(AssetSource("01.wav"));
            },
          ),
          ElevatedButton(
            child: const Text("uː", style: TextStyle(fontSize: textSize)),
            onPressed: () {
              AudioPlayer().play(AssetSource("02.wav"));
            },
          ),
          ElevatedButton(
            child: const Text("ʊ", style: TextStyle(fontSize: textSize)),
            onPressed: () {
              AudioPlayer().play(AssetSource("03.wav"));
            },
          ),
          ElevatedButton(
            child: const Text("Ιͺ", style: TextStyle(fontSize: textSize)),
            onPressed: () {
              AudioPlayer().play(AssetSource("04.wav"));
            },
          ),
        ];
      }
    }
    I want to make it so that the 1st button of a list has an extra text which is retrieved from supabase 'notes' table text_column column. Where do I start? Sorry if the question looks trivial, but I have no experience with databases...
    g
    • 2
    • 4
  • Upload a file from an RPC function to supabase storage
    j

    Julien

    02/19/2023, 9:24 PM
    Does anyone know how to upload a file from an RPC function to Supabase Storage using the HTTP extension? I'm struggling with this πŸ˜…
    g
    a
    • 3
    • 16
  • Listen for only new rows
    c

    caseycrogers

    02/19/2023, 9:27 PM
    I want to listen for inserts to a table (using supabase_flutter). The current API is a hassle to use because the stream emits the entire table on every insert.
    g
    • 2
    • 12
  • docker errors
    m

    mauricev

    02/20/2023, 4:38 AM
    I'm seeing a bunch of errors in my docker containers suggesting I have something configured wrong in my .env file. 1, supabase/realtime
    Copy code
    {
      "log": "** (Postgrex.Error) ERROR 3F000 (invalid_schema_name) no schema has been selected to create in\n",
      "stream": "stderr",
      "time": "2023-02-20T04:26:44.02981013Z"
    }
    2, supabase/gotrue
    Copy code
    problem creating schema migrations: couldn't start a new transaction: could not create new transaction: failed to connect to `host=db user=supabase_auth_
    admin database=postgres`: failed SASL auth (FATAL: password authentication failed for user \\\"supabase_auth_admin\\\" (SQLSTATE 28P01))\",\"time\":\"2023-02-20T04:27:09Z\"}\n","stream":"stderr","time":"2023-02-20T04:27:09.68
    520345Z"}
    3, kong
    Copy code
    /var/lib/kong/kong.yml: No such file or directory\n","stream":"stderr","time":"2023-02-20T04:28:28.638856047Z"}
    4, supabase/storage-api
    Copy code
    error: password authentication failed for user \"supabase_storage_admin\"\n","stream":"stderr","time":"2023-02-20T04:19:29.727949168Z"}
    • 1
    • 5
  • Import json data to Supabase table
    d

    Dong

    02/20/2023, 5:51 AM
    I have data exported from contentful, which includes array fields. I am trying to convert the json file to a csv file and then I can use the admin interface to import the csv file to create a new table. But my problem is that my csv file has all the array fields as a single column, which results in too many columns. Can anyone help me to create a correct csv file with array fields, or another way to achieve this? Thanks!
    • 1
    • 1
  • Auth error for new signups: "No API key found in request"
    a

    akrolsmir

    02/20/2023, 7:08 AM
    We had sign in with email working, then when configuring Google OAuth per https://supabase.com/docs/learn/auth-deep-dive/auth-google-oauth, we started getting this error for both Google and email signins:
    Copy code
    {
      "message": "No API key found in request",
      "hint": "No `apikey` request header or url param was found."
    }
    The only other reference I can find online is https://stackoverflow.com/questions/74512907/supabase-signinwithpassword-is-giving-me-a-502-error, which seems to be the same error message but has no solution.
    • 1
    • 1
  • Expo Stripe implementation with supabase example
    k

    kresimirgalic

    02/20/2023, 7:21 AM
    Hey guys, i followed the example you have here https://github.com/supabase-community/expo-stripe-payments-with-supabase-functions/blob/main/supabase/functions/payment-sheet/index.ts And what i am getting at the initial load is this error "FunctionsHttpError: Edge Function returned a non-2xx status code" Anyone familiar with it?
  • Webhook with users table
    n

    nahtnam

    02/20/2023, 7:42 AM
    Is it not possible to have a webhook for the
    auth.users
    table?
    g
    • 2
    • 1
  • Multiple migrations on same Supabase Project/DB?
    r

    redlumxn

    02/20/2023, 7:48 AM
    Our architecture has multiple services/apis and a single Supabase project/DB. Some of these services will be responsible for writing to the DB. We want these services to own their DB objects and manage their lifecycle using Supabase migrations (https://supabase.com/docs/guides/cli/local-development#database-migrations). With this setup, each service repo will contain a supabase folder with the migration files specific to the DB object it manages. Is it possible to have multiple migrations run on the same Supabase Project/DB? Given that there is one
    supabase_migrations.schema_migrations
    table per DB instance, not sure if this is possible.
  • Can't call function
    a

    Aless.c06

    02/20/2023, 8:20 AM
    This is how I'm calling the function in javascript:
    Copy code
    const { data, error } = await supabase.rpc('join_lobby', {
        username_input: 'Username',
        pfp_input: 'avatar.png',
        tag_input: '#1234',
        lobbyID: 1
      });
    • 1
    • 1
  • Unique ID auto-assign for PK
    h

    Hutchie

    02/20/2023, 9:08 AM
    Hi all, Recently I was playing around with a couple tables and ticked and unticked the 'Is Identity' setting. Unfortunately, this has caused a couple issues for me. For context, each time a new row is added the 'Is Identity' setting auto-assigns a new ID that is +1 the old ID. This worked great until it was reset. What happens now is that each time a row is added it's ID being added is starting at 0, which causes problems as my application expects new rows to be +1 ID from the most recent row. What I have tried and failed to do is fix the auto-assign identity to start where I need it to (at 780). Any help is much appreciated. Thank you.
    j
    • 2
    • 10
  • Storing data in supabase database
    i

    its_Susmita

    02/20/2023, 9:55 AM
    How to upload a csv file in the database?
    s
    • 2
    • 1
  • created_at has changed from american to european
    d

    dev Joakim Pedersen

    02/20/2023, 9:59 AM
    Has the created_at changed on how it works? I don't give it any values on insertion on my end. but I've noticed that products added this year has a european way of telling time, and previous is the american way?
    s
    j
    • 3
    • 19
  • Geo queries
    a

    A-PRYME

    02/20/2023, 11:05 AM
    I have two tables,
    Restaurant
    and
    Address
    . A restaurant has an address. How my I get a list of restaurants ordered from nearest to farthest given that an address has a
    location
    column of type GeoPoint?
    g
    a
    y
    • 4
    • 27
  • trouble inserting over the weekend
    d

    dev Joakim Pedersen

    02/20/2023, 11:11 AM
    I have a control panel where I add products. They go into a table called product_table_prod_v2. and images into image_table_updated. It worked fine on friday. but logging in today after the weekend, I was not able to use it anymore. I do not get any error on insert, but it does not insert. I do get a 400 bad request trying to get the product I inserted back as a response. I have not made any changes to the code over the weekend. and I have not done so on supabase either. But something has changed. I checked if my coworker had turned on any RLS. but that was not the case. and asking him about if he did any changes to the table. like adding a new field or something but no changes to the table he says. So I'm a bit lost on where to look for issues. I've gone over the table trying to find anything that makes it corrupt like a ID issue or something new. but no issue. also tried adding a product manually from supabase dashboard and that worked fine. Any tips on where to look for my bug?
    • 1
    • 1
  • Storage Access Control for Subfolder by authenticated Users
    b

    Barry | Fansea

    02/20/2023, 11:12 AM
    For a small side projects I need some help. I try to create an access control which is managing the access for subfolder. There are orders and each order can have attachments. Those attachments should be uploaded in a SUBFOLDER (). Im not able to create the access control... I appreciate any help. Thanks
    p
    • 2
    • 2
  • Convert SQL query into supabase-js supported ocde
    s

    Soul

    02/20/2023, 11:33 AM
    How can i convert this sql code
    Copy code
    select * from hotels
    inner join rooms
    on hotels.id = rooms.hotel_id
    left join reservations
    on rooms.id = reservations.room_id
    where reservations IS NULL OR reservations.start_date > 'value' OR reservations.end_date < 'value'
    into supabase-js code?
1...138139140...230Latest