Skip to content

Commit 9046ea4

Browse files
authored
Fix: Prevent hung worker process on flush exceptions (#1501)
* deprecate cli logger warn and error methods * replace broken error logger in deployed workers * changeset
1 parent 7e209e0 commit 9046ea4

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.changeset/ninety-teachers-fold.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Prevent certain log statements from hanging deployed worker processes

packages/cli-v3/src/executions/taskRunProcess.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class TaskRunProcess {
8484
try {
8585
await this.#flush();
8686
} catch (err) {
87-
logger.error("Error flushing task run process", { err });
87+
console.error("Error flushing task run process", { err });
8888
}
8989

9090
await this.kill();
@@ -94,7 +94,7 @@ export class TaskRunProcess {
9494
try {
9595
await this.#flush();
9696
} catch (err) {
97-
logger.error("Error flushing task run process", { err });
97+
console.error("Error flushing task run process", { err });
9898
}
9999

100100
if (kill) {

packages/cli-v3/src/utilities/logger.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ export class Logger {
5858
};
5959
info = (...args: unknown[]) => this.doLog("info", args);
6060
log = (...args: unknown[]) => this.doLog("log", args);
61+
/** @deprecated **ONLY USE THIS IN THE CLI** - It will hang the process when used in deployed code (!) */
6162
warn = (...args: unknown[]) => this.doLog("warn", args);
63+
/** @deprecated **ONLY USE THIS IN THE CLI** - It will hang the process when used in deployed code (!) */
6264
error = (...args: unknown[]) => this.doLog("error", args);
6365
table<Keys extends string>(data: TableRow<Keys>[], level?: Exclude<LoggerLevel, "none">) {
6466
const keys: Keys[] = data.length === 0 ? [] : (Object.keys(data[0]!) as Keys[]);

0 commit comments

Comments
 (0)