https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • select .not() with column is not in array not working
    a

    AlphaSoundZ

    04/16/2023, 5:42 PM
    I have the following request:
    Copy code
    this.supabase.from('tags').select('id').not('id', 'in', tags)
    I have an array called tags which contains ids that should be excluded from the select. But why doesnt it work? The results are just empty
    d
    • 2
    • 2
  • Graphql not working in local hosting?
    m

    moarwick

    04/16/2023, 6:17 PM
    Hello, I got Graphql working when using the cloud platform as my BE. I'm now switching to local dev using Supabase CLI (Docker). I have migrated a table and I can see it locally, however, it appears that graphql didn't pick up the changes. I cannot see it reflected in the Query and Mutation types in GraphiQL and get "Cannot query field ... on type Query", for example. I've checked that the pg_graphql extension is 'on'. Anything obvious I'm missing? Thank you!
    o
    • 2
    • 1
  • Differences between Edges functions and Next.js API?
    f

    Fyl

    04/16/2023, 6:32 PM
    I would like to know what are the differences and the advantages of using Supabase's edge functions rather than the /api folder of Next.js which allows you to do serverless. When is it better to use one or the other? ChatGPT tells me that the Edges functions are closer to the user and therefore will run faster but gives an advantage to next's serverless regarding the simplified architecture. In addition, my need will be to be able to launch crons on certain functions. So maybe the edge functions will be more suitable for my needs even if in the idea it seems possible to me to use Nextjs and to link a CRON created via Supabase to it. Maybe someone would have a more precise explanation of the advantages and disadvantages of using one or the other?
  • Env variables cannot start with SUPABASE_
    v

    ven

    04/16/2023, 7:27 PM
    this is new. I got a weird error when running a locally served edge function - Error: Invalid env name: SUPABASE_URL. Env variables cannot start with SUPABASE_. I was able to work around it by prefixing some random text to env variable. Has something changed with the latest CLI?
    s
    • 2
    • 11
  • Not able to create a new column even as the owner of the project.
    a

    anurag

    04/16/2023, 9:40 PM
    Getting this error
    failed to create pg.columns: must be owner of event trigger pgsodium_trg_mask_update
    I found this issue and the solution is mentioned that change the postgres user to superuser temporarily but I don't have superuser permission for some reason even as the owner of the project. https://github.com/orgs/supabase/discussions/6326 When I ran query to check the
    usesuper
    as true there's a user called
    supabase_admin
    who is this user? I need to release a feature and I'm blocked because of this, would really appreciate any help
    g
    g
    • 3
    • 3
  • ctra & typescript tweaking on edge functions/deno?
    d

    Domcario

    04/16/2023, 9:42 PM
    im using create-t3-app static, and kept my
    supabase/functions
    directory at root level. but im getting so many errors...why?!

    https://cdn.discordapp.com/attachments/1097275777243938887/1097275777524965437/image.pngβ–Ύ

    a
    • 2
    • 3
  • Refresh Token "Failed to Fetch" Causes User Logout
    n

    nahtnam

    04/16/2023, 11:43 PM
    Hello, I am working on a chrome extension and sometimes the user happens to be offline (just woke up their computer, etc) and as a result the
    refresh_token
    request fails and logs the user out. I was wondering: 1. Where does the refresh token logic sit? Does the
    createClient
    function inject a
    setTimeout
    ? 2. Is there any way I can tell supabase to not immediately log the user out on failed refresh? I'd rather control that or at least try a few times before the user is forcefully logged out. (Or optimistically never log the user out unless a live endpoint returns 401) One thing I tried was to set
    autoRefreshToken: false
    but it seems like when I refresh the page, the
    createClient
    function sees that token is expired and logs the user out without trying to refresh. Logs of the local storage
    Copy code
    [supabase] gotItem {key: 'sb-xxx-auth-token', value: '{"access_token":"xxx"},"expires_at":1681688258}'}
    instrument.ts:132
    [supabase] removeItem {key: 'sb-xxx-auth-token'}key: "sb-xxx-auth-token"[[Prototype]]: Object
    instrument.ts:132
    [supabase] gotItem {key: 'sb-xxx-auth-token', value: undefined}
    and I don't see a refresh token request in the network
    g
    • 2
    • 10
  • Realtime chat
    u

    π•·π–Žπ–Œπ–π–™π–‡π–šπ–‘π–‡

    04/16/2023, 11:46 PM
    I am trying to make a realtime chat app using react but supabase is not very helpful with it. I cant find any good resources that show supabase with react with realtime chat with direct messaging / private messaging, so I am wondering if anyone can help I already have authentication done + messages table and a chat component.

    https://cdn.discordapp.com/attachments/1097307179511447704/1097309030441033798/image.pngβ–Ύ

    https://cdn.discordapp.com/attachments/1097307179511447704/1097309030684299295/image.pngβ–Ύ

    g
    • 2
    • 32
  • Help with users table
    a

    angusmiguel

    04/16/2023, 11:59 PM
    when i try to either delete or send magic link to a user in the the auth->users table i get the following error... lost as to where the problem might be at, suggestions?

    https://cdn.discordapp.com/attachments/1097310435084075028/1097310435226701916/image.pngβ–Ύ

    g
    • 2
    • 37
  • supabase down?
    u

    π•·π–Žπ–Œπ–π–™π–‡π–šπ–‘π–‡

    04/17/2023, 1:03 AM
    I cant access my projects at all?
    j
    g
    • 3
    • 38
  • Auth Admin Javascript APIs
    q

    quintin

    04/17/2023, 1:34 AM
    Hello, While reviewing the Auth Admin APIs, I saw the following note: "These methods are considered admin methods and should be called on a trusted server." For my application, I am not planning on implementing a server, just directly communicating with Supabase from the user interface. So if I'm looking to use one of these admin-related APIs, would it be best to create a database function that executes the intended API under the hood? For a little bit of context, what I'm attempting to do is to allow an admin of my application to create, manage, and delete users.
    n
    • 2
    • 1
  • realtime chat web
    u

    π•·π–Žπ–Œπ–π–™π–‡π–šπ–‘π–‡

    04/17/2023, 2:21 AM
    Has anyone done an entire chat web before with supabase? Ive bee trying to find resources using react.js and supabase but I cant find ones including direct messaging. Currently I am struggling with getting the user on the other end to get the message from the current logged in user without having to refresh

    https://cdn.discordapp.com/attachments/1097345974101360760/1097345974285914214/image.pngβ–Ύ

    https://cdn.discordapp.com/attachments/1097345974101360760/1097345974495613078/image.pngβ–Ύ

    v
    • 2
    • 116
  • Is it good choice to call 'deleteUser' function when users press 'withdrawal' btn?
    d

    darick

    04/17/2023, 2:54 AM
    I gonna call this function when user want to withdrawal from the service membership. When the user press the 'withdrawal' btn, it gets session and call deleteUser function. Is there any risks? or Should i choose another way? const {session } = await getSupabase(event); const { data, error } = await supabase.auth.admin.deleteUser( session.user.id??'' )
    n
    • 2
    • 2
  • discrepancy in type of the session returned by getSessionMethod vs onAuthStateChange
    b

    bkyerv

    04/17/2023, 4:01 AM
    I'm having trouble with TypeScript's complaints about the type of the session argument that's expected to be passed to useState, and the type of the session that I'm actually passing. This discrepancy arises because I initially update the state from null to the session returned by the .getSession method, which has a type that looks like:
    Copy code
    {
      session: Session;
    } | {
      session: null;
    } | {
      session: null;
    }
    Later on, when the authentication state changes, I reset the session, but the type of the session returned by the .onAuthStateChange method is different from the type of the session that was initially set. Type of the session returned by .onAuthStateChange is Session Is this an issue with my implementation, or is it a known behavior that serves a purpose?
    j
    m
    • 3
    • 3
  • Can't connect to database
    s

    Sinon

    04/17/2023, 4:23 AM
    I got this message " remaining connection slots are reserved for non-replication superuser connections" please help, I using direct connection pool
    n
    • 2
    • 2
  • How to join with a join table
    s

    scrubdaddy

    04/17/2023, 4:27 AM
    I'm not understanding the syntax in the documentation, and whether it matters how I named my table. I'm using the JS ORM. I have 3 tables, users, products, and user_product_subscriptions. I would like to select all products - product, name and whether a given user_id is subscribed or not to that product. What is the appropriate way to do this with the ORM? Thank you
    k
    • 2
    • 4
  • What does _current_branch file do? How is it generated?
    j

    Jinni

    04/17/2023, 4:46 AM
    What does _current_branch file do? How is it generated?
  • How to handle a product listing with stripe
    a

    Andy

    04/17/2023, 4:48 AM
    Hi Folks I have a scenario where a user could upload a product with an image, whether the product data with a flag is paid or not, which will be stored in the database and the image itself is stored in the storage. It could only be listed if only the user has paid with Stripe. I am thinking of creating a cron job to delete the listing of the product that aren't paid, but how do I delete the image stored in the storage if there's no use?
  • Supabase Phone Auth International Number
    g

    gtims123

    04/17/2023, 5:33 AM
    I'm using Twilio as the phone auth provider in Supabase. I believe it can only send text messages to US phone numbers. Has anybody figured out how to send text messages to international numbers?
    a
    • 2
    • 3
  • Storage Buckets and Blobs
    r

    Recon1st

    04/17/2023, 6:22 AM
    I have an API that returns a blob. I then upload the blob to my storage bucket. I see the file in my bucket with a file size suggesting that the file is not empty but when I press play nothing happens, same thing with opening it using the public url or downloading it. I know the API works because on the front end of my react app the blob plays. Any suggestions?
    g
    • 2
    • 7
  • Remove apikey requirements for certain schemas/tables
    a

    AmbidextrousMoose

    04/17/2023, 6:56 AM
    I'd like to remove the apikey header requirements for a specific table or schema in my db. The reason is that I'm integrating with a third party service that only allows me one "Authorization" header and there's no current support for additional ones. I have a service JWT on a specific role for this table/schema, but that on it's own doesn't seem to remove the requirements.
    g
    • 2
    • 5
  • filter casting
    m

    Muphet

    04/17/2023, 8:57 AM
    is there a way to cast column when filtering? my current database pricing is set as string but i want to compare it to numerical value simply by casting that column like
    query = query.filter("CAST(priceValue as INTEGER)", "gte", filterByMin);
    but that always results in column CAST does not exist. any way of achieving this?
    s
    • 2
    • 3
  • Amazon SES SMTP timeout
    c

    Cadavreux

    04/17/2023, 10:12 AM
    Hello Guys, I run into some trouble trying to link my amazon SES account to supabase. Using the online back office I give the good email, smtp user id and password provide by SES csv file when creating a user. But when trying to send a new invitation, I got a timeout and 500 error. Any idea what I could have done wrong? Thanks a lot
  • Supabase Public Bucket Asking For Token
    a

    alias

    04/17/2023, 10:27 AM
    As per the docs, when setting a bucket to public you are able to read from anywhere, i can save images to my bucket but it will not let me load my image url into a browser without the token, which i thought was not needed when making a bucket public, is this a bug?

    https://cdn.discordapp.com/attachments/1097468281050386443/1097468281255899247/Screenshot_2023-04-17_at_5.25.39_PM.pngβ–Ύ

    https://cdn.discordapp.com/attachments/1097468281050386443/1097468281562071150/Screenshot_2023-04-17_at_5.27.06_PM.pngβ–Ύ

    g
    • 2
    • 21
  • Custom transactional emails
    r

    Roko

    04/17/2023, 10:50 AM
    Is it possible to disable default Supabase transactional auth emails? I'd like to use my own system of mailing so that it could be branded and multilingual.
    • 1
    • 1
  • How to insert dynamic value into JSON column
    o

    Olly

    04/17/2023, 12:07 PM
    begin insert into public.users_history(user_id, data) values (new.id, '{"role_id": "2", "full_name": new.full_name, "email": new.emal}'); insert into public.user_roles(user_id) values (new.id); return new; end; I'm trying to add new.email into a json string. Any ideas on it? @silentworks
    s
    g
    • 3
    • 4
  • Supabase Realtime channel with Riverpod
    s

    shnoman

    04/17/2023, 12:24 PM
    Hi there, anyone has used supabase on channel method with streams? Trying to use with Riverpod works perfectly fine, but I don't know how to use with the real-time channels. Working code:
    Copy code
    @riverpod
    Stream<List<Message>> chatStream(ChatStreamRef ref) async* {
      final messages = <Message>[];
    
      final supaClient = Supabase.instance.client;
      final supaStream = supaClient
          .from('messages')
          .stream(primaryKey: ['id'])
          .order('createdAt')
          .limit(20)
          .map<List<Message>>((event) {
            final messages = event
                .map(
                  (e) => Message(
                    id: '121232',
                    message: e['content'],
                    //parse string to datetime
                    createdAt: DateTime.parse(e['createdAt']),
                    sendBy: '2',
                  ),
                )
                .toList();
    
            return messages;
          });
    
      await for (var event in supaStream) {
        messages.addAll([...event]);
        yield messages;
      }
      //on supabase disconnect
    }
    When I tried to use the realtime channel, it is not a stream, don't understand how it works.
    Copy code
    @riverpod
    Stream<List<Message>> chatStreamChannel(ChatStreamChannelRef ref) async* {
      final channel = Supabase.instance.client.channel('Channel:channel-25330478');
      final messages = <Message>[];
      channel.on(
          RealtimeListenTypes.postgresChanges,
          ChannelFilter(
            event: '*',
            schema: 'public',
            table: 'messages',
          ), (payload, [ref]) {
        final message = Message(
          id: '123',
          message: payload['new']['content'],
          createdAt: DateTime.parse(payload['new']['createdAt']),
          sendBy: '2',
        );
      
      });
      channel.subscribe(
        (payload, [_]) async {
          ref.state = const AsyncData([]);
        },
      );
    
      ref.onDispose(() {
       
        channel.unsubscribe();
      });
    }
    v
    • 2
    • 14
  • Supabase Server not responding
    s

    Simon Vanesse

    04/17/2023, 12:39 PM
    I cannot access my supabase server, the app.supabase.com website is stuck on "connecting to project", the server is on AWS | eu-central1, in the browser console I receive error message about CORS policy : Access to fetch at 'https://api.supabase.io/platform/pg-meta/xxxx/query?key=project-read-only' from origin 'https://app.supabase.com' has been blocked by CORS policy: 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. Could someone tell me if there is a service outage (I see no current issue in Supabase Status page nor AWS cloud status report) ? Thanks, Simon
  • Can't locally serve function
    v

    vincelwt

    04/17/2023, 12:58 PM
    Hi, I've started using Edge functions in my project. I'm trying to serve a function locally to debug an issue, with
    supabase functions serve ingest-website
    but I'm getting :
    Error: Error response from daemon: create supabase/functions/import_map.json: "supabase/functions/import_map.json" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path
    I'd like to keep the import map. Thanks for the help!
  • supabase/cli - supabase stop --backup gives error
    v

    ven

    04/17/2023, 1:06 PM
    Error: unexpected character "`" in variable name near "```"
    • 1
    • 3
1...182183184...230Latest