Unverified Commit 04c7cef9 authored by Carlo Quick's avatar Carlo Quick Committed by GitHub

[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: 's avatarJoseph <joseph.chamochumbi@vercel.com>
parent cf76c5b7
# Update these with your Supabase details from your project settings > API # Update these with your Supabase details from your project settings > API
# https://app.supabase.com/project/_/settings/api # https://app.supabase.com/project/_/settings/api
NEXT_PUBLIC_SUPABASE_URL=your-project-url NEXT_PUBLIC_SUPABASE_URL=your-project-url
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY=your-anon-key NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-publishable-or-anon-key
...@@ -75,12 +75,16 @@ If you wish to just develop locally and not deploy to Vercel, [follow the steps ...@@ -75,12 +75,16 @@ If you wish to just develop locally and not deploy to Vercel, [follow the steps
4. Rename `.env.example` to `.env.local` and update the following: 4. Rename `.env.example` to `.env.local` and update the following:
``` ```env
NEXT_PUBLIC_SUPABASE_URL=[INSERT SUPABASE PROJECT URL] NEXT_PUBLIC_SUPABASE_URL=[INSERT SUPABASE PROJECT URL]
NEXT_PUBLIC_SUPABASE_ANON_KEY=[INSERT SUPABASE PROJECT API ANON KEY] NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=[INSERT SUPABASE PROJECT API PUBLISHABLE OR ANON KEY]
``` ```
> [!NOTE]
> This example uses `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`, which refers to Supabase's new **publishable** key format.
> 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.
> See the [full announcement](https://github.com/orgs/supabase/discussions/29260) for more information.
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) 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)
5. You can now run the Next.js local development server: 5. You can now run the Next.js local development server:
......
...@@ -3,6 +3,6 @@ import { createBrowserClient } from "@supabase/ssr"; ...@@ -3,6 +3,6 @@ import { createBrowserClient } from "@supabase/ssr";
export function createClient() { export function createClient() {
return createBrowserClient( return createBrowserClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!, process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,
); );
} }
...@@ -17,7 +17,7 @@ export async function updateSession(request: NextRequest) { ...@@ -17,7 +17,7 @@ export async function updateSession(request: NextRequest) {
// variable. Always create a new one on each request. // variable. Always create a new one on each request.
const supabase = createServerClient( const supabase = createServerClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!, process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,
{ {
cookies: { cookies: {
getAll() { getAll() {
......
...@@ -11,7 +11,7 @@ export async function createClient() { ...@@ -11,7 +11,7 @@ export async function createClient() {
return createServerClient( return createServerClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!, process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,
{ {
cookies: { cookies: {
getAll() { getAll() {
......
...@@ -8,4 +8,4 @@ export function cn(...inputs: ClassValue[]) { ...@@ -8,4 +8,4 @@ export function cn(...inputs: ClassValue[]) {
// This check can be removed, it is just for tutorial purposes // This check can be removed, it is just for tutorial purposes
export const hasEnvVars = export const hasEnvVars =
process.env.NEXT_PUBLIC_SUPABASE_URL && process.env.NEXT_PUBLIC_SUPABASE_URL &&
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY; process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment