fix: removes pino pretty from edge runtime (#7510)

This commit is contained in:
Anshuman Pandey
2026-03-18 12:02:55 +05:30
committed by GitHub
parent 61befd5ffd
commit 433750d3fe

View File

@@ -45,6 +45,8 @@ const baseLoggerConfig: LoggerOptions = {
* - Both: optional pino-opentelemetry-transport for SigNoz log correlation when OTEL is configured
*/
const buildTransport = (): LoggerOptions["transport"] => {
const isEdgeRuntime = process.env.NEXT_RUNTIME === "edge";
const hasOtelEndpoint =
process.env.NEXT_RUNTIME === "nodejs" && Boolean(process.env.OTEL_EXPORTER_OTLP_ENDPOINT);
@@ -77,6 +79,11 @@ const buildTransport = (): LoggerOptions["transport"] => {
};
if (!IS_PRODUCTION) {
// Edge Runtime does not support worker_threads — skip pino-pretty to avoid crashes
if (isEdgeRuntime) {
return undefined;
}
// Development: pretty print + optional OTEL
if (hasOtelEndpoint) {
return { targets: [prettyTarget, otelTarget] };