https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Sveltekit Discord Auth dangerous ?
    s

    Self

    01/20/2023, 10:20 AM
    I have created a Discord sign-in within a Sveltekit app that seems to work so far, however once I try to login these messages appear in the console: > Hold Up! > > If someone told you to copy/paste something here you have an 11/10 chance you're being scammed. > > Pasting anything in here could give attackers access to your Discord account. I can't imagine that this is standard behavior so I wonder if someone had the same problem ? I'm using this code from the docs
    Copy code
    js
    async function signInWithDiscord() {
      const { data, error } = await supabase.auth.signInWithOAuth({
        provider: 'discord',
      })
    }
    s
    • 2
    • 3
  • sample showing supa auth using third-party oauth provider on NextJs
    h

    hotshoe

    01/20/2023, 10:22 AM
    Hello! 🙂 Any sample showing supa auth w/ Google, GitHub, etc. Oauth sign-in on NextJs? It seems like 99% of the samples out there are regurgitated versions of same username/password sample, and I've had no luck finding current/functional samples. I'm ignoring the samples that combine supa and next-auth -- want clean, supabase only solution. The supa docs and auth-helper samples get things setup, and I'm authenticating via GitHub, but I see the session data flash (I output serialize version to page) then gone -- so it seems like the supa helpers are not persisting session state locally, and leaving it for dev to complete the workflow. Either way, it'm hitting quite a bit of friction getting auth going on Nextjs (and Remix to a lesser degree, as I'm evaluating both platforms). Any pointers much appreciated.
    • 1
    • 3
  • Can I read files in Edge Functions?
    j

    Joel

    01/20/2023, 10:27 AM
    Based on the following information about access to the filesystem it seems like I should be able to read from files. - Here the filesystem is mentioned: https://supabase.com/blog/supabase-edge-functions#secure-by-default - Here it is said that one can not write to the file system: https://supabase.com/docs/guides/functions/quickstart#limitations. Since reading is not mentioned I would guess that it is possible? But I can't find any documentation on it. I tried it out with no success. I placed a file in the
    _shared
    folder mentioned here https://supabase.com/docs/guides/functions/quickstart#organizing-your-edge-functions. Then I tried reading the file based on the following documentation: https://deno.land/manual@v1.29.1/examples/read_write_files
  • Cannot fast reboot database
    a

    ATorres

    01/20/2023, 10:51 AM
    When trying to fast reboot database from the settings/general page on my supabase projects it throws an error with the message "Unable to restart database".
    g
    • 2
    • 1
  • Typing Responses from Database (TypeScript)
    o

    onesc

    01/20/2023, 11:34 AM
    Hi, I'm trying to add data into my database, and get the ID of it from the information in the returned data. However, I can not figure out how to type it correctly. Can anyone give some tips?
    Copy code
    typescript
    const { data, error } = await supabase
      .from("entries")
      .insert([{ some_column: "someValue" }, { some_column: "otherValue" }]);
    I just want types for data and error.
    s
    • 2
    • 4
  • unable to change default timeout of 8s
    f

    flapili (FR, bad EN)

    01/20/2023, 1:08 PM
    Hi,
    u
    g
    • 3
    • 6
  • Rendering using <SessionContextProvider>
    d

    Dbugger

    01/20/2023, 1:27 PM
    I have dont this inside my _app.js file, in NextJS:
    Copy code
    js
    const App = ({ Component, pageProps }) => {
        console.log('Rendering App');
        const [supabaseClient] = useState(() => createBrowserSupabaseClient());
    
        return (
            <SessionContextProvider
                supabaseClient={supabaseClient}
                initialSession={pageProps.initialSession}
            >
                <>Foo</>
            </SessionContextProvider>
        );
    };
    And I have noticed that from a normal Chrome window, App renders only once, but from an INCOGNITO Chrome window, it renders twice! How could this be possible?
  • Supabase compatible with Flutter Web?
    y

    Yechi

    01/20/2023, 1:48 PM
    Hi, I was looking into Firebase alternatives for my flutter app and came across Supabase. Seems almost too good to be true! I was wanting my app to be available on iOS, Android, and the web, but it seems like the pub.dev package doesn’t list the web as being supported. Is this true? If so, are there any plans to add web support for Flutter in the near future?
    m
    d
    +2
    • 5
    • 6
  • Upgrading realtime failed
    k

    Kjell

    01/20/2023, 2:08 PM
    I tried to update my supabase realtime container as it was outdated (v0.25 versus v2.1). I did this by replacing the docker compose file as can be seen below. However, now I run into the following issues on which I had found no documentation on how to fix. The error is:
    Copy code
    13:59:02.651 [error] Could not create schema migrations table. This error usually happens due to the following:
    
      * The database does not exist
      * The "schema_migrations" table, which Ecto uses for managing
        migrations, was defined by another library
      * There is a deadlock while migrating (such as using concurrent
        indexes with a migration_lock)
    I read on the internet that it could be fixed by manually creating the realtime schema; but I already have the schema. I even tried to delete the table "schema_migrations", after which the issue persisted. Hope you can help me out! New realtime container:
    Copy code
    realtime:
        container_name: supabase-realtime
        image: supabase/realtime:v2.1.0
        depends_on:
          - db  # Disable this if you are using an external Postgres database
        restart: unless-stopped
        environment:
          PORT: 4000
          DB_HOST: ${POSTGRES_HOST}
          DB_PORT: ${POSTGRES_PORT}
          DB_USER: ${POSTGRES_USER}
          DB_PASSWORD: ${POSTGRES_PASSWORD}
          DB_NAME: ${POSTGRES_DB}
          DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime'
          DB_ENC_KEY: supabaserealtime
          API_JWT_SECRET: ${JWT_SECRET}
          FLY_ALLOC_ID: fly123
          FLY_APP_NAME: realtime
          SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
          ERL_AFLAGS: -proto_dist inet_tcp
          ENABLE_TAILSCALE: "false"
          DNS_NODES: "''"
        command: >
          sh -c "/app/bin/migrate && /app/bin/realtime eval 'Realtime.Release.seeds(Realtime.Repo)' && /app/bin/server"
    Old container: -> see this merge https://github.com/supabase/supabase/commit/9b163309c83a7344c46e78615dba196f7880038b
    • 1
    • 2
  • "auth" variable via using straight postgres client
    k

    Karan

    01/20/2023, 2:47 PM
    On RLS, we can use a special variable "auth", is there a way to send this variable when we just want to use PG connection with a client postgres library? E.g. using node-postgres
    g
    • 2
    • 9
  • Command for .env write
    n

    n10000k

    01/20/2023, 2:59 PM
    Hey, if i remember correctly there was a command to write to the .env locally when using local supabase docker env
  • Upload JSON to a bucket URL
    e

    emin

    01/20/2023, 3:31 PM
    Hi! I am trying to upload a simple JSON to my bucket. I was able to fetch the data without any issues, but when trying to upload, i usually get 404 or "no Route matched with those values" When looking in the docs, SPM readme or even asking ChatGPT, I keep ending up with various variants of the endpoint, so I am not sure I am hitting the right one 🤷‍♂️ This is the latest one I tried:
    https://{MY URL}.supabase.co/storage/buckets/{BUCKET_NAME}/files/
    I modified the Policies so bucket is public and anyone can upload/delete etc... Another response I get with some variants of the URL:
    The parent resource is not found
    Any advice is more than welcome, kind of feel like I am stumbling in the dark, sending a simple JSON to who knows where 😂
    g
    • 2
    • 12
  • CDN solution for self-hosted?
    s

    spatialy

    01/20/2023, 3:35 PM
    Hi @all ... the CDN docs not make mention to self-hosted instances. Are the CDN capabilities exclusive for the Cloud version? Any best practice in using Supabase Storage and Images with a CDN?
    s
    • 2
    • 3
  • Upgrade
    k

    Kjell

    01/20/2023, 4:15 PM
    how to safely upgrade all versions of each image without losing the data? I failed to find a guide which enables this.
    g
    j
    • 3
    • 2
  • Phone Number OTP
    l

    larryM

    01/20/2023, 4:32 PM
    We have a current auth flow that looks like this: - user signs up with emails and password - while onboarding we verify the user with Phone Number - we send user OTP Pin and after success, we link the user's phone number to their email account What would be the best way to implement the phone number OTP after a user creates an account with their email?
  • Supabase subscriptions with React Query, possible?
    v

    Vik

    01/20/2023, 4:50 PM
    Good morning, I’m currently using React Query to fetch and update data in my application. I’m now looking into subscriptions that Supabase provides but I’m not sure if that’s compatible with React Query. Has anyone ran into this situation and were able to get both working? The way I’m looking at it now I would have to choose between the two.
  • Refreshing Discord OAuth2 provider Token in NEXTJS using Supabase Auth
    b

    BeastSnake

    01/20/2023, 6:27 PM
    Hello, after some hours of searching I couldnt find any approach in refreshing the provider token for Discord. My Propblem: *Authenticating using : *
    Copy code
    supabaseClient.auth.signInWithOAuth({
      provider: 'discord',
        options: {
            scopes: 'identify guilds'
       }
    })
    **After authenticating **the provider_token and **provider_refresh_token **in the **Session **are set properly and I can do valid Requests to Discord API After some minutes that values are getting null. I hope you guys can help me with my problem. Greetings!
    j
    • 2
    • 5
  • What's the status of offline support?
    i

    imagio

    01/20/2023, 6:41 PM
    Per the title, offline support is pretty important for us to consider migrating from firebase to supabase. There was a post 2+ years ago by @copple saying "we're working on it" but no updates that I could find since https://github.com/supabase/supabase/discussions/357. Is offline support actually being worked on actively? If so what's the status of it? Thanks!
    g
    c
    • 3
    • 2
  • Typed function arguments for RPC function calls
    d

    drewbie

    01/20/2023, 7:11 PM
    Is it possible to have the JS client somehow pick up on types generated from postgres functions? If I have a postgres function as such
    Copy code
    CREATE FUNCTION public.create_offer (offer_products jsonb, offer_message text)
      RETURNS VOID
      LANGUAGE plpgsql
      AS $$
    DECLARE
      offer record;
      offer_product record;
    BEGIN
      INSERT INTO offer (message, account_id)
        VALUES (offer_message, auth.uid ());
      FOR offer_product IN (
        SELECT
          (offer_product ->> 'product_id')::uuid AS product_id,
          (offer_product ->> 'price')::numeric AS price
        FROM
          JSONB_ARRAY_ELEMENTS(offer_data))
        LOOP
          INSERT INTO offer_products (offer_id, product_id, price)
            VALUES (offer.id, product_id, price);
        END LOOP;
    END;
    $$;
    and the rpc call to this function generated by Supabase has the args typed as such
    Copy code
    .rpc<"create_offer", {
        Args: {
            offer_products: Json;
            offer_message: string;
        };
    Im fine creating some sort of layer that sets the expected type for
    offer_products
    , but wanted to check here if the rpc function type generation can pick up on anything to type out the Json structure, vs just typing it as Json. Any help is appreciated!
    m
    • 2
    • 1
  • I want to create a trigger with a function to insert all image links to a column.
    i

    Irfan Ahmed

    01/20/2023, 7:45 PM
    I need to create some default images in a storage bucket with user_id as a top folder and then insert some default images in a sub folder called row_id , at the same time those image links to be inserted in a new row's column. This has to be triggered once there is a new row inserted my table_1 I need some guidance on this. Thank you!
    g
    • 2
    • 3
  • Auth update method not found
    r

    Rake

    01/20/2023, 8:06 PM
    Does this method no longer exist?
    g
    • 2
    • 37
  • updating a JSONB field, returns a 200 but doesn't insert new object
    m

    mlc

    01/20/2023, 8:56 PM
    Hey, I'm trying to update a field, but the update isn't working properly and is updating the right cell of my table but instead of the new object it's an empty object {} Any advice?
    Copy code
    refreshCallbackFunction({ access_token, refresh_token }) {
            const supabase = createClient(process.env.NEXT_PUBLIC_SUPABASE_URL, process.env.SUPABASE_SECRET_KEY); // Gets around RLS
            const oldToken = this.auth_token;
            const newToken = { access_token, refresh_token }
            return new Promise((resolve, reject) => {
                console.log("old token: ", oldToken); // Prints properly
                console.log("new token: ", { access_token, refresh_token }); // Prints properly
                supabase
                    .from("user_connections")
                    .update({
                        auth_token: {
                            access_token: access_token,
                            refresh_token: refresh_token,
                        }
                    })
                    .eq("auth_token", JSON.stringify(oldToken))
                    .select()
                    .then((response) => {
                        console.log('response', response);
                        resolve();
                    })
                    .catch((error) => {
                        reject(error);
                    });
            });
        }
    g
    f
    • 3
    • 11
  • Custom styles on Auth UI <Auth/> component per provider
    f

    fast

    01/20/2023, 10:17 PM
    Hey there, as the title already says, I am trying to apply custom styles on the Auth UI component but each provider should be styled differently. So for example the Google Button should have a different background color than the Facebook Button. If you have any questions feel free to ask. Thanks in advance
  • How to call `(storage.foldername(name))[1]` when using where on a table that has a name column
    k

    konga

    01/20/2023, 10:37 PM
    If I try to do a conditional operation on a table and match the id to
    (storage.foldername(name))[1]
    but that table contains a name column then it doesn't work. The picture is default example
    g
    • 2
    • 5
  • Trying to access current user object through getUser() function and getting null:
    u

    1voy

    01/20/2023, 10:42 PM
    Copy code
    export default function Home({
      lessons,
      user,
    }: InferGetStaticPropsType<typeof getStaticProps>) {
      console.log(user);
      
      return (
        <div className='w-full max-w-3xl mx-auto my-16 px-2'>
          {lessons.map((lesson: InferGetStaticPropsType<typeof getStaticProps>) => (
            <Link legacyBehavior key={lesson.id} href={lesson.id.toString()}>
              <a className='p-8 h-40 mb-4 rounded shadow text-xl flex'>
                {lesson.title}
              </a>
            </Link>
          ))}
        </div>
      );
    }
    
    export const getStaticProps: GetStaticProps = async () => {
      const { data: lessons }: PostgrestResponse<any> = await supabase
        .from('lesson')
        .select('*');
      const {
        data: { user },
      } = await supabase.auth.getUser();
    
      return {
        props: {
          lessons,
          user,
        },
      };
    };
    g
    • 2
    • 3
  • NextJS 13 & Auth Helpers: Cannot read properties of undefined (reading 'cookies')
    l

    logemann

    01/20/2023, 11:11 PM
    Somewhere in my tree, one of my server components errors with this stack.
    Copy code
    index.js?46cb:602 Uncaught TypeError: Cannot read properties of undefined (reading 'cookies')
        at cookies (webpack-internal:///(sc_server)/./node_modules/next/dist/client/components/headers.js:27:25)
        at getCookie (webpack-internal:///(sc_server)/./node_modules/@supabase/auth-helpers-nextjs/dist/index.js:355:33)
        at createServerSupabaseClient (webpack-internal:///(sc_server)/./node_modules/@supabase/auth-helpers-shared/dist/index.js:355:52)
        at createServerComponentSupabaseClient (webpack-internal:///(sc_server)/./node_modules/@supabase/auth-helpers-nextjs/dist/index.js:346:71)
        at createServerClient (webpack-internal:///(sc_server)/./utils/supabase-server.ts:14:130)
        at eval (webpack-internal:///(sc_server)/./app/(member)/properties/onboarding/page.tsx:16:92)
        at (sc_server)/./app/(member)/properties/onboarding/page.tsx (file:///Users/ml/development/projects/nextjs/coming-home-nextjs/.next/server/app/(member)/properties/page.js:1669:1)
        at __webpack_require__ (/Users/ml/development/projects/nextjs/coming-home-nextjs/.next/server/webpack-runtime.js:33:43)
        at eval (webpack-internal:///(sc_server)/./app/(member)/properties/page.tsx:8:74)
        at (sc_server)/./app/(member)/properties/page.tsx (file:///Users/ml/development/projects/nextjs/coming-home-nextjs/.next/server/app/(member)/properties/page.js:1680:1)
    Is there anything you can think of, why there is no cookie in the request? Or even better, where a whole cookie object is not defined? My main layout is also a server component and there i dont have this error. Of course i am using: createServerComponentSupabaseClient() from auth-helpers package. Thanks for any hint.
    • 1
    • 3
  • Handling response types from the .select() javascript client function
    m

    micma

    01/20/2023, 11:19 PM
    I just discovered you can more easily infer response types from a supabase query with the supabase-js library. The only issue I’m running into is with queries that have nested relationships. If I specify a relationship in the query, the response type is either an object with the nested columns I’m querying or it’s an array of objects with the nested columns I’m querying. Basically the response types is {} or {}[]. This makes it tough because any time I try to pull a value from the nested relationship it says the value doesn’t exist because it doesn’t know whether or not the value is an array or not. It seems a bit complicated, but I don’t know if anyone has had any experience with this scenario and knows how to resolve it.
    s
    l
    • 3
    • 24
  • Not able to delete database
    v

    ven

    01/20/2023, 11:24 PM
    I connected to my project using Postico and created a new database. I tried deleting it using Postico and pgAdmin but i keep getting a timeout. Any ideas on how to delete this database?
    s
    • 2
    • 2
  • Using prisma- check privileges?
    f

    Fi

    01/21/2023, 12:04 AM
    Hi, we are trying to use prisma with Supabase, and we've created our schema within supabase and when we use db pull, its giving us: * WARNING * The following models were commented out as we could not retrieve columns for them. Please check your privileges. - Model "Article_Tag" - Model "Articles" - Model "Tags" would love any thoughts on what's going on. we have a shadow database setup as well
    n
    • 2
    • 1
  • Help creating a database function to be called by trigger
    j

    JoshLopez

    01/21/2023, 12:08 AM
    Hey everyone, Im new to database things but I just started a side project. Can you please help me create a new row in my "users" table when I get a new signup? I have some data being passed from the auth.signUP(). I explain everything as detailed as i could in this video https://www.loom.com/share/fd2c383850404d73890b817f6baea5b3 I really appreciate your help 🙏
    n
    • 2
    • 1
1...103104105...230Latest