getWorkflowStaticData() not resolved in function node editor: Cannot find name '$getWorkflowStaticData'

I’m a new n8n user so this may be operator error/ignorance, but I can’t seem to use the $getWorkflowStaticData() function.

The function is not recognized by the editor (red squiggle underline) and the editor suggests:

Cannot find name '$getWorkflowStaticData'. Did you mean 'workflowStaticData'?

I am using the sample workflow:

I saw this issue, but can’t tell if it is related: $getWorkflowStaticData is not defined · Issue #12125 · n8n-io/n8n · GitHub

Information on n8n setup

  • n8n version: 1.81.4
  • Running n8n via Docker
  • Operating system: Ubuntu 22.04.5 LTS
    I’m not sure on the other details. I start n8n with this command:
sudo docker run -it --rm --detach --name n8n -p 5678:5678 \
	-v n8n_data:/home/node/.n8n \
	-e GENERIC_TIMEZONE="Europe/Berlin" \
	-e TZ="Europe/Berlin" \
	-e N8N_RUNNERS_ENABLED=true \
	-e N8N_SECURE_COOKIE=false \
	docker.n8n.io/n8nio/n8n
  • Static data isn’t available when testing workflows. The workflow must be active and called by a trigger or webhook to save static data.

Did you run from Trigger Manually Node?

I wasn’t running the workflow at all. I am only typing in the code editor while creating the workflow.

I understand that it won’t run properly with a manual invocation, but shouldn’t the function at least:

  • appear in the suggestion list when I type the “$” (see pic)
  • not fail syntax checking?

I have never used this static data before. I prefer to rely on my database instead.
I added a few statements to the code to ensure it run. However, I agree with you. Ideally, it should show up in the autocomplete feature and also be available during the testing phase.