Webhooks does not register when importing workflows via the n8n CLI command

Describe the issue/error/question

I have a problem importing workflows with webhooks triggers in a self-hosted environment. The workflows are imported properly, but the webhooks doesn’t work.

How to reproduce it:

  1. From a local n8n create a workflow with a webhook trigger.
  2. Activate the workflow, clicking on the UI switch.
  3. Export the workflow using the command n8n export:workflow --backup --pretty --output /output/path
  4. Import the workflow in a self-hosted environment, using the command: n8n import:workflow --separate --input=/input/path
  5. The workflow appears active on the n8n UI, however the webhook is not registered and when you call it, returns this error:
{
    "code": 404,
    "message": "The requested webhook \"GET testActive2\" is not registered.",
    "hint": "The workflow must be active for a production URL to run successfully. You can activate the workflow using the toggle in the top-right of the editor. Note that unlike test URL calls, production URL calls aren't shown on the canvas (only in the executions list)"
}

I take this opportunity to congratulate you on the product. I like it a lot. :slightly_smiling_face:

Information on your n8n setup

  • n8n version: 0.212.0
  • Database you’re using (default: SQLite): SQLite in local, MySQL in the self-hosted environment.
  • Running n8n with the execution process [own(default), main]: Own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hey @junke297,

Welcome to the community :tada:

I was sure that I had seen this reported before but I can’t find it now, I have added this to our internal tracker.

1 Like

Hi!

Did you have the opportunity to check out the issue?

Thanks in advance!

Hey @junke297,

It is with one of the core teams at the moment, The internal reference is PAY-206 if you need it.

Because of how the CLI works actually activating workflows would involve a lot of changes and potentially would need an instance restart as well which is not ideal.

The likely outcome for this one will be a documentation update to mention that workflows imported from the CLI will need to be manually activated, We will also set the active option to false so that it doesn’t cause any confusion.

1 Like

Hi!

Thanks for the response and detailed information. I understand the difficulty of the solution.

I would like to share with you one approach that solves the problem (at least, yes for me). Although maybe it isn’t the ideal solution. It consists in a workflow that foreach workflow in n8n deactivates and activates (or the opposite) the status, and that makes the webhooks work again.

Maybe it could be a quick solution until you can fix the issue with a proper solution.

Thanks again for the help.

Hi @junke297,

the solution here will probably be to disable active workflows during CLI import just like as if they were imported through the UI. This unifies the behaviour and also prevents imported workflows that have not been checked from just being turning on by themselves, purely through being imported. This should make it into one of the next releases…

I encountered this issue yesterday when I reset my n8n database on my home-automation instance, and re-imported the workflows via the cli.

My nfc-switch-on-the-lounge-webhook said it was active but I got the same message as the OP.
For me I just quickly de-activated and re-activated my workflows and they work.

New version [email protected] got released which includes the GitHub PR 5840.

1 Like

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