Remove on-premise Supabase test code

Remove code related to on-premise Supabase testing.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 22:35:44 +00:00
parent af52ec897f
commit 439653fa2f
25 changed files with 8 additions and 1080 deletions

View File

@@ -18,14 +18,7 @@ try {
}
});
console.log('Supabase Cloud 클라이언트가 생성되었습니다.');
// 연결 테스트 - 별도 파일로 이동됨
import('./connectionTest').then(module => {
module.testConnection(supabaseClient, supabaseUrl, supabaseAnonKey);
}).catch(err => {
console.error('연결 테스트 모듈 로딩 오류:', err);
});
console.log('Supabase 클라이언트가 생성되었습니다.');
} catch (error) {
console.error('Supabase 클라이언트 생성 오류:', error);

View File

@@ -1,17 +1,10 @@
// Supabase Cloud URL과 anon key 설정 (고정값 사용)
// Supabase Cloud URL과 anon key 설정
export const getSupabaseUrl = () => {
// Supabase Cloud URL 사용
return "https://qnerebtvwwfobfzdoftx.supabase.co";
};
// 원본 URL 반환
export const getOriginalSupabaseUrl = () => {
return "https://qnerebtvwwfobfzdoftx.supabase.co";
};
export const getSupabaseKey = () => {
// Supabase Cloud anon key 사용
return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFuZXJlYnR2d3dmb2JmemRvZnR4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDIwNTE0MzgsImV4cCI6MjA1NzYyNzQzOH0.Wm7h2DUhoQbeANuEM3wm2tz22ITrVEW8FizyLgIVmv8";
};
@@ -19,29 +12,3 @@ export const getSupabaseKey = () => {
export const isValidSupabaseKey = () => {
return true; // Supabase Cloud에서는 항상 유효함
};
// CORS 프록시 관련 함수들 (Supabase Cloud에서는 필요 없음)
export const useCorsProxy = (enabled: boolean) => {
return false; // Supabase Cloud에서는 항상 비활성화
};
export const setProxyType = (proxyType: string) => {
// Supabase Cloud에서는 아무 작업도 하지 않음
};
export const getProxyType = () => {
return 'none'; // Supabase Cloud에서는 프록시 사용 안함
};
export const isCorsProxyEnabled = () => {
return false; // Supabase Cloud에서는 항상 false
};
// 구성 도우미 함수 - Cloud 환경에서는 단순화
export const configureSupabase = (url: string, key: string, useProxy: boolean = false, proxyType: string = 'none') => {
console.log('Supabase Cloud를 사용 중이므로 설정이 무시됩니다');
// 실제 설정은 변경되지 않음 (Cloud URL 및 키는 고정)
// 페이지 새로고침
window.location.reload();
};

View File

@@ -1,69 +0,0 @@
import { SupabaseClient } from '@supabase/supabase-js';
/**
* Supabase 연결 테스트
*/
export async function testConnection(
supabaseClient: SupabaseClient,
supabaseUrl: string,
supabaseAnonKey: string
): Promise<void> {
// CORS 문제 확인을 위한 기본 헤더 테스트
try {
// 기본 서버 상태 확인 (CORS 테스트)
console.log('Supabase 서버 상태 확인 중...');
const response = await fetch(`${supabaseUrl}/auth/v1/`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'apikey': supabaseAnonKey,
},
});
if (response.ok || response.status === 401 || response.status === 404) {
console.log('Supabase 서버 연결 성공:', response.status);
} else {
console.warn('Supabase 서버 연결 실패:', response.status, response.statusText);
// 응답 세부 정보 로깅
try {
const errorText = await response.text();
console.warn('Supabase 서버 응답 내용:', errorText);
} catch (e) {
console.error('응답 내용 읽기 실패:', e);
}
}
} catch (err) {
console.error('Supabase 서버 상태 확인 중 오류 (CORS 문제 가능성):', err);
}
// Supabase 연결 테스트
try {
console.log('Supabase 인증 테스트 시도 중...');
const { data, error } = await supabaseClient.auth.getSession();
if (error) {
console.warn('Supabase 연결 테스트 실패:', error.message);
} else {
console.log('Supabase 연결 성공!', data);
}
// 추가 테스트: 공개 데이터 조회 시도
try {
console.log('Supabase 데이터베이스 공개 테이블 조회 시도...');
const { data: tableData, error: tableError } = await supabaseClient
.from('transactions')
.select('*')
.limit(1);
if (tableError) {
console.warn('Supabase 데이터베이스 테스트 실패:', tableError.message);
} else {
console.log('Supabase 데이터베이스 테스트 성공:', tableData);
}
} catch (dbErr) {
console.error('Supabase 데이터베이스 테스트 중 예외 발생:', dbErr);
}
} catch (err) {
console.error('Supabase 연결 확인 중 오류:', err);
}
}

View File

@@ -1,19 +1,15 @@
import { supabase, isValidUrl } from './client';
import { testSupabaseConnection } from './tests';
import { createRequiredTables, checkTablesStatus } from './setup';
import { customFetch } from './customFetch';
import { modifyStorageApiRequest, getStorageApiHeaders } from './storageUtils';
import { testConnection } from './connectionTest';
export {
supabase,
isValidUrl,
testSupabaseConnection,
createRequiredTables,
checkTablesStatus,
customFetch,
modifyStorageApiRequest,
getStorageApiHeaders,
testConnection
getStorageApiHeaders
};

