Skip to content

Commit 04c7cef

Browse files
[docs] fix(with-supabase): Update README env variables (#84745)
Closes #84734 Fixes environmental variable names in `with-supabase` example README to match the actual `.env.example` file. Updates `NEXT_PUBLIC_SUPABASE_ANON_KEY` to `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY` in two locations. --------- Co-authored-by: Joseph <[email protected]>
1 parent cf76c5b commit 04c7cef

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Update these with your Supabase details from your project settings > API
22
# https://app.supabase.com/project/_/settings/api
33
NEXT_PUBLIC_SUPABASE_URL=your-project-url
4-
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY=your-anon-key
4+
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-publishable-or-anon-key

examples/with-supabase/README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,16 @@ If you wish to just develop locally and not deploy to Vercel, [follow the steps
7575

7676
4. Rename `.env.example` to `.env.local` and update the following:
7777

78-
```
79-
NEXT_PUBLIC_SUPABASE_URL=[INSERT SUPABASE PROJECT URL]
80-
NEXT_PUBLIC_SUPABASE_ANON_KEY=[INSERT SUPABASE PROJECT API ANON KEY]
81-
```
82-
83-
Both `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_ANON_KEY` can be found in [your Supabase project's API settings](https://supabase.com/dashboard/project/_?showConnect=true)
78+
```env
79+
NEXT_PUBLIC_SUPABASE_URL=[INSERT SUPABASE PROJECT URL]
80+
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=[INSERT SUPABASE PROJECT API PUBLISHABLE OR ANON KEY]
81+
```
82+
> [!NOTE]
83+
> This example uses `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`, which refers to Supabase's new **publishable** key format.
84+
> Both legacy **anon** keys and new **publishable** keys can be used with this variable name during the transition period. Supabase's dashboard may show `NEXT_PUBLIC_SUPABASE_ANON_KEY`; its value can be used in this example.
85+
> See the [full announcement](https://github.com/orgs/supabase/discussions/29260) for more information.
86+
87+
Both `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` can be found in [your Supabase project's API settings](https://supabase.com/dashboard/project/_?showConnect=true)
8488

8589
5. You can now run the Next.js local development server:
8690

examples/with-supabase/lib/supabase/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { createBrowserClient } from "@supabase/ssr";
33
export function createClient() {
44
return createBrowserClient(
55
process.env.NEXT_PUBLIC_SUPABASE_URL!,
6-
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,
6+
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,
77
);
88
}

examples/with-supabase/lib/supabase/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export async function updateSession(request: NextRequest) {
1717
// variable. Always create a new one on each request.
1818
const supabase = createServerClient(
1919
process.env.NEXT_PUBLIC_SUPABASE_URL!,
20-
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,
20+
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,
2121
{
2222
cookies: {
2323
getAll() {

examples/with-supabase/lib/supabase/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export async function createClient() {
1111

1212
return createServerClient(
1313
process.env.NEXT_PUBLIC_SUPABASE_URL!,
14-
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,
14+
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,
1515
{
1616
cookies: {
1717
getAll() {

examples/with-supabase/lib/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export function cn(...inputs: ClassValue[]) {
88
// This check can be removed, it is just for tutorial purposes
99
export const hasEnvVars =
1010
process.env.NEXT_PUBLIC_SUPABASE_URL &&
11-
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY;
11+
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY;

0 commit comments

Comments
 (0)