Skip to content

CLS context ID not consistently applied to logs inside NATS microservices (context not propagated through NATS request pipeline) #1510

@GHkrishna

Description

@GHkrishna

Description

In the OID4VC-Verification microservice and other NATS-based services, logs emitted using Nest's Logger (including new Logger()) are correctly intercepted by our custom logger adapter (per PR #1509). However, these log entries do not contain the contextId that is expected to be propagated across service boundaries.

This behavior differs from the API Gateway, where the contextId appears correctly.

Root Cause

The API-Gateway runs inside the HTTP request pipeline, where the CLS interceptor is activated automatically.
However, NATS microservices do not have CLS context propagation by default.

Expected Behavior

  • Context ID should propagate through NATS request → handler → service → logger
  • Logs in microservices should show the same correlation ID as in API Gateway

Actual Behavior

  • contextId is missing in all logs that originate from NATS microservice execution flow

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementImproving existing code or adding enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions