fix sentry error and mac-vendor utils issue

This commit is contained in:
2025-09-23 20:01:19 +02:00
parent dfdfbbdf68
commit bb7fa35496
3 changed files with 14 additions and 29 deletions

View File

@@ -1,4 +1,3 @@
// backend/routes/portScan.js
const express = require('express');
const Sentry = require("@sentry/node");
const pino = require('pino');
@@ -27,10 +26,6 @@ router.get('/', (req, res) => {
return res.status(403).json({ success: false, error: 'Operations on private or local IP addresses are not allowed.' });
}
Sentry.configureScope(scope => {
scope.setContext("port_scan_details", { targetIp, requestIp });
});
res.setHeader('Content-Type', 'text/event-stream');
res.setHeader('Cache-Control', 'no-cache');
res.setHeader('Connection', 'keep-alive');
@@ -65,7 +60,8 @@ router.get('/', (req, res) => {
}
} catch (error) {
logger.error({ requestIp, targetIp, error: error.message }, 'Error during port scan stream');
Sentry.captureException(error);
// Add context directly to the captureException call
Sentry.captureException(error, { extra: { requestIp, targetIp } });
if (!isConnectionClosed) {
sendEvent('error', { error: 'An unexpected error occurred during the scan.' });
}