Why can't my CustomJs not read my http node output? #5313
Replies: 1 comment
|
@focusclouddev
is fairly generic, so it's difficult to pinpoint the exact cause without seeing the flow. However, if your Custom JS node is reading the output of an HTTP node, there are a few common things I'd check. 1. Verify what the HTTP node is actually returningFirst, inspect the output of the HTTP node by itself.
If the endpoint is expected to return JSON, try opening it in your browser or calling it with 2. Check the output typeIf your endpoint returns something like: [
{
"message": "Hello"
},
{
"message": "Hi"
}
]your Custom JS should access it as an array. If it returns: {
"messages": [
{
"message": "Hello"
}
]
}the access path is different. A mismatch between the expected and actual JSON structure can easily lead to runtime errors. 3. Confirm the HTTP node completed successfullyIf the HTTP request fails, the Custom JS node may receive an error object or no usable data at all. There have been a few HTTP node issues reported where request formatting or variable interpolation caused unexpected inputs or failed requests, so it's worth verifying the HTTP node independently before debugging the Custom JS. :contentReference[oaicite:0]{index=0} 4. Log the incoming dataInstead of immediately accessing fields, inspect what the node actually receives. For example, if your Custom JS supports logging: console.log(input);
return JSON.stringify(input, null, 2);This will quickly show whether:
5. Make sure you're referencing the correct outputFlowise has evolved its workflow nodes over time, including improvements around passing structured JSON between nodes. If you're referencing the wrong variable or output field, the Custom JS node may not receive the data you expect. :contentReference[oaicite:1]{index=1} Could you share:
Those four pieces should make it possible to determine whether the issue is:
If this solves your problem, feel free to mark it as the accepted answer so others can find it easily. |
Uh oh!
There was an error while loading. Please reload this page.
Hello there?⚠️ Failed to read data from server (unexpected input).
I have an agent I want it to attach a random message from an http link which is a json file. But every time I get an error what might be the cause?
All reactions