chore: fix deployment eval error and add middleware safety checks
This commit is contained in:
BIN
.next/cache/webpack/client-development/0.pack.gz
vendored
BIN
.next/cache/webpack/client-development/0.pack.gz
vendored
Binary file not shown.
BIN
.next/cache/webpack/client-development/index.pack.gz
vendored
BIN
.next/cache/webpack/client-development/index.pack.gz
vendored
Binary file not shown.
Binary file not shown.
@@ -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}"
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"node": {},
|
"node": {},
|
||||||
"edge": {},
|
"edge": {},
|
||||||
"encryptionKey": "tzCS672VOSUTB/WnuG1K69iPRI91ShQZ0kuJ2gcEeCo="
|
"encryptionKey": "VlJgjz0/FjDMFtnwSM+tocLhNpsMtoMH2qjhwNqZlS8="
|
||||||
}
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,8 +1,10 @@
|
|||||||
/** @type {import('next').Config} */
|
/** @type {import('next').Config} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
productionBrowserSourceMaps: false,
|
productionBrowserSourceMaps: false,
|
||||||
webpack: (config, { isServer }) => {
|
webpack: (config, { isServer, dev }) => {
|
||||||
if (isServer) {
|
// Disable source maps for the server build in production
|
||||||
|
// to prevent EvalError in strict environments (e.g. Coolify)
|
||||||
|
if (isServer && !dev) {
|
||||||
config.devtool = false;
|
config.devtool = false;
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
import { createClient } from '@supabase/supabase-js';
|
import { createClient } from '@supabase/supabase-js';
|
||||||
|
|
||||||
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!;
|
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
|
||||||
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!;
|
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
|
||||||
|
|||||||
@@ -4,10 +4,20 @@ import type { NextRequest } from 'next/server';
|
|||||||
|
|
||||||
export async function middleware(req: NextRequest) {
|
export async function middleware(req: NextRequest) {
|
||||||
const res = NextResponse.next();
|
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
|
// Refresh session if expired - required for Server Components/Actions
|
||||||
await supabase.auth.getSession();
|
await supabase.auth.getSession();
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Middleware Error:', err);
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user