-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-env.js
More file actions
29 lines (27 loc) · 1.23 KB
/
Copy pathdebug-env.js
File metadata and controls
29 lines (27 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Quick debugging script to check environment variables in production
console.log('=== ENVIRONMENT DEBUG ===');
console.log('VITE_API_BASE_URL:', import.meta.env.VITE_API_BASE_URL || 'undefined');
console.log('VITE_WS_BASE_URL:', import.meta.env.VITE_WS_BASE_URL || 'undefined');
console.log('VITE_ENVIRONMENT:', import.meta.env.VITE_ENVIRONMENT || 'undefined');
console.log('Current Origin:', window.location.origin);
console.log('========================');
// Test API endpoint
const testAPI = async () => {
const baseURL = import.meta.env.VITE_API_BASE_URL || window.location.origin;
try {
const response = await fetch(`${baseURL}/api/v1/health`);
console.log('API Test Response:', response.status, response.statusText);
const data = await response.json();
console.log('API Test Data:', data);
} catch (error) {
console.error('API Test Failed:', error);
console.log('Trying Railway direct...');
try {
const directResponse = await fetch('https://website-production-8f8a.up.railway.app/api/v1/health');
console.log('Direct Railway Test:', directResponse.status, directResponse.statusText);
} catch (directError) {
console.error('Direct Railway Test Failed:', directError);
}
}
};
testAPI();