Fixed download pcap and jaeger trace when using fetch lib (#436)

* fixed cannot download pcap file

* wip
This commit is contained in:
Hoan Luu Huu
2025-05-08 07:08:06 +07:00
committed by GitHub
parent 217c11a5e1
commit e41caf8887
2 changed files with 3 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ const basicAuth = (apiKey) => {
const header = `Bearer ${apiKey}`;
return {Authorization: header};
};
const { Readable } = require('stream');
const SEVEN_DAYS_IN_MS = (1000 * 3600 * 24 * 7);
const HOMER_BASE_URL = process.env.HOMER_BASE_URL || 'http://127.0.0.1';
@@ -126,7 +126,7 @@ const getHomerPcap = async(logger, apiKey, callIds, method) => {
logger.error({response}, 'Error retrieving messages');
return;
}
return response.body;
return Readable.fromWeb(response.body);
} catch (err) {
logger.info({err}, `getHomerPcap: Error retrieving messages for callid ${callIds}`);
}

View File

@@ -6,7 +6,7 @@ const getJaegerTrace = async(logger, traceId) => {
return null;
}
try {
const response = await fetch(`${JAEGER_BASE_URL}/api/traces/${traceId}`);
const response = await fetch(`${JAEGER_BASE_URL}/api/v3/traces/${traceId}`);
if (!response.ok) {
logger.error({response}, 'Error retrieving spans');
return;