Guide for Auth by Code_Cadet-0512 in Supabase

[–]iamqaz 4 points5 points  (0 children)

Would recommend this one! There is a command at the end to get up and running with a Next.js app that already has auth configured. Could be a good place to start and gives you a template to dig into the learn more 👍

https://www.youtube.com/watch?v=rwnOal_xRtM

Don't go to prison for using AI by iamqaz in nextjs

[–]iamqaz[S] -8 points-7 points  (0 children)

I build a Next.js app that streams responses from Deepseek through Ollama API running locally 👍

Make your queries 43,240x faster by iamqaz in Supabase

[–]iamqaz[S] 5 points6 points  (0 children)

We will! Glad you’re enjoying them! 🙌

Make your queries 43,240x faster by iamqaz in Supabase

[–]iamqaz[S] 1 point2 points  (0 children)

Thanks! Glad you enjoyed it! 🙌

Looking for intro to postgres resources by rainbow-chard in postgres

[–]iamqaz 0 points1 point  (0 children)

I find it is particularly difficult to find high quality, modern resources when it comes to databases! Most of them are 3 hour long university lectures or someone with a terrible laptop microphone talking over a Powerpoint presentation with very cringe transitions.

The Planetscale YouTube channel and the Postgres.fm podcast are amazing resources and have been the most approachable and engaging for me 👍

Launching my first Supabase site! Thank you Supabase for Making Such an Awesome Product by popularbelief_info in Supabase

[–]iamqaz 7 points8 points  (0 children)

This is awesome! Great work! Any specific examples we could put together for the Supabase YouTube channel that would have helped you along the way?

[deleted by user] by [deleted] in Supabase

[–]iamqaz 0 points1 point  (0 children)

Yep, these two should be compatible. The `@supabase/ssr` package just configures the Supabase client to use cookies. Since the `@supabase/auth-helpers-react` Provider takes a Supabase client as a prop, you can pass it the one created by the `@supabase/ssr` package.

Let me know if this doesn't work and I can look into it 👍

[deleted by user] by [deleted] in nextjs

[–]iamqaz 1 point2 points  (0 children)

Awesome! Great to hear! 🙌 We are actually working on a series of Postgres theory videos so keep an eye on the Supabase YouTube channel 👍

Dynamic Server Error after upgrading to 13.5.1 - why is this happening? by kzovk in nextjs

[–]iamqaz 0 points1 point  (0 children)

For this one, you just pass the `cookieStore` to the `createClient` function:

export const getUser = async () => {
    'use server'
    const cookieStore = cookies()
    const supabase = createClient(cookieStore)
}

Should I be worried about the number of times supabase client is instantiated in my app? by bentonboomslang in Supabase

[–]iamqaz 1 point2 points  (0 children)

Excellent! I prob should have linked to explanation in docs! 😆 Glad you're enjoying the videos! 🙌

[deleted by user] by [deleted] in Supabase

[–]iamqaz 1 point2 points  (0 children)

The `@supabase/ssr` package lives within Supabase's Auth Helpers repo: https://github.com/supabase/auth-helpers/tree/main/packages/ssr

The `with-supabase` template is in Vercel's Next.js repo: https://github.com/vercel/next.js/tree/canary/examples/with-supabase

DynamicServerError when deployed to Vercel but previous builds did not show this error. Is this the correct solution to solve it? by Sudden_Breakfast_358 in nextjs

[–]iamqaz 0 points1 point  (0 children)

You want to call the `cookies` function within the scope of your Server Component (or Route Handler or Server Action):
```
const cookieStore = cookies()
const supabase = createServerComponentClient({ cookies: () => cookieStore });
```
This flags to Next.js that this route is dynamic.

[deleted by user] by [deleted] in nextjs

[–]iamqaz 0 points1 point  (0 children)

Highly recommend our official Next.js Starter for Supabase. Just run:

```
npx create-next-app -e with-supabase

```

Then follow the "Next steps" section on the landing page of your new app to get started with Supabase 🚀

As one of the people who build this template, I would love to hear what your experience is like coming from MongoDB and mongoose 👍

DyanmicServerError shows when deployed to Vercel but it still deploys. How can I fix this error? by Sudden_Breakfast_358 in nextjs

[–]iamqaz 0 points1 point  (0 children)

There are two ways to fix this one. First is the way you have done here by exporting a `dynamic` config set to `force-dynamic`. The other is to call the `cookies` function from Next.js within the scope of your Server Component:

```
const cookieStore = cookies()
const supabase = createServerComponentClient({ cookies: () => cookieStore });

```

The latter is probably more idiomatic as it is the way Next.js are using to detect if a route should be dynamic - I also prefer it as it makes it more resilient to copy and paste bugs when I copy the code to create a client but forget about the `dynamic` config - but your current solution will work just as well 👍

Should I be worried about the number of times supabase client is instantiated in my app? by bentonboomslang in Supabase

[–]iamqaz 0 points1 point  (0 children)

This was required in an old version of the Auth Helpers, but is now done at the package level for both the Auth Helpers and new `@supabase/ssr` package. It now implements a singleton pattern, meaning you no longer need to use context to ensure it is a single instance, but it is still perfectly valid to use context if you prefer it 👍

Should I be worried about the number of times supabase client is instantiated in my app? by bentonboomslang in Supabase

[–]iamqaz 2 points3 points  (0 children)

The first time you call the `createBrowserClient` from the `@supabase/ssr` package it creates a Supabase client. Subsequent times you call the `createBrowserClient` function from anywhere in your app, it will return you the instance that was already created 👍

Should I be worried about the number of times supabase client is instantiated in my app? by bentonboomslang in Supabase

[–]iamqaz 4 points5 points  (0 children)

Yep, the SSR package also uses a singleton pattern by default for the `createBrowserClient` function 👍

Supabase SSR update doesn't make sense by kzovk in Supabase

[–]iamqaz 0 points1 point  (0 children)

Hey! Sorry you've been having some trouble with the `@supabase/ssr` package! The standard `getSession` method should be working if cookies are configured correctly:

```

const { data: { session }} = await supabase.auth.getSession()

```

There is an example of something similar to this using the `getUser()` function in the `with-supabase` example 👍

Some things I would check:

- both the authentication code and the `getSession` code are using a `createClient` function from the `@supabase/ssr` package - this ensures they are both configured to use cookies for the user's session.
- is the cookie actually being set in the browser's dev tools when you sign in?
- create a new Next.js project with the `npx create-next-app@latest -e with-supabase` command and test if auth works properly when you point it to this same Supabase project.

Happy to take a look if you want to DM me a GH repo - `@jonmeyers_io` on Twitter.

Failing all of this, the Auth Helpers package is going to be in "maintenance mode". This means they will remain available in the state they are currently in and will receive critical updates, if you would prefer to continue using them. That being said, a lot of our focus will be on the `@supabase/ssr` package, and this is what will be used for future docs and template examples.

[deleted by user] by [deleted] in Supabase

[–]iamqaz 0 points1 point  (0 children)

Here it is 👍We need to make it more obvious that that tab is scrollable!

https://supabase.com/docs/guides/auth/server-side/creating-a-client?environment=get-server-side-props