Investigate Supabase connection issues

Investigate REST API and database connection failures despite successful authentication.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 12:28:18 +00:00
parent 6de30b681a
commit ae1db90d87
4 changed files with 207 additions and 28 deletions

View File

@@ -9,7 +9,14 @@ export const getSupabaseUrl = () => {
if (useProxy) {
// CORS 프록시 URL로 변환 (URL 구조 개선)
const cleanUrl = storedUrl.trim();
return `https://corsproxy.io/?${encodeURIComponent(cleanUrl)}`;
// URL에 이미 프로토콜이 포함되어 있는지 확인
const hasProtocol = cleanUrl.startsWith('http://') || cleanUrl.startsWith('https://');
const urlForProxy = hasProtocol ? cleanUrl : `http://${cleanUrl}`;
// 프록시 URL 생성 시 더 정확한 인코딩
const proxyUrl = `https://corsproxy.io/?${encodeURIComponent(urlForProxy)}`;
console.log('CORS 프록시 URL 생성:', proxyUrl);
return proxyUrl;
}
return storedUrl;
}
@@ -43,8 +50,13 @@ export const configureSupabase = (url: string, key: string, useProxy: boolean =
// URL 정리 (앞뒤 공백 제거)
const cleanUrl = url.trim();
// URL에 프로토콜이 없는 경우 http:// 추가
const normalizedUrl = (cleanUrl.startsWith('http://') || cleanUrl.startsWith('https://'))
? cleanUrl
: `http://${cleanUrl}`;
// 로컬 스토리지에 설정 저장
localStorage.setItem('supabase_url', cleanUrl);
localStorage.setItem('supabase_url', normalizedUrl);
localStorage.setItem('supabase_key', key);
localStorage.setItem('use_cors_proxy', useProxy.toString());