Workflow Static Data not persisting between production executions

Hi,

I think Workflow Static Data resets on every execution and doesn’t work as expected!

Using $getWorkflowStaticData() but data doesn’t persist.

Simplifying the example in docs here with this workflow (run in production):

Results:

First call:

[
  {
    "previous_name": null,
    "current_name": "Anan",
    "execution_mode": "production",
    "execution_id": "54286"
  }
]

Second call:

[
  {
    "previous_name": null,
    "current_name": "Anan",
    "execution_mode": "production",
    "execution_id": "54287"
  }
]

As you can see, previous_name is always null and data never persists between executions!

Question: What configuration is needed for static data persistence? Is there something I’m missing or is this a bug?



  • n8n version: Self-hosted n8n v2.5.2
  • Database: PostgreSQL
  • Running n8n via: Docker
2 Likes

This is expected behavior and not a bug.

getWorkflowStaticData() is not designed to be a reliable persistence layer
between production executions, especially in self-hosted or multi-worker setups.

In production mode, executions can run on different workers or processes,
so static data may not be shared or persisted consistently.
This is why previous_name keeps resolving to null.

Static data works best for:

  • Temporary state during active executions
  • Simple counters in single-instance setups
  • Non-critical metadata

It should not be used as a replacement for durable storage.

If you need reliable persistence between executions, the recommended approach is:

  • Use a database (Postgres, MySQL, etc.)
  • Use Redis or another external key-value store
  • Or store state in an external service

This behavior is documented but often misunderstood.
So what you’re seeing here is expected behavior in production environments.

AI replies every where, nobody even try to read or test :sweat_smile:

Hello,

Did you ever figured it out? I am facing the same issue, with even a simple Code node triggered each minute does not update its counter:

const staticData = $getWorkflowStaticData(‘global’);
staticData.counter = (staticData.counter || 0) + 1;
return [{ json: { current: staticData.counter } }];

Running in prod, not manually. Backend is postgres.
Thanks

No, I believe it’s a bug,

That’s why I posted it here, maybe someone can look into it…

2 Likes

I’m having the same issue.
I need getWorkflowStaticData since a long time, in the past it worked, but since I have the external runner logic it getWorkflowStaticData isn’t available anymore in a second run :frowning:

I just updated to n8n v2.7, and surprisingly it’s working again!:partying_face:

@jicho @yannickgaultier try update to the latest beta..

Hi

Surprisingly, I see the same after updating to 2.7.0 despite the detailed changelog on Github not mentioning anything about static data (I checked yesterday before posting here)…

1 Like

Hi, Just checked with 2.7.1 and it is looking good / working in that version :slight_smile:

1 Like