Investigate CORS proxy failure

The CORS proxy is failing despite being enabled, resulting in REST API and database connection errors. Investigate the cause of the failure.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 12:23:00 +00:00
parent 893e1cf0aa
commit 1623fd7738
4 changed files with 68 additions and 16 deletions

View File

@@ -24,16 +24,25 @@ try {
flowType: 'implicit',
},
global: {
fetch: (url, options) => {
// CORS 디버깅을 위한 사용자 정의 fetch
// 커스텀 fetch 구현
fetch: (...args) => {
// 첫 번째 인자는 URL 또는 Request 객체
const urlOrRequest = args[0];
// URL 로깅 및 디버깅
let url = typeof urlOrRequest === 'string' ? urlOrRequest : urlOrRequest.url;
console.log('Supabase fetch 요청:', url);
return fetch(url, options).then(response => {
console.log('Supabase 응답 상태:', response.status);
return response;
}).catch(err => {
console.error('Supabase fetch 오류:', err);
throw err;
});
// 기본 fetch 호출
return fetch(...args)
.then(response => {
console.log('Supabase 응답 상태:', response.status);
return response;
})
.catch(err => {
console.error('Supabase fetch 오류:', err);
throw err;
});
}
}
});