// Retrieve the input data
const inputData = $input.all();
const outputData = [];
// Check if inputData is empty
if (inputData.length === 0) {
// Return a message indicating no data found
return [{
json: {
message: 'No data found from RSS feeds.'
}
}];
}
// Iterate over each item
for (const item of inputData) {
const dateval = item.json.pubDate;
const Subval = item.json.title;
const Descval = item.json.content;
const link = item.json.link;
// Check if dateval is valid
if (!dateval) {
outputData.push({
json: {
error: 'Invalid date value',
Title: Subval,
Content: Descval,
URL: link
}
});
continue;
}
// Step 1: Parse the GMT date string to a Date object
const gmtDateStr = dateval;
const gmtDate = new Date(gmtDateStr);
// Step 2: Convert the GMT date to IST
// IST is GMT+5:30
const istOffset = 5.5 * 60; // 5 hours and 30 minutes in minutes
const istDate = new Date(gmtDate.getTime() + istOffset * 60 * 1000);
// Step 3: Format the IST date to a readable string
const istDateStr = istDate.toLocaleString('en-IN', { timeZone: 'Asia/Kolkata' });
// Prepare the output data
outputData.push({
json: {
ISTDate: istDateStr,
Title: Subval,
Content: Descval,
URL: link
}
});
}
// Return the converted dates for all items
return outputData;
N8N is accepting only one trigger node. Unable to save multiple trigger nodes in single flow.
I have multiple RSS trigger nodes, since some trigger nodes might not have any data and some might have data, due to empty RSS trigger nodes I m unable to save the workflow
@Ananth_Rayala
n8n accepts multiple trigger nodes, so that should not be the issue here.
If you have a (trigger) node that is not configured correctly, it will block activating the workflow. So that is probably what is happening here.
If you test your workflow and this test has an error in it because of your code not being executed properly for example this will also result in it not wanting to activate the flow with that error. Simply refreshing the page should fix that. But of course it would be best to fix your error first.
For Single RSS feed trigger node, this is working perfectly fine. I have added a condition in code to handle empty input coming to code node. Any other suggestion would really help.
whenever I m trying to add a rss url in rss feed trigger node, which has no data I m unable to save the flow, but when I add multiple rss feed trigger node which has data I m able to save the workflow
const inputData = $input.all();
const outputData = [];
// Check if inputData is empty
if (inputData.length === 0) {
// Return a message indicating no data found
return [{
json: {
message: 'No data found from RSS feeds.'
}
}];
}
// Iterate over each item
for (const item of inputData) {
// Check if item.json exists and has the expected properties
if (!item.json || !item.json.pubDate || !item.json.title || !item.json.content || !item.json.link) {
outputData.push({
json: {
error: 'Invalid data structure',
item: item
}
});
continue;
}
const dateval = item.json.pubDate;
const Subval = item.json.title;
const Descval = item.json.content;
const link = item.json.link;
// Step 1: Parse the GMT date string to a Date object
const gmtDateStr = dateval;
const gmtDate = new Date(gmtDateStr);
// Step 2: Convert the GMT date to IST
// IST is GMT+5:30
const istOffset = 5.5 * 60; // 5 hours and 30 minutes in minutes
const istDate = new Date(gmtDate.getTime() + istOffset * 60 * 1000);
// Step 3: Format the IST date to a readable string
const istDateStr = istDate.toLocaleString('en-IN', { timeZone: 'Asia/Kolkata' });
// Prepare the output data
outputData.push({
json: {
ISTDate: istDateStr,
Title: Subval,
Content: Descval,
URL: link
}
});
}
// Return the converted dates for all items
return outputData;
I’ve tried another approach without any Code node (only Edit Fields), it gives me the same result.
The test workflow works perfectly, but I’m unable to activate: saving works, not the activation.
I’m wondering if it could be an issue with the RSS Feed Trigger?
I just made a test with only a RSS Feed Trigger node. It contains a Google alert RSS feed with no articles.
When trying to activate it, I get the same problem.
The node doesn’t have any additional settings; it doesn’t look possible to manage it from the editor (maybe it’s a bug in the node’s code)