I got 'TypeError: fetch failed'
const supabaseAdmin = createClient(
supabaseUrl,
supabaseServiceKey,
{
auth: {
persistSession: false,
autoRefreshToken: false,
},
}
);
const { data: testConnection, error: connectionError } = await supabaseAdmin
.from('users')
.select('id')
.limit(1);
if (connectionError) {
console.error('Supabase connection error:', connectionError);
return NextResponse.json(
{ error: 'Database connection failed. Please ensure Supabase is running.' },
{ status: 503 }
);
}
This is my code.
but when I try to run this, I got the error.
How can I fix this problem?
Any help is thanks.
thanks.
supabaseUrl,
supabaseServiceKey,
{
auth: {
persistSession: false,
autoRefreshToken: false,
},
}
);
const { data: testConnection, error: connectionError } = await supabaseAdmin
.from('users')
.select('id')
.limit(1);
if (connectionError) {
console.error('Supabase connection error:', connectionError);
return NextResponse.json(
{ error: 'Database connection failed. Please ensure Supabase is running.' },
{ status: 503 }
);
}
This is my code.
but when I try to run this, I got the error.
How can I fix this problem?
Any help is thanks.
thanks.