If I try to run even a basic code it just seems to timeout using the cloud version:
try {
const text = $json?.body?.text ?? 'missing';
return {json: { text } };
} catch (err) {
return { json: { error: err.message } };
}
If I try to run even a basic code it just seems to timeout using the cloud version:
try {
const text = $json?.body?.text ?? 'missing';
return {json: { text } };
} catch (err) {
return { json: { error: err.message } };
}
Just tried switching to python and that seems to work e.g.
# Add a new field called 'myNewField' to the JSON of the item
_input.item.json.myNewField = 1
return _input.item
But with the same in javascript nothing:
// Add a new field called 'myNewField' to the JSON of the item
$input.item.json.myNewField = 1;
return $input.item;
Is there still a problem with TaskRunners as described here: Issue with Code Node Timeout in n8n Cloud - #6 by Kivema
While I can get reasonably far with the python beta, manipulating PsProxy isn’t proving particularly fruitful.
I wanted to add an element to the JSON output from a previous step but it adds what looks like json schema. I tried using json.dumps but that’s not compatible with pyodide.ffi.JsProxy so ran into a dead end there too.
I did try using JS .push but that just hung the workflow, been stuck running for over 10 mins even though it has a 10 second timeout on it ![]()
Tried converting it to a list and then re-assigning once the new item is added, but it also just hangs.
import json
view = _input.item.json.view
# Convert PsProxy to real python list to avoid serialisation bug.
blocks = list(view.blocks)
options = 0
for block in blocks:
element = block.get("element") or block["elements"][0]
action_id = element.action_id
if action_id.startswith("option"):
options += 1
elif action_id == "new_option":
# Create a new option input block.
options += 1
new_option = {
"type": "input",
"element": {
"type": "plain_text_input",
"action_id": f"option{options}",
"placeholder": {
"type": "plain_text",
"text": f"Option {options}",
"emoji": True
}
},
"label": {
"type": "plain_text",
"text": f"Option {options}",
"emoji": True
},
"optional": True
}
blocks.insert(-1, new_option)
view.blocks = blocks
break
return view
If however I change the return to: return dict(view) it doesn’t hang, so seems like there’s a serialisation bug that is causing the hang that is prevented by conversion to a dict.
Updating our instance to 1.118.1 BETA seems to have fixed this issue for me, not sure if the stable release would also work.
Will report back if I see it re-occur.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.