-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(core): Don't fail task runner task if logging fails #12401
fix(core): Don't fail task runner task if logging fails #12401
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
|
n8n Run #8512
Run Properties:
|
Project |
n8n
|
Branch Review |
cat-447-console-logging-the-context-object-throws
|
Run status |
Passed #8512
|
Run duration | 04m 47s |
Commit |
7a951806eb: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 tomi 🗃️ e2e/*
|
Committer | Tomi Turtiainen |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
3
|
Pending |
0
|
Skipped |
0
|
Passing |
484
|
View all changes introduced in this branch ↗︎ |
|
const context: Context = { | ||
[inspect.custom]: () => '[[ExecutionContext]]', | ||
require: this.requireResolver, | ||
module: {}, | ||
console: this.buildCustomConsole(taskId), | ||
$getWorkflowStaticData: (type: 'global' | 'node') => workflow.getStaticData(type, node), | ||
...this.getNativeVariables(), | ||
...dataProxy, | ||
...this.buildRpcCallObject(taskId), | ||
...additionalProperties, | ||
}; | ||
|
||
return context; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const context: Context = { | |
[inspect.custom]: () => '[[ExecutionContext]]', | |
require: this.requireResolver, | |
module: {}, | |
console: this.buildCustomConsole(taskId), | |
$getWorkflowStaticData: (type: 'global' | 'node') => workflow.getStaticData(type, node), | |
...this.getNativeVariables(), | |
...dataProxy, | |
...this.buildRpcCallObject(taskId), | |
...additionalProperties, | |
}; | |
return context; | |
return { | |
[inspect.custom]: () => '[[ExecutionContext]]', | |
require: this.requireResolver, | |
module: {}, | |
console: this.buildCustomConsole(taskId), | |
$getWorkflowStaticData: (type: 'global' | 'node') => workflow.getStaticData(type, node), | |
...this.getNativeVariables(), | |
...dataProxy, | |
...this.buildRpcCallObject(taskId), | |
...additionalProperties, | |
}; |
this.send({ | ||
type: 'runner:rpc', | ||
callId, | ||
taskId, | ||
name, | ||
params, | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no catch
block here? Shouldn't we error the task if RPC fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RPC calls are initiated by user code. Hence it's up to the user code to handle or ignore them. If the user code throws, we of course error the task.
✅ All Cypress E2E specs passed |
Got released with |
1 similar comment
Got released with |
Got released with |
1 similar comment
Got released with |
Summary
To conform to old Code Node behaviour, make sure JS task execution doesn't fail if logging fails. The issue mainly comes when trying to
console.log
the context object (e.g.this
), because most of the built-ins are not serializable.Related Linear tickets, Github issues, and Community forum posts
https://linear.app/n8n/issue/CAT-447/console-logging-the-context-object-throws
Review / Merge checklist
release/backport
(if the PR is an urgent fix that needs to be backported)