Function Null output

Hey Guys, ive been trying to migrate to different host and i deployed latest n8n docker.

I realized function was replaced with code, i was using this in my function node :

const staticData = getWorkflowStaticData('global');
const newTweetIds = items.map(item => item.json["Tweet ID"]);
const oldTweetIds = staticData.oldTweetIds; 

if (!oldTweetIds) {
  staticData.oldTweetIds = newTweetIds;
  return items;
}


const actualNewTweetIds = newTweetIds.filter((id) => !oldTweetIds.includes(id));
const actualNewTweets = items.filter((data) => actualNewTweetIds.includes(data.json['Tweet ID']));
staticData.oldTweetIds = [...actualNewTweetIds, ...oldTweetIds];

return actualNewTweets;

its giving me null output, i moved the code to code but its not working giving me item error.

could someone help me updating this? its supposed to fetch only latest tweets after trigger

thanks!

Hey @marcondy,

My first thought is items.map probably needs to become $input.all().map, Generally anywhere you were using items it would need to become $input.all().

I would start with that and maybe add in a few console.log() lines to test your variables. Don’t forget Static Data is also not populated when you are running a workflow in the UI.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.