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

    Pragy

    11/18/2021, 5:09 PM
    https://supabase.io/docs/reference/javascript/generating-types mentions that we should add the "update-types" script to
    package.json
    . That means exposing the API url and the public-key in the code repository. Is that okay?
  • s

    Scott P

    11/18/2021, 5:16 PM
    Neither the API url nor the public key are secret, so they're safe to show in a public-facing app. The secret key should never be exposed outside a controlled environment (e.g. a server where only you have access).
  • i

    InRed

    11/18/2021, 11:26 PM
    When you
    CREATE
    your table you will need to define the foreign key. Or you can add it using an
    ALTER
    table command. https://www.postgresql.org/docs/current/tutorial-fk.html I'm brand new to supabase so I don't know how to do it in the UI yet.
  • r

    ryexley

    11/18/2021, 11:48 PM
    Yeah, I’m new to it also, but that’s been my point. I understand how to create relationships between tables with a create table statement, but I wasn’t able to find a way via their UI. That seems to be the consensus though, is use SQL to define the table relationships. I can live with that.
  • f

    FreakDJ

    11/19/2021, 2:08 AM
    I'm not sure if this should be in the "Help" channel or here, but I am building a small app with Javascript to fetch data from an API and store it into a table. I have little experience with backend, so I am hoping to get some help as I am having some trouble wrapping my head around documentation!
  • j

    jonny

    11/19/2021, 3:30 AM
    Hey @User - when editing/creating a table, you can set up relationships in the UI by clicking the link icon.
  • r

    ryexley

    11/19/2021, 3:32 AM
    Oh man … I have no idea why, but I never even clicked on that to see what it does. I’ll check that out. Thank you!!
  • j

    jonny

    11/19/2021, 3:33 AM
    This is only the first iteration of this table editor, we can probably improve it so it's more clear
  • r

    ryexley

    11/19/2021, 3:33 AM
    It seems obvious now that I know. I should’ve clicked it!
  • j

    jonny

    11/19/2021, 3:35 AM
    Nice! be great to get an idea of anywhere you've got stuck, or concepts that are not clear
  • f

    FreakDJ

    11/19/2021, 3:36 AM
    A thread was started in the “help” channel! It’s probably best to continue in there! Thank you sir! 🙂
  • u

    user

    11/19/2021, 11:17 AM
    Hey there. Im using the nextjs-auth-tailwind example. For some reason when reloading / loading from url a page, the app redirects me to auth and auth redirects me back to index. These are the hooks that are responsible for it
    Copy code
    js
    export  const   RequireAuth =  () => {
      const { user } =  useUser()
      const router =  useRouter()
    
      useEffect(() => {
        if (!user) {
          var path = router.asPath
          console.log("redirecting to auth.js")
          router.push({pathname: '/auth',
            query: { reirectTo:  path}
          })
        }
      }, [user, router])
    }
    
    export const AuthRedirect = () => {
      console.log("Redirecting from auth.js to dashboard")
      const { user } = useUser()
      const router = useRouter()
    
      var redirectTo = router.query.reirectTo
      if(!redirectTo){
        redirectTo = "/"
      }
      useEffect(() => {
        if (user) {
          router.push(redirectTo)
        }
      }, [user, router])
    }
    As you can see it just redirects me almost instantly there and back.

    https://i.imgur.com/z6xxRPR.png▾

    My question would be: Why? And how can i stop this. Its pretty annoying and makes stuff load twice etc so it would be great to just not redirect every time.
  • e

    eMeRiKa

    11/19/2021, 3:33 PM
    how to debug sql queries? Is-it possible to see the query executed somewhere?
  • e

    Edgar

    11/19/2021, 4:15 PM
    Hi there! I decided to use Typescript for my project and I am having a problem: when I try to add metadata during user signup I got a Type error, does anyone knows how to fix it ?
  • c

    chipilov

    11/19/2021, 5:09 PM
    which version of @supabase/supabase-js are you using? I am using 1.27.0 and this works fine
  • e

    Edgar

    11/19/2021, 6:10 PM
    I am using 1.7.6
  • e

    Edgar

    11/19/2021, 6:11 PM
    I downloaded the latest
  • e

    Edgar

    11/19/2021, 6:12 PM
    at least that what my package.json says
  • c

    chipilov

    11/19/2021, 6:12 PM
    1.7.6 is from March, not sure why you think it's the latest
  • e

    Edgar

    11/19/2021, 6:12 PM
    Ah
  • c

    chipilov

    11/19/2021, 6:12 PM
    latest is 1.28.0
  • x

    Xzeta

    11/19/2021, 6:13 PM
    is there any notable changes in 1.28
  • e

    Edgar

    11/19/2021, 6:13 PM
    I just npm installed it
  • e

    Edgar

    11/19/2021, 6:13 PM
    I thought it was the latest
  • e

    Edgar

    11/19/2021, 6:14 PM
    I will try with the updated version 😅 Thanks a lot!
  • c

    chipilov

    11/19/2021, 6:14 PM
    don't know, I just saw it's the latest git tag in the repo
  • e

    Edgar

    11/19/2021, 6:15 PM
    I know why I have this version, I didn't check after cloning one of the example project
  • e

    Edgar

    11/19/2021, 6:23 PM
    It solved the problem thanks! ✅
  • m

    Mihai

    11/19/2021, 6:34 PM
    Hello, If I get a 500 error from auth service, where could I look into it to find what I've done wrong? I've checked the .env.local file and the keys are set correctly (error message : "500: Error sending confirmation mail")
    o
    • 2
    • 8
  • m

    Mihai

    11/19/2021, 6:46 PM
    Authentication Env Keys
1...323334...81Latest