mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 14:05:24 +02:00
Fix Supabase LockManager timeout error
- Disable auth persistence in Supabase client - Set autoRefreshToken: false, persistSession: false - Prevents 'Acquiring an exclusive Navigator LockManager lock' timeout - Applied to both services/supabase.ts and api/experiments.ts Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
co-authored by
Qwen-Coder
parent
d535004a29
commit
8d05173b40
+7
-1
@@ -4,7 +4,13 @@ import { Experiment, ExperimentCreateInput } from '../types';
|
|||||||
|
|
||||||
const supabase = createClient(
|
const supabase = createClient(
|
||||||
process.env.SUPABASE_URL || '',
|
process.env.SUPABASE_URL || '',
|
||||||
process.env.SUPABASE_SERVICE_KEY || ''
|
process.env.SUPABASE_SERVICE_KEY || '',
|
||||||
|
{
|
||||||
|
auth: {
|
||||||
|
autoRefreshToken: false,
|
||||||
|
persistSession: false
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export default async function handler(req: VercelRequest, res: VercelResponse) {
|
export default async function handler(req: VercelRequest, res: VercelResponse) {
|
||||||
|
|||||||
@@ -14,7 +14,15 @@ const getClient = (): SupabaseClient => {
|
|||||||
if (!supabaseUrl || !supabaseAnonKey) {
|
if (!supabaseUrl || !supabaseAnonKey) {
|
||||||
throw new Error('Supabase credentials not configured. Add SUPABASE_URL and SUPABASE_ANON_KEY to environment variables.');
|
throw new Error('Supabase credentials not configured. Add SUPABASE_URL and SUPABASE_ANON_KEY to environment variables.');
|
||||||
}
|
}
|
||||||
_client = createClient(supabaseUrl, supabaseAnonKey);
|
// Disable auth persistence to avoid LockManager timeout issues
|
||||||
|
_client = createClient(supabaseUrl, supabaseAnonKey, {
|
||||||
|
auth: {
|
||||||
|
autoRefreshToken: false,
|
||||||
|
persistSession: false,
|
||||||
|
detectSessionInUrl: false,
|
||||||
|
storage: false as any
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return _client;
|
return _client;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user