Skip to content

Revert "docs: Remove Auth Helpers" - #41383

Merged
ChrisChinchilla merged 1 commit into
masterfrom
revert-40986-chrischinchilla/remove-auth-helpers
Dec 16, 2025
Merged

ChrisChinchilla merged 1 commit into
masterfrom
revert-40986-chrischinchilla/remove-auth-helpers

Conversation

@ChrisChinchilla

@ChrisChinchilla ChrisChinchilla commented Dec 16, 2025 •

Copy link
Copy Markdown
Contributor

Reverts #40986 as redirects don't work and can only check in production :(

Summary by CodeRabbit

  • Documentation

    • Added comprehensive Auth UI guides for React and Flutter.
    • Published new authentication helpers guides for Next.js, Remix, and SvelteKit.
    • Added deprecation notices guiding users to @supabase/ssr package for server-side authentication.
  • Chores

    • Updated navigation menu to include new Auth UI documentation section.
    • Reorganized documentation URL routing for auth helpers guides.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel

vercel Bot commented Dec 16, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
docs Ready Ready Preview, Comment Dec 16, 2025 9:35am
zone-www-dot-com Ready Ready Preview, Comment Dec 16, 2025 9:35am
6 Skipped Deployments
Project Deployment Review Updated (UTC)
studio Ignored Ignored Dec 16, 2025 9:35am
cms Skipped Skipped Dec 16, 2025 9:35am
design-system Skipped Skipped Dec 16, 2025 9:35am
studio-self-hosted Skipped Skipped Dec 16, 2025 9:35am
studio-staging Skipped Skipped Dec 16, 2025 9:35am
ui-library Skipped Skipped Dec 16, 2025 9:35am

@supabase

supabase Bot commented Dec 16, 2025

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Dec 16, 2025
@coderabbitai

coderabbitai Bot commented Dec 16, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This PR adds comprehensive documentation for Supabase Auth Helpers across multiple frameworks (Next.js, Remix, SvelteKit) and introduces new Auth UI documentation for React and Flutter components. It includes deprecation notices directing users to the @supabase/ssr package, updates navigation structures to expose Auth UI sections, and adjusts redirect rules.

Changes

Cohort / File(s) Summary
Navigation & Menu Updates
apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
Adds new "Auth UI" subsection under Auth menu with enabled flag tied to allAuthProvidersEnabled, containing links to "Auth UI (Deprecated)" and "Flutter Auth UI" guides.
Documentation Partials
apps/docs/content/_partials/auth_helpers.mdx
Adds caution admonition indicating Auth Helpers package deprecation and directs users to @supabase/ssr package with migration documentation link.
Auth Helpers Overview
apps/docs/content/guides/auth/auth-helpers.mdx
New overview page for Auth Helpers with responsive grid containing ButtonCard links for Next.js, SvelteKit, and Remix helpers; includes deprecation status section and external resources.
Auth UI Documentation
apps/docs/content/guides/auth/auth-helpers/auth-ui.mdx, apps/docs/content/guides/auth/auth-helpers/flutter-auth-ui.mdx
New comprehensive guides for Auth UI React component (setup, theming, customization, views) and Flutter Auth UI package (installation, widget usage, initialization).
Framework-Specific Guides
apps/docs/content/guides/auth/auth-helpers/nextjs.mdx, apps/docs/content/guides/auth/auth-helpers/nextjs-pages.mdx, apps/docs/content/guides/auth/auth-helpers/remix.mdx, apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx
New extensive documentation pages for Auth Helpers integration across frameworks, including deprecation notices, migration guidance, installation, environment setup, authentication flows (client/server), and migration paths with JS/TS code examples.
Redirect Configuration
apps/www/lib/redirects.js
Updates existing auth-helpers redirect (source from catch-all pattern to specific auth-ui-overview path, destination to new auth-ui guide); adds new permanent redirect for nextjs-server-components to nextjs guide.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25–30 minutes

  • Framework-specific guides (nextjs.mdx, nextjs-pages.mdx, remix.mdx, sveltekit.mdx) contain extensive code examples across JavaScript and TypeScript with multiple authentication flows; verify technical accuracy and consistency of patterns
  • Cross-file deprecation messaging should be consistent and clear across all Auth Helpers documentation
  • Navigation constant and redirect rules must map correctly to new documentation file structure and paths

