gitea
This commit is contained in:
32
backend/scripts/debug-fetch.ts
Normal file
32
backend/scripts/debug-fetch.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import 'dotenv/config';
|
||||
import { query } from '../src/db';
|
||||
import { fetchPage } from '../src/services/fetcher';
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
const result = await query('SELECT * FROM monitors WHERE url LIKE $1', ['%3002%']);
|
||||
const testMonitor = result.rows[0];
|
||||
|
||||
if (testMonitor) {
|
||||
console.log(`Found monitor: "${testMonitor.name}"`);
|
||||
console.log(`URL in DB: "${testMonitor.url}"`);
|
||||
console.log(`URL length: ${testMonitor.url.length}`);
|
||||
|
||||
console.log('Testing fetchPage for DB URL...');
|
||||
const result = await fetchPage(testMonitor.url);
|
||||
console.log('Result:', {
|
||||
status: result.status,
|
||||
byteLength: result.html.length,
|
||||
error: result.error
|
||||
});
|
||||
} else {
|
||||
console.log('No monitor found with port 3002');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error:', err);
|
||||
} finally {
|
||||
process.exit();
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
Reference in New Issue
Block a user