View File

@@ -13,7 +13,7 @@ export const createRequiredTables = async (): Promise<{ success: boolean; messag
// 테이블 상태 확인
const tablesStatus = await checkTablesStatus();
if (tablesStatus.transactions && tablesStatus.budgets) {
if (tablesStatus.transactions && tablesStatus.budgets && tablesStatus.category_budgets) {
return {
success: true,
message: '필요한 테이블이 이미 존재합니다.'
@@ -21,8 +21,8 @@ export const createRequiredTables = async (): Promise<{ success: boolean; messag
}
return {
success: true,
message: '테이블이 성공적으로 생성되었습니다.'
success: false,
message: '일부 필요한 테이블이 없습니다. Supabase 대시보드에서 확인해주세요.'
};
} catch (error: any) {
console.error('테이블 확인 중 오류 발생:', error);

View File

@@ -43,46 +43,3 @@ export const checkTablesStatus = async (): Promise<{
return tables;
}
};
/**
* 기존 테이블 목록을 가져옵니다.
* 참고: get_tables 함수는 사용하지 않음
*/
export const getExistingTables = async (): Promise<string[] | null> => {
try {
const tables = [];
// 직접 각 테이블 확인
const { error: transactionsError } = await supabase
.from('transactions')
.select('id')
.limit(1);
if (!transactionsError) {
tables.push('transactions');
}
const { error: budgetsError } = await supabase
.from('budgets')
.select('id')
.limit(1);
if (!budgetsError) {
tables.push('budgets');
}
const { error: categoryBudgetsError } = await supabase
.from('category_budgets')
.select('id')
.limit(1);
if (!categoryBudgetsError) {
tables.push('category_budgets');
}
return tables;
} catch (error) {
console.error('테이블 목록 확인 중 오류 발생:', error);
return null;
}
};

View File

@@ -1,93 +0,0 @@
import { testAuth } from './authTests';
import { testRestApi } from './apiTests';
import { testDatabaseConnection } from './databaseTests';
import { TestResults, TestDebugInfo } from './types';
import { supabase, isValidUrl } from '../client';
import { getSupabaseUrl, getSupabaseKey, isCorsProxyEnabled, getProxyType } from '../config';
export const testSupabaseConnection = async (): Promise<TestResults> => {
// 기본 결과 객체 초기화
const results: TestResults = {
url: getSupabaseUrl(),
proxyUrl: '', // 빈 문자열로 초기화
usingProxy: isCorsProxyEnabled(),
proxyType: getProxyType(),
client: true,
restApi: false,
auth: false,
database: false,
errors: [],
debugInfo: {
originalUrl: getSupabaseUrl(),
proxyUrl: '',
usingProxy: isCorsProxyEnabled(),
proxyType: getProxyType(),
keyLength: getSupabaseKey().length,
browserInfo: navigator.userAgent,
timestamp: new Date().toISOString(),
backupProxySuccess: false,
lastErrorDetails: ''
}
};
try {
// 클라이언트 유효성 체크
if (!supabase) {
results.client = false;
results.errors.push('Supabase 클라이언트 초기화 실패');
return results;
}
// CORS 프록시 URL 설정
if (results.usingProxy) {
const baseUrl = getSupabaseUrl();
const proxyType = getProxyType();
if (proxyType === 'corsproxy.io') {
results.proxyUrl = `https://corsproxy.io/?${encodeURIComponent(baseUrl)}`;
} else if (proxyType === 'cors-anywhere') {
results.proxyUrl = `https://cors-anywhere.herokuapp.com/${baseUrl}`;
} else {
results.proxyUrl = baseUrl; // 기본값
}
// debugInfo에도 proxyUrl 설정
results.debugInfo.proxyUrl = results.proxyUrl;
} else {
results.proxyUrl = results.url; // 프록시 사용 안 함
results.debugInfo.proxyUrl = results.url;
}
// 테스트 실행
// testAuth 함수에 두 번째 인자로 URL 전달
const authResults = await testAuth(supabase, results.url);
const apiResults = await testRestApi(supabase);
const dbResults = await testDatabaseConnection(supabase);
// 결과 업데이트
results.auth = authResults.success;
results.restApi = apiResults.success;
results.database = dbResults.success;
// 오류 수집
if (!authResults.success && authResults.error) {
results.errors.push(`인증 테스트 실패: ${authResults.error}`);
results.debugInfo.lastErrorDetails += `인증: ${authResults.error}; `;
}
if (!apiResults.success && apiResults.error) {
results.errors.push(`REST API 테스트 실패: ${apiResults.error}`);
results.debugInfo.lastErrorDetails += `API: ${apiResults.error}; `;
}
if (!dbResults.success && dbResults.error) {
results.errors.push(`DB 테스트 실패: ${dbResults.error}`);
results.debugInfo.lastErrorDetails += `DB: ${dbResults.error}; `;
}
} catch (error: any) {
const errorMsg = `테스트 실행 오류: ${error.message || '알 수 없는 오류'}`;
results.errors.push(errorMsg);
results.debugInfo.lastErrorDetails = errorMsg;
}
return results;
};