n8n icon indicating copy to clipboard operation
n8n copied to clipboard

Workflow can not be enabled using command line

Open smalot opened this issue 2 years ago • 13 comments

Describe the bug

The command line fail to enable workflow using 'update:workflow'.

To Reproduce Steps to reproduce the behavior:

  1. Create a workflow with a webhook trigger
  2. Enable this workflow with UI
  3. Disable workflow with command line : docker-compose exec n8n n8n update:workflow --all --active=false (response is : Deactivating all workflows)
  4. Check status in UI : workflow is disabled
  5. Enable workflow with command line : docker-compose exec n8n n8n update:workflow --all --active=true (response is : Deactivating all workflows)
  6. Check status in UI : workflow is still disabled

The result is the same when using --id=1 instead of --all.

Expected behavior

Workflow should be activated with update:workflow --all --active=true as done with UI.

Environment (please complete the following information):

  • OS: docker
  • n8n Version : 0.203.1
  • Node.js Version : v16.17.0]
  • Database system : SQLite
  • Operation mode : own

Additional context Add any other context about the problem here.

smalot avatar Nov 28 '22 21:11 smalot

Hey @smalot,

I have just given this a go and while the command does come back and say deactiving workflow with ID: xx it looks like it has enabled the workflow.

In your testing did it fail with all workflows or just ones with certain triggers?

Joffcom avatar Nov 29 '22 08:11 Joffcom

Hi @Joffcom

However I don't care about command line feedback, the workflow is not enabled. Only the disable is applied.

BR

smalot avatar Nov 30 '22 15:11 smalot

Hey @smalot,

Did it fail with all workflows or just ones with certain triggers? The feedback message didn't matter but I was unable to reproduce.

Joffcom avatar Nov 30 '22 17:11 Joffcom

Hi @Joffcom

Indeed, it works with the --id=[id] specified, but not with the --all flag.

Here a sample code to reproduce

version: "3.3"
services:
  n8n:
    image: n8nio/n8n:0.204.0
    environment:
      - N8N_ENCRYPTION_KEY=qa
      - DB_TYPE=mysqldb
      - DB_MYSQLDB_HOST=mysql
      - DB_MYSQLDB_USER=root
      - DB_MYSQLDB_PASSWORD=root
      - DB_MYSQLDB_DATABASE=n8n
    ports:
      - "5678:5678"
    links:
      - mysql:mysql

  mysql:
    image: mysql:latest
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_USER=n8n
      - MYSQL_PASSWORD=n8n
      - MYSQL_DATABASE=n8n
    ports:
      - "3306:3306"

  phpmyadmin:
    image: phpmyadmin:5-apache
    environment:
      - PMA_HOST=mysql
      - PMA_USER=root
      - PMA_PASSWORD=root
    links:
      - mysql:mysql
    ports:
      - "9000:80"

Step 1 : launch docker

docker-compose up -d mysql
sleep 30
docker-compose up -d

Step 2

create a workflow with the webhook trigger node

Step 3

docker-compose exec n8n n8n update:workflow --all --active=true

However, if you active the workflow manually using the UI, the following command line works to disable it:

docker-compose exec n8n n8n update:workflow --all --active=false

BR

smalot avatar Nov 30 '22 21:11 smalot

Hey @smalot,

Perfect, I didn't test with All yet as the initial report mentioned ID as well. Will test this again later today with the all option and see what is going on.

Joffcom avatar Dec 01 '22 09:12 Joffcom

Hi @Joffcom

Any news ?

smalot avatar Dec 05 '22 09:12 smalot

Hey @smalot,

Not yet, I had a couple of other issues to look into and I noticed there are a couple for the CLI so I want to check them at the same time and get the internal dev tickets created.

Joffcom avatar Dec 05 '22 16:12 Joffcom

Just adding that we have an internal open for this which we are tracking as N8N-3763

Joffcom avatar Mar 01 '23 16:03 Joffcom

Working as expected

+ n8n update:workflow --all --active false
Deactivating all workflows
Done

Workflow activating, but print "Deactivating"

+ n8n update:workflow --id 1 --active true
Deactivating workflow with ID: 1
Done

Not working as expected

+ n8n update:workflow --all '--active=true'
Deactivating all workflows
Done

0.222.3

grachevko avatar Apr 21 '23 09:04 grachevko

Hey @grachevko,

Looking at the internal ticket for this it is still in a triage state so I wouldn't expect it to work at the moment. Once this has been fixed we will typically pop a note on this issue to let people know.

Joffcom avatar Apr 21 '23 10:04 Joffcom

Hey @Joffcom

I guess it's not related, but after restarting n8n workflow on console marked as activated. But on call webhook n8n return - workflow not registered. Deactivate/active workflow though CLI not fix this. It started only after deactive/active in web console

grachevko avatar Apr 21 '23 11:04 grachevko

This should be fixed in the next release 🚀

See: https://github.com/n8n-io/n8n/pull/8412

despairblue avatar Jan 23 '24 11:01 despairblue

Fix got released with [email protected]

janober avatar Jan 24 '24 13:01 janober