[object Object]

← back to Dear Bubbe Nextjs

fix(auth): surface NextAuth ?error= on signin page + pin turbopack root

2aee9f0ff05d051d12de2ed717856674928b4f05 · 2026-07-21 12:23:54 -0700 · Steve Abrams

Failed Google OAuth previously bounced back to /auth/signin silently (the
page ignored the error query param), making sign-in failures undiagnosable.
Now maps AccessDenied/OAuthCallback/OAuthSignin/Configuration to friendly
banners. turbopack.root + outputFileTracingRoot pinned so stray $HOME
lockfiles stop breaking/warning builds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Files touched

Diff

commit 2aee9f0ff05d051d12de2ed717856674928b4f05
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Jul 21 12:23:54 2026 -0700

    fix(auth): surface NextAuth ?error= on signin page + pin turbopack root
    
    Failed Google OAuth previously bounced back to /auth/signin silently (the
    page ignored the error query param), making sign-in failures undiagnosable.
    Now maps AccessDenied/OAuthCallback/OAuthSignin/Configuration to friendly
    banners. turbopack.root + outputFileTracingRoot pinned so stray $HOME
    lockfiles stop breaking/warning builds.
    
    Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---
 app/auth/signin/page.tsx | 32 ++++++++++++++++++++++++++++++++
 next.config.ts           |  5 ++++-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/app/auth/signin/page.tsx b/app/auth/signin/page.tsx
index 17a0efe..c9588f8 100644
--- a/app/auth/signin/page.tsx
+++ b/app/auth/signin/page.tsx
@@ -5,8 +5,32 @@ import { useState, useEffect } from 'react';
 import Image from 'next/image';
 import LoadingScreen from '@/components/LoadingScreen';
 
+// NextAuth bounces failed OAuth back here as ?error=<code>; without surfacing
+// it, a failed sign-in is a silent loop back to this page.
+const AUTH_ERROR_MESSAGES: Record<string, string> = {
+  AccessDenied:
+    "Google blocked the sign-in for this account. If Google showed an “Access blocked” page, the app hasn't been opened to all users yet — please try again later.",
+  OAuthCallback:
+    'Google sign-in could not be completed. Please try again — if it keeps happening, let us know.',
+  OAuthSignin:
+    'We could not start the Google sign-in. Please try again in a moment.',
+  Configuration:
+    'Sign-in is temporarily misconfigured on our side. Please try again later.',
+};
+
 export default function SignInPage() {
   const [isLoading, setIsLoading] = useState(false);
+  const [authError, setAuthError] = useState<string | null>(null);
+
+  useEffect(() => {
+    const code = new URLSearchParams(window.location.search).get('error');
+    if (code) {
+      setAuthError(
+        AUTH_ERROR_MESSAGES[code] ??
+          `Google sign-in failed (${code}). Please try again.`
+      );
+    }
+  }, []);
 
   const handleGoogleSignIn = async () => {
     setIsLoading(true);
@@ -46,6 +70,14 @@ export default function SignInPage() {
         </div>
 
         <div className="space-y-4">
+          {authError && (
+            <div
+              role="alert"
+              className="rounded-lg border border-red-300 bg-red-50 px-4 py-3 text-sm text-red-800"
+            >
+              {authError}
+            </div>
+          )}
           <p className="text-center text-gray-700 mb-6">
             Sign in so Bubbe knows who to guilt trip, bubbeleh!
           </p>
diff --git a/next.config.ts b/next.config.ts
index 935cb31..c0f7900 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -3,7 +3,10 @@ import type { NextConfig } from "next";
 const nextConfig: NextConfig = {
   // Configuration options
   // output: 'standalone', // disabled: pm2 runs `next start`, which needs a normal build + auto-loads .env.local
-  // outputFileTracingRoot: __dirname,
+  // Stray lockfiles in $HOME (Mac2 and Kamatera /root) make Turbopack mis-infer
+  // the workspace root; pin it or the build fails locally and warns on prod.
+  turbopack: { root: __dirname },
+  outputFileTracingRoot: __dirname,
   poweredByHeader: false,
   compress: true,
   

← 7b8743d auto-save: 2026-07-17T08:45:54 (1 files) — package-lock.json  ·  back to Dear Bubbe Nextjs  ·  fix(auth): route NextAuth errors to /auth/signin + Secure se e629a02 →