Skip to content

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

Closed

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

Activity

  1. self-assigned this
    on Nov 10, 2025
  2. added
    bugSomething isn't working
    enhancementImproving existing code or adding enhancement
    on Nov 10, 2025
  3. linked a pull request that will close this issuefeat: trace contextId across services #1509on Nov 10, 2025
  4. GHkrishna commented on Apr 20, 2026

    @GHkrishna
    ContributorAuthor

    Closing as completed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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