-
-
Notifications
You must be signed in to change notification settings - Fork 967
Open
Description
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
- Install @sentry/node in a Trigger.dev project
- Create
trigger/init.tswith:
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);
});
- 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 };
},
});
- Run trigger dev
- 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.tsloads dynamically when tasks run, but this happens after ConsoleInterceptor is created during bootstrap and before ConsoleInterceptor.intercept() is called
ericallam
Metadata
Metadata
Assignees
Labels
No labels