https://supabase.com/ logo
Join Discord
Powered by
# javascript
  • o

    Olyno

    06/23/2022, 9:18 AM
    Hi Try
    Copy code
    js
    const { data, error } = await supabase
      .from('cities')
      .select('name', 'country_id')
      .order('RANDOM()', { ascending: false })
  • s

    saeris

    06/23/2022, 10:24 AM
    you can't use Node built-ins inside of
    _middleware.js
    , as it runs in a different runtime. You can't use
    fs
    , this is why this is happening. https://nextjs.org/docs/api-reference/edge-runtime#unsupported-apis Is your
    @/config/index
    import reading from the filesystem? if it is, you will need to change up however you are loading config values. Perhaps use environment variables instead if you're trying to configure supabse from a config file. Can't give you a better answer without more context
  • s

    saeris

    06/23/2022, 10:28 AM
    Also I see you are trying to to check if the user has a session with
    getUserByCookie
    and redirecting them if they don't, have you tried the
    withMiddlewareAuth
    function from
    @supabase/auth-helpers-nextjs/middleware
    instead? Because it provides the same functionality. Here's a usage example from the docs: https://github.com/supabase-community/auth-helpers/tree/main/packages/nextjs#protecting-routes-with-nextjs-middleware
  • g

    Günhan

    06/23/2022, 12:17 PM
    hey, i tried that no luck.
  • g

    Günhan

    06/23/2022, 12:33 PM
    I created a view like this:
    o
    • 2
    • 2
  • g

    garyaustin

    06/23/2022, 3:16 PM
    @Günhan The view is the way or an rpc function. PostgREST does not support random(). https://github.com/PostgREST/postgrest/issues/2257 Just remember you need to add your own where policy as view will bypass RLS.
  • b

    Bicijay

    06/23/2022, 3:41 PM
    Is there any way i could debug this message better? Context: im getting the magiclink token from email and redirecting back to my app and using verifyOtp();
    Copy code
    const verify = await supabase.auth.verifyOTP({
                email: 'emailtest@gmail.com',
                type: tokenType,
                token: token
            });
    Copy code
    Object {
      "error": Object {
        "message": "Request Failed",
      },
      "session": null,
      "user": null,
    }
    g
    • 2
    • 15
  • g

    garyaustin

    06/23/2022, 3:54 PM
    magiclink and verifyOtp()
  • o

    Olyno

    06/23/2022, 4:17 PM
    Raw SQL request from SDK
  • z

    Zenon

    06/24/2022, 6:35 AM
    Thanks a lot!
  • z

    Zenon

    06/24/2022, 6:40 AM
    The
    @/config/index
    is basically a configured module alias (https://nextjs.org/docs/advanced-features/module-path-aliases) (to import the
    index.js
    file in the
    config
    folder) in a
    jsconfig.json
    file. I guess it uses the
    fs
    module internally, perhaps that's what is causing the issue. I'll try with a standard import and see if that helps.
  • z

    Zenon

    06/24/2022, 6:41 AM
    Thank you @saeris , appreciate your help. It's great to be in a community where you get so much support, makes building a lot easier.
  • d

    Devr

    06/24/2022, 2:25 PM
    Hey there! I wanted to look around about using and accessing data from supabase with its REST-API URL ,So just wanted to ask that in api docs it shows to use headers - API key & Authorization but its value is SUPABASE_KEY , So exactly what is this Key, am bit confused there which key to use?
  • g

    garyaustin

    06/24/2022, 2:39 PM
    These are your key's and url: You use anon key on the client and if you need higher level access can use the service_role key on a server.
  • d

    Devr

    06/24/2022, 6:04 PM
    So i'll need to use service_role key? as am writing server-side code to access supabase db
  • g

    garyaustin

    06/24/2022, 6:05 PM
    You don't have to use service_role, on server. It just depends on what you are doing with passing client jwt's and your RLS setup or what auth functions you might call.
  • d

    Devr

    06/24/2022, 6:06 PM
    P.S - am using Sveltekit
  • d

    Devr

    06/24/2022, 6:06 PM
    Oh got it
  • d

    Devr

    06/24/2022, 6:09 PM
    Thanks,Its all clear now👍
  • w

    WalnutDevelop

    06/24/2022, 6:11 PM
    Hi every body today need help to select only one of customer_room that has status rented
  • w

    WalnutDevelop

    06/24/2022, 6:26 PM
    oh I was found solution. is it best practice ?
  • h

    hatton

    06/24/2022, 6:51 PM
    Hi we re just getting started and we re
  • s

    saikksub

    06/25/2022, 4:33 PM
    Hello, I am trying to implement LinkedIn authentication on my project. I have created an app for sign in and enabled linkedin on settings with client ID and secret. Following is the code snippet i am using to try sign in
    Copy code
    const { user, session, error } = await supabase.auth.signIn({
      provider: 'LinkedIn'
    })
    b
    • 2
    • 11
  • s

    saikksub

    06/25/2022, 4:33 PM
    I am getting this -
    {"code":400,"msg":"Unsupported provider: Provider is not enabled"}
  • s

    saikksub

    06/25/2022, 4:34 PM
    Any one knows how to resolve this issue?
  • g

    garyaustin

    06/25/2022, 4:41 PM
    OK a couple reports now.... Also what region is your instance? Two other reports this morning: https://discord.com/channels/839993398554656828/990268349592248360
  • s

    saikksub

    06/25/2022, 5:38 PM
    ap-south-1
  • g

    garyaustin

    06/25/2022, 6:23 PM
    Interesting... https://github.com/supabase/supabase/discussions/7402 Mumbai? This user had same message with "India" instance and when he switched it worked...
  • b

    battlesheep123

    06/26/2022, 10:00 AM
    I'm currently using a Frontend Framework such as Sveltekit to read data during server-side rendering from Supabase. Is it a good practice to do that directly in the frontend? Or would you rather call an API and within your API you do all the Supabase access?
  • t

    tylergannon

    06/26/2022, 11:17 AM
    Hey there. I'm still somewhat new to Supabase so hopefully someone can confirm, but I think I can say this is what Supabase is designed for. When you created your database, you were given two access keys, which you can view under
    Settings -> API
    . The one called
    anon / public
    says "This key is safe to use in a browser if you have enabled Row Level Security for your tables and configured policies." It looks like the idea is that in order to gain access to any data in your database, a user would have to have the ANON key as well as a valid JWT issued by Supabase. So you won't have a security issue unless your application is open to XSS, etc, which could cause a user's valid login token to leak to other systems.
1...656667...81Latest