After app restart or upgrade, active webhook are no longer registered and must be reactivated to work again

Hello,

I notice that when my n8n instance restart (self hosted) due to maintenance or upgrade of n8n :

  • my cron workflow resume as expected
  • my webhook node do not resume despite being marked as active

I must edit it, disable it and re-enable it so that it works.

Before reactivating the webhook:

http POST https://n8n.mysite.fr/webhook/<webhook id>
HTTP/1.1 404 Not Found
Content-Length: 380
Content-Type: application/json; charset=utf-8
Date: Sun, 24 Oct 2021 19:14:24 GMT
ETag: W/"17c-hpC9eE2ns+Ge46MmJecCTc8GFxc"
Keep-Alive: timeout=5
Sozu-Id: 01FJSVKD72W2AKAHNVAD406RBP
Vary: Accept-Encoding
X-Powered-By: Express

{
    "code": 404,
    "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)",
    "message": "The requested webhook \"POST <wehook id>\" is not registered."
}

Once reactivated,

http POST https://n8n.mysite.fr/webhook/<webhook id>
HTTP/1.1 200 OK
Content-Length: 35
Content-Type: application/json; charset=utf-8
Date: Sun, 24 Oct 2021 19:14:52 GMT
ETag: W/"23-oDXMYq3oYYmi7auuVaxD2QFztMg"
Keep-Alive: timeout=5
Sozu-Id: 01FJSVM7WYZA9VG6NSJ98F57XH
Vary: Accept-Encoding
X-Powered-By: Express

{
    "message": "Workflow got started."
}

On app side:

2021-10-24T19:11:29.419Z: Initializing n8n process
2021-10-24T19:11:29.419Z: ****************************************************
2021-10-24T19:11:29.419Z: *                                                  *
2021-10-24T19:11:29.419Z: *   n8n now sends selected, anonymous telemetry.   *
2021-10-24T19:11:29.419Z: *      For more details (and how to opt out):      *
2021-10-24T19:11:29.419Z: *   https://docs.n8n.io/reference/telemetry.html   *
2021-10-24T19:11:29.419Z: *                                                  *
2021-10-24T19:11:29.419Z: ****************************************************
2021-10-24T19:11:29.419Z: UserSettings were generated and saved to: /home/bas/.n8n/config
2021-10-24T19:11:31.353Z: WARNING: Nokogiri was built against libxml version 2.9.10, but has dynamically loaded 2.9.12
2021-10-24T19:11:31.353Z: Nothing listening on 0.0.0.0:8080 yet. If the deployment fails after this message, please update your configuration and redeploy.
2021-10-24T19:11:34.572Z: n8n ready on 0.0.0.0, port 8080
2021-10-24T19:11:34.573Z: Version: 0.145.0
2021-10-24T19:11:35.060Z:     => Started
2021-10-24T19:11:35.060Z: Editor is now accessible via:
2021-10-24T19:11:35.060Z: https://n8n.mysite.fr:8080/
2021-10-24T19:11:35.059Z: ================================
2021-10-24T19:11:35.060Z:   Start Active Workflows:
2021-10-24T19:11:35.060Z: ================================
2021-10-24T19:11:35.060Z:   - RSS To BDH Buffer
2021-10-24T19:11:35.060Z:     => Started
2021-10-24T19:11:35.060Z:   - BDH Newsfeed to AirTable
2021-10-24T19:11:36.630Z: Application start successful
2021-10-24T19:11:36.630Z: No cron to setup

What I use for env variables:

GENERIC_TIMEZONE="Europe/Paris"
N8N_BASIC_AUTH_PASSWORD="<REDACTED>"
N8N_BASIC_AUTH_USER="<REDACTED>"
N8N_ENCRYPTION_KEY="<REDACTED>"
N8N_HOST="n8n.mysie.fr"
NODE_ENV="production"
PORT="8080"
WEBHOOK_URL="https://n8n.mysite.fr/"

Welcome to the community @nsteinmetz!

That normally only happens when the new n8n instance gets started before the old one did shut down (Blue-green deployment). Could this be the case here?

1 Like

Thanks a lot, that’s the solution !

Glad to hear that it helped.

Btw. if you need it to work, you can also set the environment variable N8N_SKIP_WEBHOOK_DEREGISTRATION_SHUTDOWN=true. It does then not deregister them.

1 Like