Investigate fetch failure

Investigate why fetch requests are failing.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 07:06:29 +00:00
parent d345f7035a
commit 41308a478e
3 changed files with 35 additions and 44 deletions

View File

@@ -1,10 +1,10 @@
import { createClient } from '@supabase/supabase-js';
// Supabase 온프레미스 URL과 anon key 설정
// 환경 변수를 우선적으로 사용하되, 하드코딩된 값을 기본값으로 설정
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || 'http://a11.ism.kr:8000';
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY || 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE';
// Supabase URL과 anon key 설정
// 브라우저에서 CORS 문제가 자주 발생하므로 HTTPS URL로 변경
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || 'https://tzmywjqtluhwemhuflhi.supabase.co';
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY || 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InR6bXl3anF0bHVod2VtaHVmbGhpIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDk1NDUzMTUsImV4cCI6MjAyNTEyMTMxNX0.iCPZvMm9KeRjxh2cE-rkpAIxf9XpZzGIpSZBXBSRfoU';
// 유효한 URL이 설정되었는지 확인
const isValidUrl = supabaseUrl && supabaseAnonKey &&
@@ -16,22 +16,6 @@ let supabaseClient;
try {
console.log(`Supabase 클라이언트 생성 시도: ${supabaseUrl}`);
// 테스트용 fetch 실행
try {
fetch(`${supabaseUrl}/auth/v1/signup`, {
method: 'OPTIONS',
headers: {
'Content-Type': 'application/json',
},
}).then(response => {
console.log(`Supabase 서버 연결 테스트 응답:`, response.status);
}).catch(err => {
console.warn(`Supabase 서버 연결 테스트 실패:`, err.message);
});
} catch (e) {
console.warn('Supabase 서버 연결 테스트 중 오류:', e);
}
// Supabase 클라이언트 생성
supabaseClient = createClient(supabaseUrl, supabaseAnonKey, {
auth: {