Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let traceBuffer: Buffer | undefined;
let traceParsingFailed = false;
try {
// XXX support non-Node implementations by using Uint8Array? protobufjs
// supports that, but there's not a no-deps base64 implementation.
traceBuffer = Buffer.from(traceBase64, 'base64');
} catch (err) {
console.error(
`error decoding base64 for federated trace from ${fetch.serviceName}: ${err}`,
);
traceParsingFailed = true;
}
if (traceBuffer) {
try {
const trace = Trace.decode(traceBuffer);
traceNode.trace = trace;
} catch (err) {
console.error(
`error decoding protobuf for federated trace from ${fetch.serviceName}: ${err}`,
);
traceParsingFailed = true;
}
}
traceNode.traceParsingFailed = traceParsingFailed;
}
}
return response.data;
}
}