Skip to content

bug: Console logs swallowed by Sentry in dev mode #2900

@isshaddad

Description

@isshaddad

Provide environment information

Any trigger and sentry version

Describe the bug

Console logs (console.log, console.info, etc.) and Trigger.dev logger calls (logger.info) intermittently fail to appear in the Trigger.dev dashboard UI when running in development mode with Sentry initialized in trigger/init.ts.

The issue occurs intermittently in development. When it happens, all console output is swallowed and never reaches the Trigger.dev UI, even though the task executes successfully.

Expected behavior: Console logs should always appear in the Trigger.dev dashboard regardless of Sentry initialization.

The issue does NOT occur in production environments. Logs work correctly when deployed.

Reproduction repo

n/a

To reproduce

  1. Install @sentry/node in a Trigger.dev project
  2. Create trigger/init.ts with:
import { tasks } from "@trigger.dev/sdk";
import * as Sentry from "@sentry/node";

Sentry.init({
  defaultIntegrations: false,
  dsn: process.env.SENTRY_DSN,
  environment: process.env.NODE_ENV === "production" ? "production" : "development",
});

tasks.onFailure(({ payload, error, ctx }) => {
  Sentry.captureException(error, {
    extra: { payload, ctx },
  });
  await Sentry.flush(2000);
});
  1. Create a test task that logs extensively:
export const testTask = task({
  id: "test",
  run: async () => {
    console.log("Test log");
    console.info("Test info");
    logger.info("Trigger logger test");
    return { success: true };
  },
});
  1. Run trigger dev
  2. Observe that logs intermittently do not appear in the Trigger.dev dashboard UI

Additional information

  • Issue only affects development mode, not production
  • Issue most likely happens because in development environment, init.ts loads dynamically when tasks run, but this happens after ConsoleInterceptor is created during bootstrap and before ConsoleInterceptor.intercept() is called

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions