Investigate login/register 404 errors

Investigate and address persistent 404 errors occurring during login and registration processes.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 15:01:48 +00:00
parent a32eb26105
commit e52ca26cef
7 changed files with 223 additions and 75 deletions

View File

@@ -60,30 +60,57 @@ export const verifyServerConnection = async (): Promise<{
const supabaseUrl = supabase.auth.url;
// 단순 헬스 체크 요청
const response = await fetch(`${supabaseUrl}/`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
// 연결 확인만을 위한 요청이므로 짧은 타임아웃 설정
signal: AbortSignal.timeout(3000)
});
try {
const response = await fetch(`${supabaseUrl}/`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
// 연결 확인만을 위한 요청이므로 짧은 타임아웃 설정
signal: AbortSignal.timeout(3000)
});
const elapsed = Date.now() - start;
// 200, 401, 404 응답도 서버가 살아있다는 신호로 간주
if (response.ok || response.status === 401 || response.status === 404) {
return {
connected: true,
message: `서버 연결 성공 (응답 시간: ${elapsed}ms)`,
statusCode: response.status
};
} else {
return {
connected: false,
message: `서버 응답 오류: ${response.status} ${response.statusText}`,
statusCode: response.status
};
}
} catch (fetchError: any) {
console.error('기본 연결 확인 실패, 대체 경로 시도:', fetchError);
const elapsed = Date.now() - start;
if (response.ok || response.status === 401) {
// 401도 서버가 응답했다는 의미이므로 연결 성공으로 간주
return {
connected: true,
message: `서버 연결 성공 (응답 시간: ${elapsed}ms)`,
statusCode: response.status
};
} else {
return {
connected: false,
message: `서버 응답 오류: ${response.status} ${response.statusText}`,
statusCode: response.status
};
// 대체 경로로 재시도
try {
const altResponse = await fetch(`${supabaseUrl}/auth/v1/`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
signal: AbortSignal.timeout(3000)
});
// 어떤 응답이라도 오면 서버가 살아있다고 간주
const elapsed = Date.now() - start;
return {
connected: true,
message: `서버 연결 성공 (대체 경로, 응답 시간: ${elapsed}ms)`,
statusCode: altResponse.status
};
} catch (altError) {
// 두 가지 경로 모두 실패
console.error('대체 경로 확인도 실패:', altError);
throw fetchError; // 원래 에러를 던짐
}
}
} catch (error: any) {
console.error('서버 연결 확인 중 오류:', error);