chore: fix deployment eval error and add middleware safety checks

This commit is contained in:
2025-12-18 00:48:13 +01:00
parent 77814ea3cd
commit 728d53c121
9 changed files with 30 additions and 12 deletions

Binary file not shown.

View File

@@ -1 +1 @@
self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"tzCS672VOSUTB/WnuG1K69iPRI91ShQZ0kuJ2gcEeCo=\"\n}"
self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"VlJgjz0/FjDMFtnwSM+tocLhNpsMtoMH2qjhwNqZlS8=\"\n}"

View File

@@ -1,5 +1,5 @@
{
"node": {},
"edge": {},
"encryptionKey": "tzCS672VOSUTB/WnuG1K69iPRI91ShQZ0kuJ2gcEeCo="
"encryptionKey": "VlJgjz0/FjDMFtnwSM+tocLhNpsMtoMH2qjhwNqZlS8="
}

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +1,10 @@
/** @type {import('next').Config} */
const nextConfig = {
productionBrowserSourceMaps: false,
webpack: (config, { isServer }) => {
if (isServer) {
webpack: (config, { isServer, dev }) => {
// Disable source maps for the server build in production
// to prevent EvalError in strict environments (e.g. Coolify)
if (isServer && !dev) {
config.devtool = false;
}
return config;

View File

@@ -1,6 +1,12 @@
import { createClient } from '@supabase/supabase-js';
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!;
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!;
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
export const supabase = createClient(supabaseUrl, supabaseAnonKey);
if (!supabaseUrl || !supabaseAnonKey) {
console.error('Migration Error: Supabase credentials are not set.');
}
export const supabase = (supabaseUrl && supabaseAnonKey)
? createClient(supabaseUrl, supabaseAnonKey)
: null as any; // Fallback or handle null in services

View File

@@ -4,10 +4,20 @@ import type { NextRequest } from 'next/server';
export async function middleware(req: NextRequest) {
const res = NextResponse.next();
const supabase = createMiddlewareClient({ req, res });
// 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;
}