Possibly related PRs

  • docs: Remove Auth Helpers #40986: Both PRs modify the Auth Helpers documentation surface (NavigationMenu.constants.ts, auth-helpers MDX pages, and redirects), though with opposing intentions (this PR adds Auth UI docs/nav while the related PR removes them).

Suggested labels

documentation

Suggested reviewers

  • cemalkilic
  • awaseem

Poem

🐰 Auth docs hopping far and wide,
With Flutter, Next, and Remix in stride,
New UI guides and helpers true,
Migration paths for all that's new!
thump thump ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description does not follow the required template structure. It is missing required sections: confirmation of reading CONTRIBUTING.md, specification of change type, current behavior/linked issues, new behavior, and additional context. Fill out the required template sections including: 'I have read the CONTRIBUTING.md file' acknowledgment, change type classification, linked issues, detailed explanation of the new behavior, and any additional context about the revert.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Revert "docs: Remove Auth Helpers"' is a straightforward and specific summary of the primary action being taken in the changeset—reverting a previous documentation removal.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revert-40986-chrischinchilla/remove-auth-helpers

Comment @coderabbitai help to get the list of available commands and usage tips.

@ChrisChinchilla
ChrisChinchilla enabled auto-merge (squash) December 16, 2025 09:04

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (3)
apps/docs/content/guides/auth/auth-helpers/auth-ui.mdx (1)

60-67: JSX comment syntax in code blocks may confuse readers.

The code examples include JSX comment syntax {/* Apply predefined theme */} inline within props. While syntactically valid, this pattern is unusual and might confuse readers. Consider moving comments above the prop or removing them.

Also applies to: 162-169

apps/docs/content/guides/auth/auth-helpers/remix.mdx (1)

395-402: Unusual empty destructuring pattern.

The empty destructuring ({}: LoaderFunctionArgs) is non-standard. If the parameter isn't used, consider using _ or omitting the type annotation.

