n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
50.42k stars 8.2k forks source link

Copying a webhook trigger with path params to new workflow keeps UUID from old #11966

Open jimleuk opened 3 days ago

jimleuk commented 3 days ago

Bug Description

Had a head scratcher this morning when validating my webhook, execution logs were not showing up in the workflow's executions tab. Discovered that they were getting logged in another workflow.

It turns out if you copy a webhook trigger with path params into another workflow, the trigger keeps the UUID of the old workflow and it's not possible to change it. This means you have 2 duplicate webhook triggers where the one in the newer workflow seems to be triggering but does not in the older workflow.

The workaround is to create an entirely new webhook trigger within the new workflow and copy the values over instead of copy+pasting from other workflow.

Not a big issue because the trigger is still only executed once but is unexpected and ideally should be mentioned somewhere in the docs.

To Reproduce

  1. Let's say we have 2 workflows - workflow A and workflow B
  2. Create a webhook trigger with path param in workflow A
  3. Copy this webhook trigger to workflow B
  4. Inspect webhook URL in webhook trigger contains the UUID from workflow A
  5. Though duplicated, the trigger only executes once and the execution log lands in workflow B's execution tab.

Example webhook URL: https://jimleuk.app.n8n.cloud/webhook/<UUID>/ai-interview-transcripts/:session_id

Expected behavior

When copying a webhook trigger with path params to a new workflow, the UUID in its URL should be updated to the current workflow's UUID and not retain from the previous workflow.

Operating System

Cloud

n8n Version

1.69.2

Node.js Version

???

Database

SQLite (default)

Execution mode

main (default)

Joffcom commented 3 days ago

Hey @jimleuk,

We have created an internal ticket to look into this which we will be tracking as "GHC-529"

mutdmour commented 2 days ago

@jimleuk Maybe I don't understand the issue, but this seems to be working as expected. You can only have one active webhook with the same path. When you copy a node from a workflow to another, the path should stay the same. Otherwise would be confusing for users. You should be able to edit it though, once the webhook node is copied. Can you please share a recording or more info to help me understand the issue better?

jimleuk commented 2 days ago

@mutdmour Thanks for the quick reply. Yeah, thinking about it some more you're right and I get your point. I think maybe it's more of the order of events which led to my own confusion about this.

Video 1: https://drive.google.com/file/d/1sF3hKPptZC5Y8F_sXBJvKFnWqE4FcUJB/view?usp=sharing Here, I'm copying the webhook over. There are now 2 templates with the same webhook trigger.

Video 2: https://drive.google.com/file/d/1aj3lWK9U56KIkGhtVER1XWCB3YBBc2pw/view?usp=sharing Here, both workflows are active with identical webhook triggers. 1) In production mode, webhook trigger execution log will show up workflow B and not workflow A. 2) In test mode, webhook-test trigger executions log shows up in both workflow B and Workflow A.

It does sound like edge-case territory now 😆 and as long as you don't copy+paste the webhook trigger node, this shouldn't be a problem.

Happy to close this issue.

mutdmour commented 2 days ago

Thank you for sharing the videos. This helped clarify the issue and it does seem like confusing behavior. Not sure what the correct behavior should be though.

I would expect n8n to throw an error when trying to activate a workflow with the same webhook that's already active. Or the uuid in path should be editable or changeable.

Automatically changing the UUID when copy/pasting might be problematic/confusing for users that need the path to the same, for example, if one is migrating workflows or refactoring them.

Will reach out to Product to clarify what best behavior should be here and try to fix it. Thanks for sharing.