vibex-sh 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +20 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -551,13 +551,21 @@ async function main() {
|
|
|
551
551
|
}
|
|
552
552
|
|
|
553
553
|
try {
|
|
554
|
-
//
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
554
|
+
// Determine ingest URL
|
|
555
|
+
let ingestUrl;
|
|
556
|
+
if (webUrl.includes('localhost') || webUrl.includes('127.0.0.1')) {
|
|
557
|
+
// Local development - use Workers dev server
|
|
558
|
+
ingestUrl = 'http://localhost:8787/api/v1/ingest';
|
|
559
|
+
} else if (process.env.VIBEX_WORKER_URL) {
|
|
560
|
+
// Use explicit Worker URL if set
|
|
561
|
+
ingestUrl = `${process.env.VIBEX_WORKER_URL}/api/v1/ingest`;
|
|
562
|
+
} else {
|
|
563
|
+
// Production default - use Worker URL (not web URL)
|
|
564
|
+
const defaultWorkerUrl = 'https://vibex-ingest.prop.workers.dev';
|
|
565
|
+
ingestUrl = `${defaultWorkerUrl}/api/v1/ingest`;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
console.log(` 📤 Sending log to: ${ingestUrl}`);
|
|
561
569
|
|
|
562
570
|
const response = await fetch(ingestUrl, {
|
|
563
571
|
method: 'POST',
|
|
@@ -573,6 +581,7 @@ async function main() {
|
|
|
573
581
|
|
|
574
582
|
if (!response.ok) {
|
|
575
583
|
const errorData = await response.json().catch(() => ({}));
|
|
584
|
+
console.error(` ✗ HTTP ${response.status}: ${errorData.message || response.statusText}`);
|
|
576
585
|
if (response.status === 429) {
|
|
577
586
|
console.error('\n ⚠️ Rate Limit Exceeded');
|
|
578
587
|
console.error(` ${errorData.message || 'Too many requests. Please try again later.'}`);
|
|
@@ -586,9 +595,12 @@ async function main() {
|
|
|
586
595
|
}
|
|
587
596
|
console.error('');
|
|
588
597
|
}
|
|
598
|
+
} else {
|
|
599
|
+
const result = await response.json().catch(() => ({}));
|
|
600
|
+
console.log(` ✓ Log sent successfully (processed: ${result.processed || 1})`);
|
|
589
601
|
}
|
|
590
602
|
} catch (error) {
|
|
591
|
-
console.error(
|
|
603
|
+
console.error(` ✗ Error sending log to ${ingestUrl}:`, error.message);
|
|
592
604
|
}
|
|
593
605
|
};
|
|
594
606
|
|