getWorkflowStaticData not work

I just installed n8n, I use the docker and version n8n 0.67.3
I have set up posting rss on my social media account. And it works perfectly.
I just haven’t figured out how to get it to post a new url only
I use the code snippet

const staticData = getWorkflowStaticData('global');

// Access its data
const oldlink = staticData.oldlink;

items[0].json.oldlink = oldlink || "";

// Update its data
staticData.oldlink = items[0].json.link;

return items;

The oldlink variable is always empty.

I tried the sample here but it also doesn’t work: https://n8n.io/workflows/199

Welcome to the community @admtpu!

Does it only not work when you are testing or also when you activate the workflow? Because the staticData only saves the data for active workflows so if they run in production, not when started via the UI.

1 Like

I just checked in Executions, it works.
Does it not work if Execute manually?
There is one more error, if I use the docker, when I use the “write binary file” node, I get a permission error.
But if I install from the command line then there is no error.
Thanks for the great tool

Great to hear that it works there and that you enjoy n8n!

Yes for manual executions it does not get saved. The reason is that it saves that data to the database and if it would else overwrite the production date with the current design. For that reason does the data only get persisted in “Production-Mode”.

About writing a file. It is possible that it is read-only in docker. Did you try to write to the folder /tmp or to a folder you mounted into the container?