-export const loader = ({}: LoaderFunctionArgs) => {
+export const loader = (_args: LoaderFunctionArgs) => {
apps/docs/content/guides/auth/auth-helpers/flutter-auth-ui.mdx (1)

27-35: Consider clarifying dotenv dependency or using placeholder values.

The initialization example uses dotenv.get('SUPABASE_URL') which requires the flutter_dotenv package, but this dependency isn't mentioned in the installation section. Users unfamiliar with this pattern might encounter errors.

Consider either:

  1. Adding flutter_dotenv to the installation instructions
  2. Using placeholder strings like other Supabase docs typically do
 void main() async {
   await Supabase.initialize(
-    url: dotenv.get('SUPABASE_URL'),
-    anonKey: dotenv.get('SUPABASE_PUBLISHABLE_KEY'),
+    url: 'YOUR_SUPABASE_URL',
+    anonKey: 'YOUR_SUPABASE_ANON_KEY',
   );

   runApp(const MyApp());
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9274b81 and 42e09c0.

📒 Files selected for processing (10)
  • apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts (1 hunks)
  • apps/docs/content/_partials/auth_helpers.mdx (1 hunks)
  • apps/docs/content/guides/auth/auth-helpers.mdx (1 hunks)
  • apps/docs/content/guides/auth/auth-helpers/auth-ui.mdx (1 hunks)
  • apps/docs/content/guides/auth/auth-helpers/flutter-auth-ui.mdx (1 hunks)
  • apps/docs/content/guides/auth/auth-helpers/nextjs-pages.mdx (1 hunks)
  • apps/docs/content/guides/auth/auth-helpers/nextjs.mdx (1 hunks)
  • apps/docs/content/guides/auth/auth-helpers/remix.mdx (1 hunks)
  • apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx (1 hunks)
  • apps/www/lib/redirects.js (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-12-11T00:21:01.839Z
Learnt from: dnywh
Repo: supabase/supabase PR: 41215
File: apps/design-system/content/docs/accessibility.mdx:30-30
Timestamp: 2025-12-11T00:21:01.839Z
Learning: In apps/design-system/content/docs/, MDX files use different relative path formats based on their location: root-level docs use `components/button` format, while subdirectory docs (ui-patterns/, components/) use `../components/button` format for linking to components.

Applied to files:

  • apps/docs/content/guides/auth/auth-helpers/nextjs-pages.mdx
  • apps/docs/content/guides/auth/auth-helpers/auth-ui.mdx
📚 Learning: 2025-12-11T17:04:40.002Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.002Z
Learning: Applies to apps/studio/pages/**/*.{ts,tsx} : Use related layout components (e.g., AuthLayout) for pages within existing sections

Applied to files:

  • apps/docs/content/guides/auth/auth-helpers/nextjs-pages.mdx
  • apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx
📚 Learning: 2025-12-11T02:39:45.932Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/docs-graphql.mdc:0-0
Timestamp: 2025-12-11T02:39:45.932Z
Learning: Applies to apps/docs/resources/**/[!Schema]*Resolver.ts : Use `supabase()` client for database operations with `convertPostgrestToApiError` for error handling in GraphQL resolvers

Applied to files:

  • apps/docs/content/guides/auth/auth-helpers/nextjs-pages.mdx
🪛 LanguageTool
apps/docs/content/guides/auth/auth-helpers/remix.mdx

[uncategorized] ~11-~11: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...Use the new @supabase/ssr package for Server Side Authentication. @supabase/ssr takes t...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


[style] ~343-~343: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...ables are not available client-side, we need to plumb them through from the loader. <T...

(REP_NEED_TO_VB)

apps/docs/content/guides/auth/auth-helpers/nextjs-pages.mdx

[uncategorized] ~11-~11: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...Use the new @supabase/ssr package for Server Side Authentication. @supabase/ssr takes t...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


[grammar] ~242-~242: Use a hyphen to join words.
Context: ...nt-side data fetching with RLS For [row level security](/docs/learn/auth-deep-di...

(QB_NEW_EN_HYPHEN)


[grammar] ~291-~291: Use a hyphen to join words.
Context: ...r Supabase client to retrieve the logged in user's session: ```jsx pages/profile...

(QB_NEW_EN_HYPHEN)


[grammar] ~326-~326: Use a hyphen to join words.
Context: ...e the server Supabase client to run [row level security](/docs/learn/auth-deep-di...

(QB_NEW_EN_HYPHEN)


[grammar] ~548-~548: Use a hyphen to join words.
Context: ...r Supabase client to retrieve the logged in user's session: <Tabs scrollable ...

(QB_NEW_EN_HYPHEN)


[grammar] ~688-~688: Use a hyphen to join words.
Context: ...geAuth, and withMiddlewareAuth` higher order functions as deprecated and they w...

(QB_NEW_EN_HYPHEN)

apps/docs/content/guides/auth/auth-helpers.mdx

[uncategorized] ~45-~45: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...Use the new @supabase/ssr package for Server Side Authentication. Use the [migration doc]...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

apps/docs/content/guides/auth/auth-helpers/auth-ui.mdx

[style] ~10-~10: For conciseness, consider replacing this expression with an adverb.
Context: ...longer maintained by the Supabase Team. At the moment, the team does not have capacity to giv...

(AT_THE_MOMENT)


[grammar] ~12-~12: Use a hyphen to join words.
Context: ...Supabase UI Library](/ui) which has auth ready blocks to use in your projects. <...

(QB_NEW_EN_HYPHEN)


[style] ~135-~135: Try using a more formal synonym here to elevate your writing.
Context: ...pdate password - Forgotten password We are planning on adding more views in the future. Follow along ...

(PLAN_ON_INTEND)


[grammar] ~483-~483: Use a hyphen to join words.
Context: ... email - Forgot your password? ### Sign in and sign up views Add sign_in or `...

(QB_NEW_EN_HYPHEN)


[grammar] ~483-~483: Use a hyphen to join words.
Context: ...got your password? ### Sign in and sign up views Add sign_in or sign_up vie...

(QB_NEW_EN_HYPHEN)

apps/docs/content/guides/auth/auth-helpers/flutter-auth-ui.mdx

[grammar] ~39-~39: Ensure spelling is correct
Context: ... widget to create an email and password signin and signup form. It also contains a but...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~66-~66: Ensure spelling is correct
Context: ...agicAuth` widget to create a magic link signIn form. ```dart SupaMagicAuth( redirec...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

apps/docs/content/guides/auth/auth-helpers/nextjs.mdx

[uncategorized] ~11-~11: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...Use the new @supabase/ssr package for Server Side Authentication. @supabase/ssr takes t...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


[style] ~253-~253: Consider removing “of” to be more concise
Context: .../auth/auth-helpers/nextjs#server-side). All of the [supabase-js authentication strategies]...

(ALL_OF_THE)


[grammar] ~401-~401: Use a hyphen to join words.
Context: ...rocess from form submissions. #### Sign up route <Tabs scrollable size="sma...

(QB_NEW_EN_HYPHEN)


[style] ~803-~803: Consider a more concise word here.
Context: ...server-side. In order to use Supabase in Server Components, you ...

(IN_ORDER_TO_PREMIUM)

apps/docs/content/_partials/auth_helpers.mdx

[uncategorized] ~3-~3: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...Use the new @supabase/ssr package for Server Side Authentication. @supabase/ssr takes t...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx

[uncategorized] ~11-~11: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...Use the new @supabase/ssr package for Server Side Authentication. @supabase/ssr takes t...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


[style] ~215-~215: Consider a more concise word here.
Context: ... ### Generate types from your database In order to get the most out of TypeScript and its ...

(IN_ORDER_TO_PREMIUM)


[style] ~242-~242: Consider removing “of” to be more concise
Context: ...th/auth-helpers/sveltekit#server-side). All of the [supabase-js authentication strategies]...

(ALL_OF_THE)


[style] ~386-~386: Consider a more concise word here.
Context: ...tener in the root +layout.svelte file in order to catch Supabase events being triggered. ...

(IN_ORDER_TO_PREMIUM)


[grammar] ~788-~788: Use a hyphen to join words.
Context: ...nt-side data fetching with RLS For [row level security](/docs/guides/database/po...

(QB_NEW_EN_HYPHEN)


[style] ~918-~918: This phrase is redundant. Consider using “inside”.
Context: ...etup our Supabase client for the server inside of a hooks.server.ts file. <Tabs scro...

(OUTSIDE_OF)


[style] ~989-~989: Consider a more concise word here.
Context: ... client [#migration-initialize-client] In order to use the Supabase library in your client...

(IN_ORDER_TO_PREMIUM)


[grammar] ~1085-~1085: Use a hyphen to join words.
Context: ...s.client.ts` in our project for Supabase related code. #### Types [#migration-ty...

(QB_NEW_EN_HYPHEN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: typecheck
🔇 Additional comments (10)
apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx (1)

9-13: Clear deprecation notice.

The deprecation warning is prominently placed and provides a migration path to @supabase/ssr. Good documentation practice for legacy content.

apps/docs/content/guides/auth/auth-helpers/nextjs.mdx (1)

59-61: Non-standard environment variable naming.

The documentation uses NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY but the standard Supabase convention is NEXT_PUBLIC_SUPABASE_ANON_KEY. This inconsistency could confuse users following other Supabase documentation.

Please verify whether this naming convention is intentional for this documentation or should be aligned with the standard NEXT_PUBLIC_SUPABASE_ANON_KEY used elsewhere in Supabase docs.

apps/docs/content/guides/auth/auth-helpers.mdx (1)

1-50: LGTM!

The overview page is well-structured with clear navigation to framework-specific guides and consistent deprecation messaging.

apps/docs/content/guides/auth/auth-helpers/remix.mdx (1)

1-855: LGTM overall!

The Remix Auth Helpers documentation is comprehensive with good coverage of server-side and client-side patterns. The deprecation notice is clear and provides migration guidance.

apps/docs/content/guides/auth/auth-helpers/auth-ui.mdx (1)

129-135: Fix broken relative links in Auth UI documentation.

The relative links at lines 129-135 contain two broken references:

  • ../auth-email should be ../auth-email-passwordless (the actual filename)
  • ../auth-magic-link has no corresponding file and should be removed or updated

The ../social-login link is correct and resolves properly.

⛔ Skipped due to learnings
Learnt from: dnywh
Repo: supabase/supabase PR: 41215
File: apps/design-system/content/docs/accessibility.mdx:30-30
Timestamp: 2025-12-11T00:21:01.839Z
Learning: In apps/design-system/content/docs/, MDX files use different relative path formats based on their location: root-level docs use `components/button` format, while subdirectory docs (ui-patterns/, components/) use `../components/button` format for linking to components.
apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts (1)

916-927: LGTM - Auth UI navigation section follows existing patterns.

The navigation structure correctly adds the Auth UI subsection with proper enabled flag and follows the established conventions for section headers with url: undefined.

apps/www/lib/redirects.js (2)

1302-1305: Redirect change correctly supports restored documentation.

The change from the wildcard pattern /docs/guides/auth/auth-helpers/:path* to the specific path /docs/guides/auth/auth-helpers/auth-ui-overview is appropriate. The wildcard would have redirected all auth-helpers subpaths (including the newly restored pages) to the migration guide, which would break the restored documentation.


2160-2164: New redirect for Next.js server components consolidation looks correct.

This permanent redirect consolidates the nextjs-server-components path to the main nextjs auth-helpers page.

apps/docs/content/guides/auth/auth-helpers/nextjs-pages.mdx (1)

9-15: Deprecation notice is clear and helpful.

The admonition properly warns users about the deprecated package and provides clear migration guidance with links to the new @supabase/ssr package and the Next.js Server-Side Auth guide.

apps/docs/content/guides/auth/auth-helpers/flutter-auth-ui.mdx (1)

99-118: Review the link target carefully—the #providers anchor depends on partial template rendering.

The relative path ../../auth#providers correctly resolves to guides/auth.mdx. However, the auth.mdx file uses a conditional partial include for providers content. The #providers anchor exists in _partials/providers.mdx (as ## Providers), not directly in auth.mdx. Verify that the documentation build system properly renders this conditional partial and generates the anchor at the expected location when the link is followed.

@@ -0,0 +1,5 @@
<Admonition type="caution">

The Auth helpers package is deprecated. Use the new `@supabase/ssr` package for Server Side Authentication. `@supabase/ssr` takes the core concepts of the Auth Helpers package and makes them available to any server framework. Read out the [migration doc](/docs/guides/auth/server-side/migrating-to-ssr-from-auth-helpers) to learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Typo: "Read out the" should be "Read the".

-The Auth helpers package is deprecated. Use the new `@supabase/ssr` package for Server Side Authentication. `@supabase/ssr` takes the core concepts of the Auth Helpers package and makes them available to any server framework. Read out the [migration doc](/docs/guides/auth/server-side/migrating-to-ssr-from-auth-helpers) to learn more.
+The Auth helpers package is deprecated. Use the new `@supabase/ssr` package for Server-Side Authentication. `@supabase/ssr` takes the core concepts of the Auth Helpers package and makes them available to any server framework. Read the [migration doc](/docs/guides/auth/server-side/migrating-to-ssr-from-auth-helpers) to learn more.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The Auth helpers package is deprecated. Use the new `@supabase/ssr` package for Server Side Authentication. `@supabase/ssr` takes the core concepts of the Auth Helpers package and makes them available to any server framework. Read out the [migration doc](/docs/guides/auth/server-side/migrating-to-ssr-from-auth-helpers) to learn more.
The Auth helpers package is deprecated. Use the new `@supabase/ssr` package for Server-Side Authentication. `@supabase/ssr` takes the core concepts of the Auth Helpers package and makes them available to any server framework. Read the [migration doc](/docs/guides/auth/server-side/migrating-to-ssr-from-auth-helpers) to learn more.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~3-~3: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...Use the new @supabase/ssr package for Server Side Authentication. @supabase/ssr takes t...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🤖 Prompt for AI Agents
In apps/docs/content/_partials/auth_helpers.mdx around line 3, the sentence
contains a typo: "Read out the [migration doc]..." should be corrected to "Read
the [migration doc]..."; update the text to remove "out" so it reads "Read the
[migration
doc](/docs/guides/auth/server-side/migrating-to-ssr-from-auth-helpers) to learn
more."

Comment on lines +354 to +365
const {
data: { user },
} = await supabase.auth.getUser()

if (!session)
return {
redirect: {
destination: '/',
permanent: false,
},
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Bug: Undefined variable session in code example.

The code destructures user from supabase.auth.getUser() on lines 354-356, but line 358 checks if (!session) which is undefined. This should check if (!user) instead.

   const {
     data: { user },
   } = await supabase.auth.getUser()

-  if (!session)
+  if (!user)
     return {
       redirect: {
         destination: '/',
         permanent: false,
       },
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const {
data: { user },
} = await supabase.auth.getUser()
if (!session)
return {
redirect: {
destination: '/',
permanent: false,
},
}
const {
data: { user },
} = await supabase.auth.getUser()
if (!user)
return {
redirect: {
destination: '/',
permanent: false,
},
}
🤖 Prompt for AI Agents
In apps/docs/content/guides/auth/auth-helpers/nextjs-pages.mdx around lines 354
to 365, the example checks an undefined variable `session`; replace that check
with `if (!user)` (or otherwise verify the correct variable from
supabase.auth.getUser()) so the guard uses the destructured `user` value
returned above and returns the redirect when the user is missing.

Comment on lines +796 to +803

return {
props: {
initialSession: session,
user: session.user,
},
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Bug: References undefined session variable in migration example.

The migration example retrieves user from supabase.auth.getUser() but the props reference session and session.user which are undefined.

   return {
     props: {
-      initialSession: session,
-      user: session.user,
+      initialSession: null,
+      user,
     },
   }

Alternatively, if initialSession is needed, the code should call supabase.auth.getSession() instead of getUser().

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return {
props: {
initialSession: session,
user: session.user,
},
}
}
return {
props: {
initialSession: null,
user,
},
}
}
🤖 Prompt for AI Agents
In apps/docs/content/guides/auth/auth-helpers/nextjs-pages.mdx around lines
796-803, the returned props reference a nonexistent session variable
(initialSession: session, user: session.user) even though the example called
supabase.auth.getUser(); fix by either (A) if you only fetched the user, return
props: { user } (rename the variable to user or destructure from getUser
response) and remove initialSession, or (B) if initialSession is required, call
supabase.auth.getSession() instead of getUser() and then return initialSession:
session and user: session.user; update variable names accordingly so props refer
to defined locals.

Comment on lines +86 to +96
export async function middleware(req) {
const res = NextResponse.next()

// Create a Supabase client configured to use cookies
const supabase = createMiddlewareClient({ req, res })

// Refresh session if expired - required for Server Components
await supabase.auth.getUser()

return res
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistency between JS and TS middleware examples.

The JavaScript example uses supabase.auth.getUser() (Line 93) while the TypeScript example uses supabase.auth.getSession() (Line 133). Both should use the same method for consistency. The getUser() approach is generally preferred as it validates the session with the server.

// In the TypeScript example (line 133)
-  await supabase.auth.getSession()
+  await supabase.auth.getUser()

Also applies to: 119-136

🤖 Prompt for AI Agents
In apps/docs/content/guides/auth/auth-helpers/nextjs.mdx around lines 86-96 and
119-136, the JS and TS middleware examples are inconsistent: the JS example
calls supabase.auth.getUser() while the TS example calls
supabase.auth.getSession(). Replace the getSession() call(s) in the TypeScript
example with supabase.auth.getUser() so both examples use the same
server-validated method, and ensure any TypeScript typings/await handling
reflect getUser()'s return shape.

Comment on lines +875 to +879
<Admonition type="note">

Next.js Server Actions are currently in `alpha` so may change without notice.

</Admonition>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Outdated information: Server Actions are no longer in alpha.

Server Actions became stable in Next.js 14. This note about them being in "alpha" is outdated and may confuse readers.

-<Admonition type="note">
-
-Next.js Server Actions are currently in `alpha` so may change without notice.
-
-</Admonition>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Admonition type="note">
Next.js Server Actions are currently in `alpha` so may change without notice.
</Admonition>
🤖 Prompt for AI Agents
In apps/docs/content/guides/auth/auth-helpers/nextjs.mdx around lines 875 to
879, the Admonition states Server Actions are in "alpha" which is outdated;
update the note to reflect that Server Actions are stable as of Next.js 14 (or
remove the alpha warning). Replace the admonition text with an accurate, concise
statement such as noting that Server Actions are stable in Next.js 14 (and
optionally link to Next.js docs/CHANGELOG), and ensure the phrasing does not
imply they are experimental.

Comment on lines +552 to +566
useEffect(() => {
const {
data: { subscription },
} = supabase.auth.onAuthStateChange((event, session) => {
if (session?.access_token !== serverAccessToken) {
// server and client are out of sync.
revalidate()
}
})

return () => {
subscription.unsubscribe()
}
}, [serverAccessToken, supabase, revalidate])
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistency between JS and TS examples in auth state change handling.

The TypeScript example (Line 586) includes a check for event !== 'INITIAL_SESSION' to avoid unnecessary revalidation, but the JavaScript example (Line 556) lacks this check. This could cause the JS implementation to revalidate on initial load unnecessarily.

// In the JavaScript example (around line 555-556)
-  } = supabase.auth.onAuthStateChange((event, session) => {
-    if (session?.access_token !== serverAccessToken) {
+  } = supabase.auth.onAuthStateChange((event, session) => {
+    if (event !== 'INITIAL_SESSION' && session?.access_token !== serverAccessToken) {

Also applies to: 582-596

🤖 Prompt for AI Agents
In apps/docs/content/guides/auth/auth-helpers/remix.mdx around lines 552-566
(and similarly apply to lines 582-596), the JavaScript useEffect handling
supabase.auth.onAuthStateChange is missing the TypeScript check for event !==
'INITIAL_SESSION'; update the JS example to only call revalidate when the event
is not 'INITIAL_SESSION' and when the session access token differs from the
serverAccessToken, and ensure the cleanup still unsubscribes the subscription;
mirror the same conditional logic used in the TypeScript example to avoid
unnecessary revalidation on initial load.

Comment on lines +83 to +96
event.locals.safeGetSession = async () => {
const {
data: { user },
error,
} = await supabase.auth.getUser()
if (error) {
return { session: null, user: null }
}

const {
data: { session },
} = await event.locals.supabase.auth.getSession()
return { session, user }
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Undefined variable supabase in safeGetSession function.

Line 87 references supabase.auth.getUser(), but the variable supabase is not defined in this scope. It should reference event.locals.supabase instead. Users copying this code will encounter a ReferenceError at runtime.

Apply this diff to fix the undefined variable:

   event.locals.safeGetSession = async () => {
     const {
       data: { user },
       error,
-    } = await supabase.auth.getUser()
+    } = await event.locals.supabase.auth.getUser()
     if (error) {
       return { session: null, user: null }
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
event.locals.safeGetSession = async () => {
const {
data: { user },
error,
} = await supabase.auth.getUser()
if (error) {
return { session: null, user: null }
}
const {
data: { session },
} = await event.locals.supabase.auth.getSession()
return { session, user }
}
event.locals.safeGetSession = async () => {
const {
data: { user },
error,
} = await event.locals.supabase.auth.getUser()
if (error) {
return { session: null, user: null }
}
const {
data: { session },
} = await event.locals.supabase.auth.getSession()
return { session, user }
}
🤖 Prompt for AI Agents
In apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx around lines 83 to
96, the safeGetSession function references an undefined variable supabase
(supabase.auth.getUser()); change that call to use
event.locals.supabase.auth.getUser() so it uses the local Supabase client in
this scope, ensuring both user and session calls consistently reference
event.locals.supabase and avoid the ReferenceError at runtime.

Comment on lines +130 to +143
event.locals.safeGetSession = async () => {
const {
data: { user },
error,
} = await supabase.auth.getUser()
if (error) {
return { session: null, user: null }
}

const {
data: { session },
} = await event.locals.supabase.auth.getSession()
return { session, user }
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Undefined variable supabase in safeGetSession function.

Line 134 has the same issue as the JavaScript example above. The variable supabase is not defined in this scope and should reference event.locals.supabase.

Apply this diff to fix the undefined variable:

   event.locals.safeGetSession = async () => {
     const {
       data: { user },
       error,
-    } = await supabase.auth.getUser()
+    } = await event.locals.supabase.auth.getUser()
     if (error) {
       return { session: null, user: null }
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
event.locals.safeGetSession = async () => {
const {
data: { user },
error,
} = await supabase.auth.getUser()
if (error) {
return { session: null, user: null }
}
const {
data: { session },
} = await event.locals.supabase.auth.getSession()
return { session, user }
}
event.locals.safeGetSession = async () => {
const {
data: { user },
error,
} = await event.locals.supabase.auth.getUser()
if (error) {
return { session: null, user: null }
}
const {
data: { session },
} = await event.locals.supabase.auth.getSession()
return { session, user }
}
🤖 Prompt for AI Agents
In apps/docs/content/guides/auth/auth-helpers/sveltekit.mdx around lines 130 to
143, the safeGetSession function references an undefined variable supabase;
replace those references with event.locals.supabase (i.e., call
event.locals.supabase.auth.getUser() instead of supabase.auth.getUser(), and
ensure any other supabase uses in that function use event.locals.supabase) so
the function uses the injected supabase client from event.locals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants