chore: deployment debugging - minimal middleware, health api, and nextjs upgrade
This commit is contained in:
12
src/app/api/health/route.ts
Normal file
12
src/app/api/health/route.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
export async function GET() {
|
||||
return NextResponse.json({
|
||||
status: 'ok',
|
||||
time: new Date().toISOString(),
|
||||
env: {
|
||||
supabaseUrl: process.env.NEXT_PUBLIC_SUPABASE_URL ? 'set' : 'missing',
|
||||
supabaseAnonKey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ? 'set' : 'missing'
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3,23 +3,7 @@ import { NextResponse } from 'next/server';
|
||||
import type { NextRequest } from 'next/server';
|
||||
|
||||
export async function middleware(req: NextRequest) {
|
||||
const res = NextResponse.next();
|
||||
|
||||
// Safety check for environment variables in production
|
||||
if (!process.env.NEXT_PUBLIC_SUPABASE_URL || !process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY) {
|
||||
console.warn('Deployment: NEXT_PUBLIC_SUPABASE environment variables are missing.');
|
||||
return res;
|
||||
}
|
||||
|
||||
try {
|
||||
const supabase = createMiddlewareClient({ req, res });
|
||||
// Refresh session if expired - required for Server Components/Actions
|
||||
await supabase.auth.getSession();
|
||||
} catch (err) {
|
||||
console.error('Middleware Error:', err);
|
||||
}
|
||||
|
||||
return res;
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
export const config = {
|
||||
|
||||
Reference in New Issue
Block a user